Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: error in admin edit cart rule #4493

Merged
merged 1 commit into from
Jan 17, 2025
Merged

Fix: error in admin edit cart rule #4493

merged 1 commit into from
Jan 17, 2025

Conversation

Caprico85
Copy link
Contributor

Description (*)

After #4487, my coworkers found another problem. This time it's the page for cart rules.

Image

The problem originates from these changes in v20.12.0:

--- a/app/code/core/Mage/Rule/Model/Action/Abstract.php
+++ b/app/code/core/Mage/Rule/Model/Action/Abstract.php
@@ -254,12 +254,17 @@ public function getTypeElement()
      */
     public function getAttributeElement()
     {
+        $renderer = Mage::getBlockSingleton('rule/editable');
+        if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
+            $this->getForm()::setFieldsetRenderer($renderer);
+        }
+
         return $this->getForm()->addField('action:' . $this->getId() . ':attribute', 'select', [
             'name' => 'rule[actions][' . $this->getId() . '][attribute]',
             'values' => $this->getAttributeSelectOptions(),
             'value' => $this->getAttribute(),
             'value_name' => $this->getAttributeName(),
-        ])->setRenderer(Mage::getBlockSingleton('rule/editable'));
+        ]);
     }

$this->getForm()->addField(...) creates a new form field and returns the newly created field. Previously, ->setRenderer(...) was called on this newly created form field. With your changes in v20.12.0, setFieldsetRenderer() is now called on the form, not on the form field.

Manual testing scenarios (*)

  1. Go to Promotions -> Shopping Cart Price Rules
  2. Open any rule
  3. See the tab switcher being messed up.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)

@github-actions github-actions bot added the Component: Rule Relates to Mage_Rule label Jan 16, 2025
@sreichel
Copy link
Contributor

Stupid error. Made my tests on wrong host.

Its this commit that has to be reviewed: 13cf4f6

@sreichel sreichel self-assigned this Jan 17, 2025
@sreichel sreichel added the bug label Jan 17, 2025
@addison74 addison74 merged commit d6d09a7 into OpenMage:main Jan 17, 2025
17 checks passed
@sreichel
Copy link
Contributor

@all-contributors add Caprico85 code

Copy link
Contributor

@sreichel

@Caprico85 already contributed before to code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Component: Rule Relates to Mage_Rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants