没有从畅销书获得magento图像网址

时间:2014-10-09 11:28:46

标签: magento

我为magento中的畅销产品编写了一些代码但是

我没有获得产品图片网址....

我需要画廊的小图片..

我正在开发畅销书滑块.....整件事情很好

但只是我没有得到图片网址...

我的代码

$current_category = Mage::registry('current_category');
        $is_category_filter = Mage::getStoreConfig('productslider/product_setting/category_filter');
        $collection = Mage::getResourceModel('reports/product_collection')
                            ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
                            ->addOrderedQty()
                            ->addMinimalPrice()
                            ->addTaxPercents()
                            ->addStoreFilter(); 
        Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
        Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
        if($current_category && $is_category_filter == '1'){
            $current_category_id = Mage::registry('current_category')->getId();
            $currentCategory = Mage::getModel('catalog/category')->load($current_category_id);
            $collection->addCategoryFilter($currentCategory);
        }
        $collection->setPageSize(30);

        $this->setProductCollection($collection);








return $collection;

1 个答案:

答案 0 :(得分:0)

<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(160, 225) ?>" width="160" height="225" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" /></a>