1
我有一点困难。以下代码正确显示分配的产品,同时忽略最低价格。 “低至”选项。Magento帮助 - >有困难过滤新产品
<?php
$cat_id = 123; // category id
$category = Mage::getModel('catalog/category')->load($cat_id);
$todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
$_products = $category->
getProductCollection()->
addCategoryFilter($category)->
addAttributeToFilter('news_from_date', array('date' => true, 'to' => $todayDate))->
addAttributeToFilter('news_to_date', array('or'=> array(
0 => array('date' => true, 'from' => $todayDate),
1 => array('is' => new Zend_Db_Expr('null')))
), 'left')->
addAttributeToSelect('*');
if (($this->getProductCollection()) && $_products->getSize()): ?>
最后一行的小调整,正确显示“低至”价格,但最终在所述类别内添加未分配的产品。
if (($_products = $this->getProductCollection()) && $_products->getSize()): ?>
我错过了什么?谢谢