脚本宝典收集整理的这篇文章主要介绍了php – 在Magento自动创建购物车价格规则,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
在某处运行以下代码来查看salesrule /规则模型的外观.这假设您在管理员中创建了一个ID为1的单个购物车价格规则
$coupon = Mage::getModel('salesrule/rule')->load(1); var_dump($coupon->getData());
使用转储数据作为指导,我们可以使用以下方式编程创建模型
$coupon = Mage::getModel('salesrule/rule'); $coupon->setName('test coupon') ->setDescription('this is a description') ->setFromDate('2010-05-09') ->setCouponCode('CODENAME') ->setUsesPErCoupon(1) ->setUsesPerCustomer(1) ->setCustomerGroupIds(array(1)) //an array of customer grou pids ->setIsActive(1) //serialized condITions. the following examples are empty ->setConditionsSerialized('a:6:{s:4:"type";s:32:"salesrule/rule_condition_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_PRocessed";N;s:10:"aggregator";s:3:"all";}') ->setActionsSerialized('a:6:{s:4:"type";s:40:"salesrule/rule_condition_product_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";}') ->setStopRulesProcessing(0) ->setIsAdvanced(1) ->setProductIds('') ->setSortOrder(0) ->setSimpleAction('by_percent') ->setDiscountAmount(10) ->setDiscountQty(null) ->setDiscountStep('0') ->setSimpleFreeShipping('0') ->setApplyToShipping('0') ->setIsRSS(0) ->setWebsiteids(array(1)); $coupon->save();
以上是脚本宝典为你收集整理的php – 在Magento自动创建购物车价格规则全部内容,希望文章能够帮你解决php – 在Magento自动创建购物车价格规则所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。