简体   繁体   中英

How to integrate Conditions Block of Shopping Cart Rules in Custom module magento?

i am trying to integrate shopping cart rules (Promo) conditions block in custom module (admin side). so far i am able to show conditions block and also can set conditions (in custom module admin side) but can't save in desired format in my module. it only saves the " If ALL of these conditions are TRUE :" part (after serializing) not the other one (conditions index). i have tried to serialize the whole $data['condition'] in model's _beforeSave but this doesn't save in required format either.

(i haven't override anything yet only extended the classes for model. my Model class for custom module extends with Mage_Rule_Model_Abstract .)

I am just trying to utilize the magento system of shopping cart rules (particularly Conditions block) for custom module. guide me how to achieve that?

Thank you all.

Alhamdulillah,

i have solved this after a little more diving i found that instead of $model->setData($data) i have to use $model->loadPost($data); //Mage_Rule_Model_Abstract $model->loadPost($data); //Mage_Rule_Model_Abstract which will $this->_convertFlatToRecursive($data);//Mage_Rule_Model_Abstract then check the 'conditions' index in data array and after that the data will be in desired format to save and later to be loaded to show saved rules properly in conditions block.

i will write the whole process perhaps a small module in some blog. Hopefully it would help someone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM