1

I would like to use a rule involving shipping weight. I have set Use for Promo Rule Conditions to yes. It does not show up. Any other attribute works fine.

After some research I found this- https://stackoverflow.com/questions/22172746/magento-cant-use-attribute-weight-in-actions-condition-for-shopping-cart-price

"I don't know if this is a bug or a feature, but it seams like you cannot use the weight attribute for the rule conditions and actions. When checking if an attribute is valid for rules this method is called

Mage_Catalog_Model_Resource_Eav_Attribute::isAllowedForRuleCondition

public function isAllowedForRuleCondition()
{
$allowedInputTypes = array('text', 'multiselect', 'textarea', 'date',     'datetime', 'select', 'boolean', 'price');
return $this->getIsVisible() && in_array($this->getFrontendInput(), $allowedInputTypes);
}

This seams reasonable. Now the strange part. The weight attribute has the frontend input weight. You can see this by running this query on the db.

SELECT * FROM eav_attribute where attribute_code = 'weight'. 

Changing the frontend_input to text makes the attribute available in promo rules. But I can't tell you if this is a good idea or not."

Has anyone tried this? I hate modifying any core files. The strange part is others that have text field selected, work just fine. It is just weight I have the issue with.

0

If you look at the front end properties of weight it will show as text. That is wrong. It is actually weight. If you take this code-

Mage_Catalog_Model_Resource_Eav_Attribute::isAllowedForRuleCondition

public function isAllowedForRuleCondition()
{
$allowedInputTypes = array('text', 'multiselect', 'textarea', 'date',     'datetime', 'select', 'boolean', 'price');
return $this->getIsVisible() && in_array($this->getFrontendInput(), $allowedInputTypes);
}

And add weight so it looks like this-

   $allowedInputTypes = array('text', 'multiselect', 'textarea', 'date','datetime', 'select', 'boolean', 'price','weight');

If you add 'weight' to the end it will now show up properly.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.