Posts Tagged ‘sysadmin’

get product thumb images on view.phtml <?php $_images = Mage::getModel(‘catalog/product’)->load($_product->getId())->getMediaGalleryImages(); ?> <?php if($_images){?> <?php $i=0; foreach($_images as $_image){ $i++; ?> <a href=”#” onclick=”ig_lightbox_show(-1)”> <img src=”<?php echo $this->helper(‘catalog/image’)->init($_product, ‘thumbnail’, $_image->getFile())->resize(108,90); ?>” alt=”<?php echo $this->htmlEscape($_image->getLabel());?>” title=”<?php $this->htmlEscape($_image->getLabel());?>” /> </a><?php } ?> <?php } ?>

get custom option name filter.phtml if you want to add custom option in your layered navigation in magneto then here is the solution for that. <?php echo $_item->getName() ?>

magento – call a static block in a page for display a static block in a page <?php echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘blockname’)->toHtml() ?>

Magento: How to get product rating and review code for getting ratings and reviews for any particular product. /* Getting reviews collection object */ $productId = $product->getId(); $reviews = Mage::getModel(‘review/review’) ->getResourceCollection() ->addStoreFilter(Mage::app()->getStore()->getId()) ->addEntityFilter(‘product’, $productId) ->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED) ->setDateOrder() ->addRateVotes(); /** * Getting average of ratings/reviews */ $avg = 0; $ratings = array(); if (count($reviews) > 0) { […]

get attribute of xml in php

Posted: 19th June 2012 by urfusion in php
Tags: , , , , , ,

get attribute of xml in php this is the attribute structure of xml [ForecastDay0] => SimpleXMLElement Object ( [@attributes] => Array ( [FDay] => 0 [Date] => 2008-11-11T00:00:01.930 [Name] => Tuesday ) And this is the code to retrieve attribute foreach($xml->Forecasts->$weather->attributes() as $a => $b) { $FDay = $b; } echo “$FDay”;