我正在尝试获取Magento中某个价格范围的产品。我尝试了我能想到的前两种逻辑方式。第一个是将两个addAttributeToFilter()语句添加到我的代码中。将两个条件应用于Magento集合中的singel属性
$products->addAttributeToFilter('price', array('gteq' => $r['price_low']));
$products->addAttributeToFilter('price', array('lteq' => $r['price_high']));
没有骰子。这只是给了我第二个。
然后我决定尝试添加了两个条件句,以单addAttributeToFilter()这样的:
$price_array['gteq'] = $r['price_low'];
$price_array['lteq'] = $r['price_high'];
$products->addAttributeToFilter('price', $price_array);
同样只是高端。我在我的集合上做了一个getSelect(),并在查询中确认它只应用高端。
有谁知道我怎么能得到有价格范围的产品。