Skip to content

Commit a86eda3

Browse files
MAGETWO-55184: [GitHub #5526]Selected category is not added to Cart Price Rule condition due to JS error
1 parent 4e52ac8 commit a86eda3

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Actions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ protected function addTabToForm($model, $fieldsetId = 'actions_fieldset', $formN
176176
$actionsFieldSetId = $model->getActionsFieldSetId($formName);
177177

178178
$newChildUrl = $this->getUrl(
179-
'sales_rule/promo_quote/newActionHtml/form/rule_actions_fieldset_' . $actionsFieldSetId,
179+
'sales_rule/promo_quote/newActionHtml/form/' . $actionsFieldSetId,
180180
['form_namespace' => $formName]
181181
);
182182

app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Edit.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ public function execute()
5555
$this->_redirect('sales_rule/*');
5656
return;
5757
}
58+
$model->getConditions()->setFormName('sales_rule_form');
59+
$model->getConditions()->setJsFormObject(
60+
$model->getConditionsFieldSetId($model->getConditions()->getFormName())
61+
);
62+
$model->getActions()->setFormName('sales_rule_form');
63+
$model->getActions()->setJsFormObject(
64+
$model->getActionsFieldSetId($model->getActions()->getFormName())
65+
);
66+
5867

5968
$resultPage->getLayout()->getBlock('promo_sales_rule_edit_tab_coupons')->setCanShow(true);
6069
}
@@ -65,15 +74,6 @@ public function execute()
6574
$model->addData($data);
6675
}
6776

68-
$model->getConditions()->setFormName('sales_rule_form');
69-
$model->getConditions()->setJsFormObject(
70-
$model->getConditionsFieldSetId($model->getConditions()->getFormName())
71-
);
72-
$model->getActions()->setFormName('sales_rule_form');
73-
$model->getActions()->setJsFormObject(
74-
$model->getActionsFieldSetId($model->getActions()->getFormName())
75-
);
76-
7777
$this->_initAction();
7878

7979
$this->_addBreadcrumb($id ? __('Edit Rule') : __('New Rule'), $id ? __('Edit Rule') : __('New Rule'));

app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/NewActionHtml.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class NewActionHtml extends \Magento\SalesRule\Controller\Adminhtml\Promo\Quote
1616
public function execute()
1717
{
1818
$id = $this->getRequest()->getParam('id');
19-
$formName = $this->getRequest()->getParam('form_namespace');
19+
$formName = $this->getRequest()->getParam('form');
2020
$typeArr = explode('|', str_replace('-', '/', $this->getRequest()->getParam('type')));
2121
$type = $typeArr[0];
2222

app/code/Magento/SalesRule/Model/Rule/Condition/Product/Combine.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ public function getNewChildSelectOptions()
4242
foreach ($productAttributes as $code => $label) {
4343
if (strpos($code, 'quote_item_') === 0) {
4444
$iAttributes[] = [
45-
'value' => \Magento\SalesRule\Model\Rule\Condition\Product::class . $code,
45+
'value' => \Magento\SalesRule\Model\Rule\Condition\Product::class . '|' . $code,
4646
'label' => $label,
4747
];
4848
} else {
4949
$pAttributes[] = [
50-
'value' => \Magento\SalesRule\Model\Rule\Condition\Product::class . $code,
50+
'value' => \Magento\SalesRule\Model\Rule\Condition\Product::class . '|' . $code,
5151
'label' => $label,
5252
];
5353
}

0 commit comments

Comments
 (0)