Marco Dinse
Marco Dinse

Reputation: 1

Magento: can't use attribute weight in actions condition for shopping cart price rule

The attribute 'weight' is set to 'yes' for "Use for Promo Rule Conditions". And I can use "Total Weight" in the condition area. So it is taken for the whole cart. But I want to use it for action conditions (tab "Action"). All attributes, which can used for promo rules appear under the section "Product Attribute". Weight is not there. I also want the "weight" of some products for action condition.

(I use Magento 1.8.1.0)

Upvotes: 0

Views: 1268

Answers (2)

Goku
Goku

Reputation: 176

Late here but if anyone has this question again, the reason why weight can't be setup in Shoppin Cart Price Rule is that by default the option for "Use for Promo Rule Conditions" is set to NO if you were to change that then weight will show up as an option

Upvotes: -1

Marius
Marius

Reputation: 15216

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.

Upvotes: 2

Related Questions