最新回答
- 2019-12-51 #
- 2019-12-52 #
$sAttributeName = 'brand'; $mOptionValue = 'Sony'; $collection = Mage::getModel('catalog/product')->getCollection() ->addAttributeToSelect('*') ->addFieldToFilter( $sAttributeName, array( 'eq' => Mage::getResourceModel('catalog/product') ->getAttribute($sAttributeName) ->getSource() ->getOptionId($mOptionValue) ) );
现在你应该拥有
$collection
中所有活跃和可见的产品 变量