Attribute is not able to be selected
-
16-10-2019 - |
Question
I am trying to use newsletter promotion extension provided at GIT
https://gist.github.com/drewgillson/3009236
Ref for creating promotion condition: http://marius-strajeru.blogspot.ca/2010/04/create-bulk-discount-rules.html
Here I am trying following code for condition
$conditions['1--2'] = Array
(
'type' => 'salesrule/rule_condition_product_found',
'value' => 0,
'aggregator' => 'all',
'new_child' => '',
);
$conditions['1--2--1'] = Array
(
'type' => 'salesrule/rule_condition_product',
'attribute' => 'special_price',
'operator' => '<',
'value' => '0',
);
Above code is not working if I try valid attribute code ( second condition ) like 'special_price', 'sku' or 'price'
But if I misspell attribute then it generate promotion rule only attribute is missing from it.
I don't know why attribute is not selected except everything else....
Solution
I tried the code from the 'gist' you posted, with your conditions with a minor change. Instead of
$rule->setWebsiteIds(1);
I used
$rule->setWebsiteIds(array(1));
And it worked perfectly.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange