Krt_Malta Krt_Malta - 1 year ago 132
PHP Question

Read promotion rule condition - Magento

I need to read the condition of a shopping cart price rule in magento programatically.

has a method
which does provide the conditions but in a cryptic manner to say the least such as the following:


Does anyone know how to read the condition in a more humane way plz? I'd like to be able to read certain attributes.

Thanks a bunch!


Answer Source

You can use php's unserialize function to convert this to a workable array.

Try this:

$conditions = unserialize($rule->getConditionsSerialized());

I've blogged before about how these work, and while my post is about creating rules, it still explains a bit about how you might come to understand conditions.

Here's my post

Hope it helps!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download