Get recently viewed products in magento home page - magento

How to get recently viewed products in magento.
I tried the following code also
$this->getRecentlyViewedProducts();
in the file product_viewed.phtml

1.Place code snippet below in any template u want to add
<?php echo $this->getLayout()->createBlock('reports/product_viewed')->setTemplate('reports/product_viewed.phtml')->toHtml(); ?>
2.Place code snippet below in any Backend cms-> page or static block
{{block type="reports/product_viewed" template="reports/product_viewed.phtml"}}
Replace template name, product_viewed.phtml with your site.

Related

magento - Why my changes on template files are not showing up

I am trying to add the SKU of the products to the product page by adding the following code:
<h3><?php echo $this->__('SKU:') . $this->htmlEscape($_product->getData('sku'));?></h3>
I have cleared Magento cache and deleted cache storage. Unfortunately, the changes on template file are not showing up ... any suggestion?
PHTML file need to be edited
PHTML file edited
Magento get data directly work like getSku(); Try echo $_product->getSku();

Magento remove customer review block from product view page

I am creating custom module for customer review so I need to delete the Magento customer review functionality from product view page. There is any XML code which don't show the Magento customer review on product view page.
try this code i have already used...
<catalog_product_view ranslate="label">
<remove name="product.reviews"/>
</catalog_product_view>
Go to your theme folder> template> catalog> product> open view.phtml then just find the code in this page:<?php echo $this->getReviewsSummaryHtml($_product, 'default', false)?>
Now remove the code and check. I think it solve your issue.
You do not need any xml code to remove customer review block from product view page. Go to System > Configuration > Advanced then look for Mage_Review and disable it.

how to show recent view products on home page in magento

I want to how recently viewed products on home page in magento.
Currently I am using below code but this is now working. so please help!!
getLayout()->createBlock('reports/product_viewed')->setTemplate('reports/product_viewed.phtml')->toHtml(); ?>
Did you forget to echo?
<?php echo $this->getLayout()->createBlock('reports/product_viewed')->setTemplate('reports/product_viewed.phtml')->toHtml(); ?>
By the way if you're doing it from the CMS you need to use:
{{block type="reports/product_viewed" template="reports/product_viewed.phtml"}}

How to put php syntax on cms page in Magento

How can I put a php code on cms page in Magento?
Image here: http://screencast.com/t/COgHigLih7
I want to put
<?php
echo "Test";
?>
You can not add php code directly into the content of a cms page
What you could do is add your php code into a pthml and then call it from you cms page
{{block type="core/template" name="contactForm" template="contacts/my_php_code.phtml"}}

Products are not displayed in magento homepage?

I added some products in the magento admin panel, but i don't know how to display that to my homepage..
Use below code in home page
{{block type="catalog/product_view" product_id="166" template="catalog/product/view.phtml"}}
OR
Create new singleproduct.phtml file in your template directory
visit
http://www.magentocommerce.com/boards/viewthread/19173/
for more detail

Resources