Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/245.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Magento中使用自定义属性检索多个产品的问题_Magento - Fatal编程技术网

在Magento中使用自定义属性检索多个产品的问题

在Magento中使用自定义属性检索多个产品的问题,magento,Magento,我的代码有问题。我创建了一个名为product_type的自定义属性,作为单个值,并将该值用于过滤产品 $productType = $_GET['type']; $_helper = $this->helper('catalog/output'); $_productCollection = Mage::getModel('catalog/product')->getCollection(); $_productCollection->addAttributeToFilter

我的代码有问题。我创建了一个名为product_type的自定义属性,作为单个值,并将该值用于过滤产品

$productType = $_GET['type'];
$_helper = $this->helper('catalog/output');
$_productCollection = Mage::getModel('catalog/product')->getCollection();
$_productCollection->addAttributeToFilter("product_type", array('eq' => $productType));
后来,我更改了允许多个选择的属性。我的意思是,在属性行为改变之前,一个产品只有一个产品类型,现在一个产品可以有多个产品类型

我确信代码可以继续工作,但事实并非如此


有什么帮助吗?谢谢你

具体来说,它是如何不起作用的?你能给出一个产品的价值观吗?你想做什么,你做不到,它做什么呢?我有两个产品product1和product_类型1和product_类型2,product2和product_类型1。当我按产品类型1进行筛选时,只显示产品2。