Remove Orders and Returns Link From Footer Section Magento page

Friday, 22. June 2012

Here is another way of disabling the Orders and Returns link from the footer section of Magento pages.

Navigate to the sales.xml layout file of your current theme

Then look for this line somewhere at the bottom of the file

<default>
 <reference name="footer_links">
    <block type="sales/guest_links" name="return_link"/>
    <action method="addLinkBlock"><blockName>return_link</blockName></action>
 </reference>
</default>

You can now comment the reference section out completely or change it to another section of the page.

Enjoy!

Add custom attributes to Magento product grid or listing page

Saturday, 14. April 2012

Thought this will help someone. If you want to use a custom attribute in category product listing pages follow these steps below:

1) Ensure addAttribute Method exists
Navigate to app/code/core/Mage/Catalog/Block/Product/List.php. Search for a method called addAttribute

This should already been added with new versions of Magento, but if your version doesn’t have it. Copy this file to

app/code/local/Mage/Catalog/Block/Product/List.php

Then before the end of class add this script:

  /**
   * Use this method in layouts for extra attributes
   *
   * @param string $code internal name of attribute
   */
  public function addAttribute($code)
  {
    $this->_getProductCollection()->addAttributeToSelect($code);
    return $this;
  }

2) Update your catalog.xml file
Once we have the method in place. Now navigate to your theme’s catalog.xml file and open it.
– Look for handlers catalog_category_default and catalog_category_layered
– then add your attribute codes as show below:

<catalog_category_default>
    <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">			
	...
	<action method="addAttribute"><name>attribute_code</name></action>
	<action method="addAttribute"><name>attribute_code2</name></action>
	...			
   </block>
</catalog_category_default>

3) Use your attribute in list.phtml page
Now you can use the attribute in your theme’s list.phtml page just as normal.

    echo $_product->getAttributeCode(); # OR
    echo $_product->getData('attribute_code2'); # OR
    echo $_product->getAttributeText('attribute_code2');

Enjoy!

Fatal error: Call to a member function toHtml() on a non-object in app/code/core/Mage/Core/Model/Layout.php on line 529

Friday, 11. November 2011

Most upgrades from versions below 1.4 to latest version are more likely to encounter this problem when trying to re-install the same theme back on the new version. The solution is simple as explained below:

Fatal error: Call to a member function toHtml() on a non-object in app/code/core/Mage/Core/Model/Layout.php on line 529

Locate and open the file app/design/frontend/default/YOUR_THEME/layout/page.xml file and change the following line:

<block type="core/profiler" output="toHtml"/>

to

<block type="core/profiler" output="toHtml" name="core_profiler"/>

Enjoy!

Add Review List and Review Form on Magento Product Page Tab

Sunday, 30. October 2011

If you want to add customer reviews on product page tab these steps may help you.

Locate and open your theme’s catalog.xml file

– On the file look/search for: catalog_product_view

– Look for the content enclosed within

<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">

– Add your review form and list as shown below.

<block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs" template="catalog/product/view/tabs.phtml" >
  <block type="review/form" name="product.review.form" as="review_form"/>			                               
  <action method="addTab" translate="title" module="review">
	   <alias>product_additional_data</alias>
	   <title>Reviews</title>
	   <block>review/product_view_list</block>
	   <template>review/product/view/list.phtml</template>
  </action>	                 
</block>

– Your final result should look something like this.

<reference name="content">
  ...
  <block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs" template="catalog/product/view/tabs.phtml" >
    <block type="review/form" name="product.review.form" as="review_form"/>			                               
    <action method="addTab" translate="title" module="review">
	   <alias>product_additional_data</alias>
	   <title>Reviews</title>
	   <block>review/product_view_list</block>
	   <template>review/product/view/list.phtml</template>
    </action>	                 
  </block>    
  ...
</reference>

– Finally you will need to make these changes to the review list template file.

Look for and open file review/product/view/list.phtml

On this file and near the bottom of it, look for and comment out this line

#echo $this->getChildHtml('review_form')

Then, add this line underneath

$layout = Mage::getSingleton('core/layout');
echo $layout->getBlock('content')->getChild('product.info')->getChild('info_tabs')->getChild('review_form')->toHtml();

Magento SEO – XML Sitemap For Google and Other search engines

Wednesday, 3. August 2011

Google and many major search engines can crawl your site for some useful information that can the be exposed to their search results.

The best way to share your store’s information with such crawlers is via the XML sitemap. The easiest way to provide a sitemap of your store to the search engines is probably through the use of robots.txt file.

The Sitemap directive of the robots.txt will help to direct the search engines to the location of the sitemap file for your store. Here is how the directive is specified inside the file.

 Sitemap: http://www.yourdomain.com/sitemap.xml

You can also register the your store’s sitemap manually to search engines any time. You can register sitemaps to:

Google Webmaster tools
Yahoo! Site Explorer
Bing Webmaster Center

There is also a free Magento extension that may help automate manual submission to major search engines which can be found here XML sitemap submission