How to integrate the terms and conditions of the basket rule block in the magento user module

I am trying to integrate a block of shopping cart rule conditions (Promo) in a custom module (admin side). while I can show the condition block and also set the conditions (in the user side of the module), but I can’t save in the desired format in my module. it saves only "If ALL of these conditions are TRUE:" the part (after serialization) is not the other (condition index). I tried to serialize the whole $data['condition']in the model _beforeSave, but this is also not saved in the required format.

(I did not redefine anything, but only extended the classes for the model. my Model class for the custom module is distributed using Mage_Rule_Model_Abstract.)

I'm just trying to use the magento shopping cart rule system (especially the condition block) for a custom module. Advise me how to achieve this?

Thanks to everyone.

+1
source share
1 answer

Alhamdulillah

I solved this after a bit more dives, I found that $model->setData($data)I need to use instead $model->loadPost($data); //Mage_Rule_Model_Abstract, which will be $this->_convertFlatToRecursive($data);//Mage_Rule_Model_Abstract, and then check the index of conditions in the data array, after which the data will be in the desired format for saving, and then for loading, to correctly display the saved rules in the block of conditions.

I will write the whole process, perhaps a small module in some blog. Hope this helps someone.

+2
source

All Articles