【发布时间】:2012-12-13 20:18:27
【问题描述】:
根据网上几篇帖子(http://www.magentocommerce.com/boards/viewthread/178767/ 和http://marius-strajeru.blogspot.co.uk/2010/04/create-bulk-discount-rules.html)中的信息,我将一些代码放在一起生成一些优惠券代码。
我坚持的一点是如何编写代码来指定优惠券使用的“动作”特定条件。这将在 Magento 管理系统中“操作”选项卡的“仅将规则应用于符合以下条件的购物车项目”部分中指定。
在 Magento 管理系统中,我将构建以下行:
类别不是 10,20,30 之一
我需要知道的是如何在代码中复制它。 我目前有以下内容,但似乎无法正常工作 - 至少,当我检查生成的优惠券代码时,我需要的操作值丢失了。
$actions = array();
$actions[1] = array(
'type' => 'salesrule/rule_condition_category',
'aggregator' => 'all',
'value' => 1,
'new_child' => ''
);
$actions['1--1'] = array(
'type' => 'salesrule/rule_condition_category',
'attribute' => 'category_ids',
'operator' => '!()',
'value' => '932,341,800',
'is_value_processed' => 0,
);
$model->setData('actions',$actions);
我假设代码完全是错误的,尽管不会导致系统崩溃。 我如何才能达到我的需要?
【问题讨论】:
标签: magento