Magento Display Cross-Selling products on product detail page

Some time we need to display cross sell products on product page, you can use the code below to display cross sell products. [php] <?php if($_crossSellProducts = $_product->getCrossSellProducts()): ?> <div class="topproducts_containter"> <div class="topsellerTitle">TOP <?php echo strtoupper(Mage::getModel(‘catalog/layer’)->getCurrentCategory()->getName()); ?> PRODUCTS</div> <?php foreach ($_crossSellProducts as $_item): ?> <?php $_item = Mage::getModel(‘catalog/product’)->load($_item->getId()); ?> <div ...

Read More

Manipulate collections of products in Magento

Retrieve a collection of products [php] $Products = Mage :: getResourceModel (‘catalog/product_collection’); / * Or * / $Products = Mage :: getModel (‘catalog/product’)->GetCollection(); [/php] Selecting a specific attribute [php] $Products = Mage::getResourceModel(‘catalog/product_collection’) ->AddAttributeToSelect(‘name’) ->AddAttributeToSelect(‘weight’); [/php] Selecting all attributes [php] $Products = Mage::getResourceModel (‘catalog / product_collection’) -> AddAttributeToSelect (‘*’); [/php] Filters ...

Read More

To DO Before Using Magento Extension

Start point is config.xml file, for example /app/code/local/Companyname/Extensionname/etc/config.xml file. Then next step will be analyzing files. There will be 3 aspect of checking it. REWRITES Check model/class/controller. EVENT observes CRON job Rewrites => you should at least take a look into every defined model/class/controller rewrite within your config.xml file. however ...

Read More

Display Cart Summary and GrandTotal In Magento

Sometime we need to display cart quantity and grand total on our website with the code below we can easily display cart summary and cart grand total anywhere on site. [php] <?php $QtyCount = $this->helper(‘checkout/cart’)->getSummaryCount(); $CartTotal = $this->helper(‘checkout/cart’)->getQuote()->getGrandTotal(); if($QtyCount==0) { echo $this->__(‘Items: %s’,$QtyCount); } if($QtyCount==1) { echo $this->__(‘ Item: %s’,$QtyCount); ...

Read More