Friday, October 16, 2015

Call one .phtml file into another .phtml file in magento

<?php
echo $this->getLayout()->createBlock('core/template')->setTemplate('mobilebanners/index.phtml')->toHtml();

?>

Ratings and Reviews count in magento

<?php
$storeId = Mage::app()->getStore()->getId();
$reviewSummaryData = Mage::getModel('review/review_summary')
->setStoreId($storeId)
->load($_product->getId());
$reviewUrl=Mage::getUrl('review/product/list', array('id'=> $_product->getId()));
?>
<div class="ratings">
<div class="rating-box">
<div class="rating" style="width:<?php echo $reviewSummaryData['rating_summary'] ?>%">
</div>
<?php //echo $reviewSummaryData['reviews_count'];?>
</div>
<span class="amount"> <?php echo $this->__('%d Review(s)', $reviewSummaryData->getReviewsCount()) ?></span>
</div>

Thursday, October 15, 2015

get Product URL by Id

$product_id = 85;
$_product = Mage::getModel('catalog/product')->load($product_id);
$product_url = $_product->getProductUrl();

Redirect to CMS page from phtml file

<?php echo $this->getUrl('privacy-policy'); ?>
privacy-policy is the url-key of your cms page

or
<?php echo Mage::helper('cms/page')->getPageUrl('url_key') ?>


Redirect to Category listing Page

<?php
$category = Mage::getModel('catalog/category')->load(3);
echo $category->getUrl();
?>

Fatal error: Class Zend\Stdlib\Parameters contains 1 abstract method... magento 2

Fatal error: Class Zend\Stdlib\Parameters contains 1 abstract method and must therefore be declared abstract or implement the remaining met...