I want to show the SKU code on search result listing page. Like this https://support.3dcart.com/knowledgebase/article/View/269/6/how-do-i-add-the-product-idsku-to-my-search-results Thanks everyone.
In default Magento, the block
Mage_Catalog_Block_Product_List is responsible for listing searching products as in category pages. The template file assoicated with this is
So basically you need to set a new template to this block. This is because the default template is using in various places in Magento and hence if you apply the changes in that file directly, it is going to view in every place. So replace this template with another template. This is how you can achieve this via layout update XML.
<layout> <catalogsearch_result_index> <reference name="search_result_list"> <action method="setTemplate"> <template>custom/catalog/product.list.phtml</template> </action> </reference> </catalogsearch_result_index> </layout>
Now copy paste the file in
In that file, you can see a
foreach loop. put this code inside that loop in the exact place where you need to show your sku
<p><?php echo $_product->getSku() ?></p>