मैंने _getProductCollection() कक्षा की विधि में एक फ़िल्टर Mage_Catalog_Block_Product_List इस प्रकार जोड़ा है।
protected function _getProductCollection()
{
...
$this->_productCollection = $layer->getProductCollection();
$this->_productCollection->getSelect()->joinInner(
array('cpe' => 'catalog_product_entity'),
'e.entity_id = cpe.entity_id'
)
->where("cpe.type_id = 'simple'");
...
}
उपरोक्त कोड Magento संस्करण 1.7 के रूप में ठीक काम कर रहा है। लेकिन जब भी मैं निम्नलिखित कोड लिखता हूं, यह देता है
कॉलम नहीं मिला: 1054 अज्ञात कॉलम 'e.type_id' में 'जहाँ खंड'
त्रुटि।
कोड (जो काम नहीं कर रहा है)।
protected function _getProductCollection()
{
...
$this->_productCollection = $layer->getProductCollection();
$this->_productCollection
->addAttributeToSelect('type_id')
->addAttributeToFilter('type_id','simple');
...
}
अब प्रश्न ।
- यदि मैं पहले काम करने वाले कोड का उपयोग करता हूं तो क्या कोई प्रदर्शन प्रभाव पड़ेगा?
- क्या कोई अन्य तरीका है जिससे उचित उत्पाद फ़िल्टर हो सके?
अपडेट करें:
जब भी मैं निम्नलिखित कोड लागू करता हूं और rwdथीम का उपयोग करता हूं, तो मुझे कोई त्रुटि नहीं मिल रही है। लेकिन जब भी मैं यूजर defaultथीम देता हूं, मुझे नीचे की त्रुटि मिलती है,
कोड
protected function _getProductCollection()
{
...
$this->_productCollection = $layer->getProductCollection();
$this->_productCollection
->addAttributeToSelect('type_id')
->addAttributeToFilter('type_id','simple');
...
}
त्रुटि
SQLSTATE [42S22]: कॉलम नहीं मिला: 1054 अज्ञात स्तंभ 'e.type_id' में 'जहां खंड', क्वेरी था: चयन मंजिल ((ROUND ((e.min_price) * 1, 2)) / 10) + 1 के रूप में
range, COUNT (*) के रूप मेंcountसेcatalog_product_index_priceके रूप मेंeअंदरूनी शामिल होंcatalog_category_product_indexके रूप मेंcat_indexपर cat_index.product_id = e.entity_id और cat_index.store_id = 1 और cat_index.visibility (2, 4) और cat_index.category_id = '3' कहां (e।type_idमें ( 'सरल' )) और (e.website_id = '1') और (e.customer_group_id = 0) और (e.min_price IS NULL) ग्रुप द्वारा FLOOR ((ROUND (e.min.price) * 1, 2) / 10) + 1 कक्षा द्वारा फर्श ((ध्वनि (e.min_price) * 1, 2)) / 10) + 1 ASC