Magento Themes and Magento Extensions

Display total weight of cart in the magento

Share
Posted on April 13th, 2013 | Posted by admin

Display total weight of cart in the magento

$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();

$weight = 0;
foreach($items as $item) {
    $weight += ($item->getWeight() * $item->getQty()) ;
}

echo $weight;

Magento: Display a product image within Static Pages and Blocks

Share
Posted on March 16th, 2013 | Posted by admin

Magento: Display a product image within Static Pages and Blocks

In this particular instance I needed to add product thumbnails for reference on a front page.

First create a new .phtml file with the following under catalog/product/view/your_new_page.phtml

1 <?php
2 $productId = $this->getProduct_id();
3 $_product = Mage::getModel('catalog/product')->load($productId);//load the product
4 ?>
5 <img src="<? echo Mage::helper('catalog/image')->init($_product, 'thumbnail')->resize(75, 75); ?>" alt="<?php echo $this->htmlEscape($_product['name']); ?>" border="0" width="75" />

Magento: Display a product image within Static Pages and Blocks

Share
Posted on March 16th, 2013 | Posted by admin

Magento: Display a product image within Static Pages and Blocks
In this particular instance I needed to add product thumbnails for reference on a front page.

First create a new .phtml file with the following under catalog/product/view/your_new_page.phtml

1 <?php
2 $productId = $this->getProduct_id();
3 $_product = Mage::getModel('catalog/product')->load($productId);//load the product
4 ?>
5 <img src="<? echo Mage::helper('catalog/image')->init($_product, 'thumbnail')->resize(75, 75); ?>" alt="<?php echo $this->htmlEscape($_product['name']); ?>" border="0" width="75" />

Display Parent category and subcategories of current parent in Magento

Share
Posted on January 13th, 2013 | Posted by admin

Display Parent category and subcategories of current parent in Magento
This also takes into consideration where you are in the system. For example if you are in a subcategory, then parent category of the subcategory will be displayed. However, if you are in a subcategory of DEFAULT CATEGORY, then the code checks for this and displays your current category.

We placed the following code into our template sidebar

<?php
$currentCat = Mage::registry('current_category');

//if Rootcategory display current category only
//this gets around the problem of displaying DEFAULT CATEGORY
if ( $currentCat->getParentId() == Mage::app()->getStore()->getRootCategoryId() )

//Display current category
echo $this->getCurrentCategory()->getName() ;

else

How to display additional attributes in layered navigation in magento

Share
Posted on November 24th, 2012 | Posted by admin

How to display additional attributes in layered navigation in magento

This is the simple way to display additional attributes of products in layered navigation which helps to filter product easily.

Following are the steps to dislay additional attributes in layered navigation.

1) To add new attribute which you want to display in layered navigation

Go to catalog>attribute>manage attribute
click on add new attribute
now you can create attribute as your required name.But some fields are required as

Catalog Input Type for Store Owner => Dropdown
Use In Layered Navigation => Filterable (with results)

Page 1 of 212»