subscribepro-magento2-ext icon indicating copy to clipboard operation
subscribepro-magento2-ext copied to clipboard

Error when attempting to use Subscribe Pro attributes when creating a cart price rule conditions

Open JaimeD-SubscribePro opened this issue 7 months ago • 1 comments

Client is seeing a 404 error in Magento when attempting to use SubscribePro attributes when creating a cart price rule condition. This started happening after update to 1.7.1.

This issue occurs when selecting Subscription - Status, Subscription - Interval, or Subscription - Re-order Ordinal attributes in the Magento Cart Price rules after selection

Error: Warning: foreach() argument must be of type array|object, null given in vendor/magento/modulerule/Model/Condition/AbstractCondition.php on line 286.

It looks like something related to this:

Type: "Swarming\SubscribePro\Model\Rule\Condition\Status"attribute: 
"quote_item_part_of_subscription"

This issue occurs on Magento v2.4.7 plus v1.7.1 of our extension This issue does not happen on Magento v2.4.7 plus v1.5.16 of our extension

The issue is being caused by this commit https://github.com/subscribepro/subscribepro-magento2-ext/commit/75efe8bdc19c5e0aa8c303432cc70bd54f9511cb

Specifically the addition of this function in the Model/Rule/Condition/Base.php :

/**
   * @param array $attributes
   * @return void
   */
  protected function setAttributeOption(array $attributes): void
  {
      $this->attribute_option = $attributes;
  }

image

JaimeD-SubscribePro avatar Aug 01 '24 14:08 JaimeD-SubscribePro