0

Am trying to do special offers to my magento shop.Actually that is easy but actually my scenario is differs from others.My scenario is,I must get the products based on custom attribute(date of sale) and as well as product qty must be greater than zero(Qty>0).I got the products using custom attribute like,

     <?php
      $collection = Mage::getResourceModel('catalogsearch/advanced_collection')
        ->addAttributeToSelect(Mage::getSingleton('catalog/config')- >getProductAttributes())
        ->addMinimalPrice()
        ->addStoreFilter();


    Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
    Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
    $collection->addAttributeToFilter('date_sale', array('lt' => $todayDate));
     return $collection;?>

On this i got the products based on date of sale is lesser than today date.On that itself i must get products which qty is greater than 0.

give me some hopes guys?

4

1 回答 1

0

过滤后使用另一个 addAttributeToFiler('库存数量属性码',array('gt' => 0));

这充当 AND 过滤器

您可以在此处检查 'and' 和 'or' 过滤器OR 和 AND STATEMENT addAttributeToFilter magento asnd 根据需要使用。

于 2013-09-19T10:55:33.947 回答