4

After applying Catalog Price Rule, price did not change even though the schedule changes already started. But I can see the price change in preview mode only. checked in Magento 2.1.4 too Why ?

4

Check in your Catalog Price Rule form is_active field is there, but it's hidden.

2

As per my observation in Magento2.X version's content staging functionality is overriding the visible feature of the status of the catalog rule. For the time being I was updated the below line (18th line) in the Magento 2.1.X version vendor/magento/module-catalog-rule-staging/view/adminhtml/ui_component/catalog_rule_form.xml file.

File Update

For Magento 2.3 version File Update

Flush the cache once update the codes. It works for me.

1

I had a similar issue on 2.2.7 so hopefully this will help someone else. The above answers are correct: you should make sure that the rule is active (in EE they want you to use the staging mechanism so you have to actually create the rule and then schedule a change where you will see the active/inactive switch as well as make sure that you indexer is running)

However, if you have tried these answers and it is still not working and you have used a multiselect comparison operator such as "is one of" (ie: Sku "is one of" 123, 456, 789 etc) than you need to ensure that your comma delimited value does not contain spaces (ie instead of Sku "is one of" 123, 456, 789 it needs to be 123,456,789 (with the spaces removed)).

Basically in

vendor\module-catalog-rule\Model\Rule\Condition\Product.php 

around line 123 the _prepareMultiselectValue function does an explode by commas which (in my case) the skus where doing a comparison with the extra space and things where not working as intended.

    /**
 * Prepare multiselect attribute value
 *
 * @param mixed $value
 * @param \Magento\Catalog\Model\Product|\Magento\Framework\Model\AbstractModel $model
 * @return mixed
 */
protected function _prepareMultiselectValue($value, \Magento\Framework\Model\AbstractModel $model)
{
    $attribute = $model->getResource()->getAttribute($this->getAttribute());
    if ($attribute && $attribute->getFrontendInput() == 'multiselect') {
        // here
        $value = strlen($value) ? explode(',', $value) : [];
    }

    return $value;
}

Magento adds these spaces itself to the value when using the products selector to add products to the condition. So I would call this a core bug.

Also because the _prepareMultiselectValue value is protected you cannot create a plugin here to fix the data you would need to create a preference and change the function to be something like:

/**
 * Prepare multiselect attribute value
 *
 * @param mixed $value
 * @param \Magento\Catalog\Model\Product|\Magento\Framework\Model\AbstractModel $model
 * @return mixed
 */
protected function _prepareMultiselectValue($value, \Magento\Framework\Model\AbstractModel $model)
{
    $attribute = $model->getResource()->getAttribute($this->getAttribute());
    if ($attribute && $attribute->getFrontendInput() == 'multiselect') {

        // trim the exploded values
        $value = strlen($value) ? array_map('trim', explode(',', $value)) : [];
    }

    return $value;
}

Where this value is actually used is in the public validateAttribute() function in

vendor\magento\module-rule\Model\Condition\AbstractCondition around line 775

...
        case '()':
        case '!()':
            if (is_array($validatedValue)) {
                $result = count(array_intersect($validatedValue, (array)$value)) > 0;
            } else {
                $value = (array)$value;
                foreach ($value as $item) {
                    if ($this->_compareValues($validatedValue, $item)) {
                        $result = true;
                        break;
                    }
                }
            }
            break;
...

Not sure if this is fixed in 2.3 yet but if you are using version prior to 2.3 (2.2.7) and are having issues with rules not applying than you can simply remove all spaces that get added to the value or create a plugin/preference to trim the spaces before comparison.

0

Perhaps it is because the indexers are set to "Update by schedule" and you have not enabled your cron jobs?

Or your catalog price rules are not set to active? This needs to be done before the catalog price rules will be applied.

  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question. - From Review – Dhiren Vasoya May 18 '17 at 9:18
  • I'll edit my answer @DhirenVasoya – JELLEJ May 18 '17 at 9:20
0

See the is_active column in catalogrule table, by default it is 0. Not sure why.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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