How to evaluate problems in the <head> of a Magento-project - magento

I have problems with the setting of setRobots() in Magento 1.7.0.2 as I do set those in the backend via the XML-Update AND via the local.xml and though my cms-pages don't get the correct robots-tags. (the same btw also for description or other tags in the head-section)
I do know how to debug the visible parts of the frontend by activating the show-blocks in magentos' backend. But for the head-section that practice doesn't guide me no where. What starting point would be generally recommended to evaluate problems in that section?
Thanks

Like often, maybe a cache problem. config data is stored in cache and block rendering too.
Then you can edit the template at app/design/frontend/{package}/{theme}/template/page/html/head.phtml and/or the block linked app/code/core/Mage/Page/Block/Html/Head.php
Check the Mage_Page_Block_Html_Head::getRobots() method

Related

Is there a way to customize the Heroku internal server error page?

So, Heroku has some very limited documentation on how to customize error pages but I haven’t found documentation on how to modify the internal server error page. I would like to show a custom page so users at least get some guidance on why their query did not work properly. The internal server error is extremely ambiguous.
Here is an example of what the internal server error page currently looks like on my Heroku app…
The pages displayed to your users when the application encounters a system error or is placed in the maintenance state can be customized. Customizing these pages allows you to present a more consistent UI to your users.
Create and store the custom pages
Create your custom pages as static HTML. You may wish to use the default HTML served by Heroku as a template:
https://www.herokucdn.com/error-pages/application-error.html
https://www.herokucdn.com/error-pages/no-such-app.html
https://www.herokucdn.com/error-pages/maintenance-mode.html
https://www.herokucdn.com/error-pages/ssl-cert-error.html
You can reference images or CSS from the HTML as long as you use relative paths (for example, ) and you upload the other assets into the same place as the HTML.
You can host the pages anywhere that can serve web pages. It recommends uploading to Amazon S3. If you use S3, don’t forget to set the HTML and all assets to be publicly readable.
Configure your application
Set the ERROR_PAGE_URL and MAINTENANCE_PAGE_URL config vars to the publicly accessible URLs of your custom pages:
heroku config:set \
ERROR_PAGE_URL=//s3.amazonaws.com/<your_bucket>/your_error_page.html \
MAINTENANCE_PAGE_URL=//s3.amazonaws.com/<your_bucket>/your_maintenance_page.html
Refer this page : https://devcenter.heroku.com/articles/error-pages
Instead of trying to make a custom page for my first issue, I used programming logic to give user errors to preempt problems related to Heroku's Internal Server Error page when my application did not run appropriately. I highly suggest you think deeply before employing this method, as it could confuse users. The Heroku Internal Server Error page is an either-or reason code. While you know (as the programmer) only one reason code applies, since you've preempted the problem with logic, the user won't assume that. For me, it was better than the alternative - which was to leave it completely ambiguous. At least, I can give users some feedback.

Creating Magento Extension - Where to start?

I want to make an extension that injects videos on product pages.
I already read a lot of documentation in Magento website but, sincerely, I have no clue where to start. What's the difference between Magento Extensions and Widgets? Can I develop my extension using only JavaScript? Do I really need to use PHP to develop one?
So many questions, can't find a focus. Can you please share a simple follow trough for me to read on? Thanks.
Credits : Marius
https://magento.stackexchange.com/questions/8344/how-to-write-a-custom-extension/8345#8345
Here is what I usually do:
Always develop with error_reporting on.
Always develop with isDeveloperMode set to true. Just add SetEnv MAGE_IS_DEVELOPER_MODE 1 to your httpd.conf file (or corresponding file for nginx or something else)
If the extension is linked to a core functionality add the
dependency in the declaration file <depends><Mage_Catalog /></depend>
If the module is for community use, use community as codepool to
give the developers the chance to override some classes without
modifying the code directly
Put your frontend design files in app/design/frontend/base/default
to make them available for all themes.
Put your admin design files in
app/design/adminhtml/default/default and do not change the admin
theme. I may want to change it in one of my modules.
Prefix your layout file names and template folder name with the
company name to make it easier to isolate them.
easylife_articles.xml and app/design/.../easylife_articles
Put your static resources (js, css, images) in a similar folder as
the template files easylife_articles/images/doh.png
Attach a simple text file with how to uninstall the extension: What
files need to be removed, what tables need to be dropped, what
config settings need to be removed from core_config_data table.
Do not write queries directly in models, blocks or helpers, use a
resource model for that.
Do not write queries using the table names directly Select * from
sales_flat_order where .... Use a Zend_Select and transform the
table names using ->getTable('sales/order').
Use the base url to include js files in template. Wrong
<script type="text/javascript" src="../js/some.js"></script>.
Right <script type="text/javascript" src="<?php echo Mage::getBaseUrl('js').'some.js'?>"></script>
Do not rewrite classes unless is necessary. Use observers and if
it's not possible use helper methods that receive as parameter and
instance of a class that you wanted to override. Wrong:
Override Mage_Catalog_Model_Product to add the method
getProductArticles(). Right. In your helper add
getProductArticles(Mage_Catalog_Model_Product $product)
If you override classes put a list of them in a readme.txt file
Use the default admin path for the admin section of your module.
Wrong admin url articles/adminhtml_articles/index. Right admin url admin/articles/index
Add ACL for your admin sections. I may want to restrict access to
some of the admins.
Do not add an other js framework (jquery, mootools, ...) if it's not
necessary. Write you code in prototype.
Make you template html W3C valid (this is for OCD developers like myself).
Do not put images in the media folder. Use skin. The media
folder usually is not versioned and this makes it harder to move the
website on different environments.
Test you extension with flat catalog on and off. In order not to double the development time use Chaos Monkey
Test your extension with cache on and cache off.
Avoid using uppercase letter in the module and class names. If not
properly tested this may cause issues on different OS. This is more a recommendation, not a 'must'.
Dispatch events in your code to make it easier for developers to
alter the functionality.
Follow the same coding standards that Magento uses and comment your code.
[Edited] Do not use php short tags (<? $this->doSomething() ?>). Use full tags (<?php $this->doSomething()?>). Also don't use short echo tags, yet. (<?="D'oh";?>). Use (<?php echo "D'oh";?>)
Translate your texts using $this->__ and add the locale translation file with your texts (app/local/en_US/Easylife_Articles.csv) at least for en_US language. Not all
websites are build in English and the identification of texts to
translate is time consuming.
If you sell an extension offer at least basic support. Or at least
answer the support e-mails you receive.
Do not make constant calls to your servers through your extension for licence validation. Once, at installation is more than enough (I don't like this approach either, but it's better than to make calls all the time).
(Inspired by this question)
Develop with the log activated and from time to time take a look at
the var/log/system.log file. The errors listed here are not shown
even with developer mode on. If there is at least one error you end
up with a large log file after a few months of running the extension.
If your extension affects the checkout process or the orders in
some way, make sure it works with multi-shipping, or if it
shouldn't work with multi-shipping, make sure it doesn't affect it.
Do not replace the default Admin Notification bar (or feed URL). If
I'm interested on what you have to offer I will subscribe to your
newsletter. Let me see what Magento has to say. It's more important
to me.
If you encrypt your code files with Ioncube (or something
else)...well...I just hate you and I hope your business goes bankrupt
That's what have so far. I will add more as soon as I think of something else.
You will definitely need XML and PHP, because this is mainly what Magento is built on.
Additionally to the official documents, there are a lot of helpful and very diverse tutorials out there that explain the mechanics of Magento. A web search helps, and I can recommend everything by Alan Storm, for example this litte module: http://alanstorm.com/magento_list_module
As soon as creating an extension works for you, you will also find a lot of tutorials on how to alter the product-view, or you can then post a more specific question here or on magento.stackexchange.com.

How do I find the controller which is providing the data for an Xcart smarty template

One of my big problems is discovering where the data is generated from. I can skin a template fine but when it comes to changing the supplied data for example the breadcrumbs I havn't got a clue where to look.
Is there an easy method for figuring this out?
All your template variables assigned in Modules Directory in X-cart

Magento Block not rendering/Instantiating

I created a custom block (by creating a module and doing a layout update via an xml file), and the block is not rendering for some reason.
I have commercebug installed so i checked the layout xml for the page and it shows that it updated with the proper info, but when I go to the blocks tab it's not there (and not calling it)
this block rendered nicely on my local machine but on the staging server it doesn't work (even though i copied the files etc.)
I am a beginner so any help would be greatly appreciated.
Thanks in advance,
pesach
It sounds like you're saying you've successfully added some Layout XML to the page layout. If you could post that it would help people debug your problem better.
The next three steps to take are
Ensure your block type is correct
Ensure your template file (if you're using one) exists
Ensure the block you're inserting your custom block into will automatically render blocks (i.e. is a text_list block)
If you post the actual layout xml you've added the page layout, we'll be able to help with the items above.

Changing a web page's skin using AJAX

I've got a cookie set up to store the user's theme preference, etc., but I've never used AJAX before, so I could use a little help.
I found this simple little AJAX tutorial, which is enough to get me started, but I'm not sure if I'd be better off having the server send pretty much the entire web page all over again, with the updated theme, or -- if it is possible -- having the server send a script that would modify the page, keeping the content intact, but changing the div, etc. properties in order to achieve the new look.
Thoughts? Comments? "You're doing it wrong, moron"?
Thanks in advance!
If changing theme means only change the classes of your divs and the elemtes of the structure of your page you must do it simply changing the class="" atribute of the html elemts involved. Ej: You can change postions, and floats, colors etc etc.. This would appen only in client without asking to the server again the page (0% traffic from server, nice!)
But, if changing theme means to get other html structure and hierarchy complety different: You dont have other way that ask to the server the page again with the new html...
Conclusion: Think about all those things, if you can get other theme only changin css you can/must use jquery to change the css properties. But, if not, you need to load the new html from the server...
I hope this help you
pd: sorry for my englisgh grammar if its not correct at all!

Resources