1

I am using Magento 2.1.3 Enterprise Edition, and when I try to add a new update for the Cart Price Rule like below:

Marketing -> Cart Price Rule -> Schedule New Update or Click on Edit already exist update from list -> then open the action tab only not conditions -> save

Then after it I am receiving the following error:

Something went wrong while saving the Magento\SalesRule\Api\Data\RuleInterface.

Can you please help me to know what is the issue/

1

As far as i know it's problem is in the javascript. But we can also solve it like this by overriding the default save in your module di.xml

  <preference for="Magento\SalesRuleStaging\Controller\Adminhtml\Update\Save" type="Namespace\CustomPromo\Controller\Rewrite\SalesRuleStaging\Adminhtml\Update\Save"/>

Save.php is

namespace Namespace\CustomPromo\Controller\Rewrite\SalesRuleStaging\Adminhtml\Update;


class Save extends \Magento\SalesRuleStaging\Controller\Adminhtml\Update\Save
{
    /**
     * {@inheritdoc}
     */
    public function execute()
    {
        $stagingData = $this->getRequest()->getParam('staging');
        $entityData = $this->getRequest()->getPostValue();

        if($entityData['rule'] && !isset($entityData['rule']['conditions'])){
            $entityData['rule']['conditions'][1] = unserialize($entityData['conditions_serialized']);
        }
        return $this->stagingUpdateSave->execute(
            [
                'entityId' => $this->getRequest()->getParam(static::ENTITY_IDENTIFIER),
                'stagingData' => $stagingData,
                'entityData' => $entityData

            ]
        );
    }

}

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.