2

I want to create a price rule for a shopping cart that only to be activated when there are certain SKU placed in the cart.

For example. only if these 4 products sku1, sku2, sku3, sku4 existed in the shopping cart at the same time, then a customer could have a fix amount discount for 100 USD for the whole cart.

Is this possible in Magento?

1
  • Thanks for accepting the answer, but can you please upvote too? ATM only the wrong answer has upvoted what may be misleading.
    – sv3n
    Apr 24, 2018 at 18:35

2 Answers 2

0

This is a bug in Magento core, that was fixed in version 1.9.3. If using an older version, you can try this fix: https://github.com/biotech/Magento1.9-CatalogPriceRulesFix or try this solution:

public function prepareConditionSql()
{
    $alias     = 'cpf';
    $attribute = $this->getAttribute();
    $value     = $this->getValue();
    $operator  = $this->correctOperator($this->getOperator(), $this->getInputType());
      if ($attribute == 'category_ids') {
        $alias     = 'ccp';
        $attribute = 'category_id';
        $value     = $this->bindArrayOfIds($value);
    }

    // Andre Klang: This fixes issue with "is one of" & "is not one of"
    if(!is_array($value) && in_array($operator,array('()','!()'))) {
        $tmp = explode(',',$value);
        foreach($tmp as $trim) $values[] = trim($trim); 
        $value = $values;
    }

    /** @var $ruleResource Mage_Rule_Model_Resource_Rule_Condition_SqlBuilder */
    $ruleResource = $this->getRuleResourceHelper();

    return $ruleResource->getOperatorCondition($alias . '.' . $attribute, $operator, $value);
}

Source: Catalog Price Rule containing several SKU-s doesn't work


Edit: To get a fast solution you can try this, as posted in the linked question:

ANY condition is TRUE
  SKU "is one of" sku1
  SKU "is one of" sku2
1

I haven't tried it but this should work enter image description here

2
  • thanks, but I have exactly tried this setup before I posted the question. It's not working for me. I have made sure the price rule is active in the admin. Jun 2, 2017 at 8:45
  • I can't make it work for me either (CE1.9.2.2). Feels like it needs the sku selector on the conditions not the actions but you can't do that :(
    – jscar
    Jun 2, 2017 at 9:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.