Sunday, October 7, 2012

How can i use this code in magento

this is magento em product label code please explain me how can i use this

<?php
    $object = $this->getObject();
    $labels = $object['labels'];
  
    $product = $object['product'];
    $processor = Mage::getModel('productlabels/filter');
    $objectFilter = new Varien_Object();
  
    $objectFilter->setData('product',$product);
    //print_r($processor);exit;
    //echo $processor->filter($object);
   
   
    //echo $background;exit;
    //echo $label->getTexthtml();
    //echo $product->getName().'label';

?>
<ul class="productlabels_icons">
    <?php foreach($labels as $label):?>
    <?php
    $background = $label->getBackground();
    if ($background && $background != 'nopic')
    {
        $src = Mage::getBaseUrl("media").'em_productlabels'.'/'.'background'.'/'.$background;
        $style = "style='background:url(\"$src\") no-repeat scroll 0 0 transparent'";
    }
    else $style = '';
    ?>
    <li class="label <?php $label->getCssClass() ?>" <?php echo $style;?>>
        <?php $image = $label->getImage();?>
        <?php if($image && $image != 'nopic'):?>
        <img src="<?php echo Mage::getBaseUrl("media").'em_productlabels'.'/'.'image'.'/'.$image;?>"/>
        <?php endif;?>
        <p>
            <?php $objectFilter->setData('text',$label->getTexthtml());?>
            <?php echo $processor->filter($objectFilter);?>
        </p>
    </li>
    <?php endforeach;?>
</ul>

No comments:

Post a Comment