Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email

Magento Forum

Bug report (couldn’t post into normal bug report)
Jr. Member
Total Posts:  8
Joined:  2007-11-13


We found a warning upon creating a product with our own attribute set. We are not sure EXACTLY why this happened to us, but I’ve managed to make a fix for it.

The stacktrace is following:

NoticeUndefined variableconditionSql in /www/ on line 339
[0] in Mage_Eav_Model_Entity_Collection_Abstract
->addAttributeToFilter(534Array[1]in /www/ on line 78
[1] in Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Config_Grid
->_prepareCollection() in /www/ on line 358
[2] in Mage_Adminhtml_Block_Widget_Grid
->_prepareGrid() in /www/ on line 364
[3] in Mage_Adminhtml_Block_Widget_Grid
->_beforeToHtml() in /www/ on line 180
[4] in Mage_Core_Block_Template
->toHtml() in /www/ on line 439
[5] in Mage_Core_Block_Abstract
->_getChildHtml("grid"1in /www/ on line 417
[6] in Mage_Core_Block_Abstract
->getChildHtml("grid"in /www/ on line 65
[7] in Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Config
->getGridHtml() in /www/ on line 59
[8] in 
include("/www/"in /www/ on line 116
[9] in Mage_Core_Block_Template
->fetchView("adminhtml/default/default/template/catalog/product/edit/super/config.phtml"in /www/ on line 143
[10] in Mage_Core_Block_Template
->renderView() in /www/ on line 188


I think it has to do with our configuration in some sort, because it only appears on our production machine. Nevertheless, the warning suggests that the variable conditionSql is nonexistent, which in turn has a MYSQL syntax error (some empty AND () is generated). Anyhow, the code who needed the fix is the following:

Around line 308 in app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php:

     * Add attribute filter to collection
     * If $attribute is an array will add OR condition with following format:
     * array(
     *     array('attribute'=>'firstname', 'like'=>'test%'),
     *     array('attribute'=>'lastname', 'like'=>'test%'),
     * )
     * @see self::_getConditionSql for $condition
     * @param string|array $attribute
     * @param null|string|array $condition
     * @param string $operator
     * @return Mage_Eav_Model_Entity_Collection_Abstract
    public function addAttributeToFilter($attribute$condition=null)
if (is_array($attribute)) {
= array();
            foreach (
$attribute as $condition{
'('.join(') OR ('$sqlArr).')';
elseif (is_string($attribute)) {
if (is_null($condition)) {
throw Mage::exception('Mage_Eav'__('Invalid condition'));

I don’t know why, but on our production machine an int, namely 552, is injected as $attribute. And since it is not NULL, an array nor is it a string, the conditionSql is never set.

Thus the line “$this->getSelect()->where($conditionSql)” generates that warning.

I inserted the following lines of code and viola it did help:


// Fix by W.G.P. 
elseif(!is_array($attribute) && !is_string($attribute) && is_numeric($attribute) && is_int($attribute))

if (is_array($attribute)) 


Just a simple cast which is not needed on any of our other machines ??? confused

I have not made any deeper research and since it seems to fix our error I thought I would share it. Any feedback is appreciated

Magento Community Magento Community
Magento Community
Magento Community
Magento Team
Total Posts:  1770
Joined:  2007-08-07
Los Angeles

Thanks for the report smile

There’s another solution posted in this thread:

Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top