Magento 1.4.1 类别过滤器
我必须根据 ajax 请求显示添加到特定类别的产品列表。因此,当我尝试使用类别过滤方法时,它显示致命错误。使用magento 1.4.1
致命错误:未捕获的异常 带有消息的“PDOException” 'SQLSTATE[42S22]:未找到列: 1054 未知列 'e.category_ids' 在“where 子句”中 /var/www/html/wc2/lib/Zend/Db/Statement/Pdo.php:228 堆栈跟踪:
#0 /var/www/html/wc2/lib/Zend/Db/Statement/Pdo.php(228): PDO语句->执行(数组)
#1 /var/www/html/wc2/lib/Zend/Db/Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array)
#2 /var/www/html/wc2/lib/Zend/Db/Adapter/Abstract.php(468): Zend_Db_Statement->执行(数组)> #3 /var/www/html/wc2/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT 计数(DI...',数组)
#4 /var/www/html/wc2/lib/Varien/Db/Adapter/Pdo/Mysql.php(333): Zend_Db_Adapter_Pdo_Abstract->query('SELECT 计数(DI...',数组)
#5 /var/www/html/wc2/lib/Zend/Db/Adapter/Abstract.php(799): Varien_Db_Adapter_Pdo_Mysql->查询('SELECT 计数(DI...',数组)
#6 /var/www/html/wc2/lib/Varien/Data/Collection/Db.php(210): Zend_Db_Adapter_Abstract->fetchOne('SELECT count(DI...', Array)
#7 /var/www/html/wc2/lib/Varien/Data/Collec 在 /var/www/html/wc2/lib/Zend/Db/Statement/Pdo.php 在第 234 行
这是我在 ajax 文件上添加的代码,
$_productCollection = Mage::getModel('catalog/product')->getCollection()
->addPriceData()
->addAttributeToSort('name', 'ASC')
->addAttributeToFilter('category_ids',array('finset'=>'604'))
->addCategoryFilter('category_id','604')
->setPageSize($limit)
->setPage($p, $limit)
->addAttributeToSelect('*');
$_productCollection = Mage::getResourceModel('reports/product_collection')
->addAttributeToSelect('*')
->setPageSize($limit)
->setPage($p, $limit)
->addAttributeToFilter('category_ids',array('finset'=>'66,67'));
foreach ($_productCollection as $_product):
echo $_product->getId();
endforeach;
它们都不起作用。他们都显示相同的错误。请有人帮助我。 谢谢
I have to show the list of products added to a particular category on ajax request. So when i tried to use category filter method it shows fatal error. Using magento 1.4.1
Fatal error: Uncaught exception
'PDOException' with message
'SQLSTATE[42S22]: Column not found:
1054 Unknown column 'e.category_ids'
in 'where clause'' in
/var/www/html/wc2/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0
/var/www/html/wc2/lib/Zend/Db/Statement/Pdo.php(228):
PDOStatement->execute(Array)
#1
/var/www/html/wc2/lib/Zend/Db/Statement.php(300):
Zend_Db_Statement_Pdo->_execute(Array)
#2
/var/www/html/wc2/lib/Zend/Db/Adapter/Abstract.php(468):
Zend_Db_Statement->execute(Array) >
#3
/var/www/html/wc2/lib/Zend/Db/Adapter/Pdo/Abstract.php(238):
Zend_Db_Adapter_Abstract->query('SELECT
count(DI...', Array)
#4
/var/www/html/wc2/lib/Varien/Db/Adapter/Pdo/Mysql.php(333):
Zend_Db_Adapter_Pdo_Abstract->query('SELECT
count(DI...', Array)
#5
/var/www/html/wc2/lib/Zend/Db/Adapter/Abstract.php(799):
Varien_Db_Adapter_Pdo_Mysql->query('SELECT
count(DI...', Array)
#6
/var/www/html/wc2/lib/Varien/Data/Collection/Db.php(210):
Zend_Db_Adapter_Abstract->fetchOne('SELECT count(DI...', Array)
#7
/var/www/html/wc2/lib/Varien/Data/Collec
in
/var/www/html/wc2/lib/Zend/Db/Statement/Pdo.php
on line 234
This is the code i added on ajax file
$_productCollection = Mage::getModel('catalog/product')->getCollection()
->addPriceData()
->addAttributeToSort('name', 'ASC')
->addAttributeToFilter('category_ids',array('finset'=>'604'))
->addCategoryFilter('category_id','604')
->setPageSize($limit)
->setPage($p, $limit)
->addAttributeToSelect('*');
$_productCollection = Mage::getResourceModel('reports/product_collection')
->addAttributeToSelect('*')
->setPageSize($limit)
->setPage($p, $limit)
->addAttributeToFilter('category_ids',array('finset'=>'66,67'));
foreach ($_productCollection as $_product):
echo $_product->getId();
endforeach;
Neither of them working. Both of them showing same error. Please someone help me out.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个过滤器应该可以工作。
This filter should work.