Skip to content

Commit 5a7ede6

Browse files
authored
Fixed missing getConditions() on DynamicRule causing fatal error (#564)
1 parent abda789 commit 5a7ede6

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

app/code/core/Maho/FeedManager/Model/DynamicRule.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ class Maho_FeedManager_Model_DynamicRule extends Mage_Core_Model_Abstract
4646
*/
4747
protected ?array $_cases = null;
4848

49+
/**
50+
* Conditions model instance
51+
*/
52+
protected ?Maho_FeedManager_Model_Rule_Condition_Combine $_conditions = null;
53+
4954
/**
5055
* Form instance for conditions rendering
5156
*/
@@ -71,6 +76,29 @@ public function setForm(\Maho\Data\Form $form): self
7176
return $this;
7277
}
7378

79+
/**
80+
* Get conditions model instance (required by rules engine UI)
81+
*/
82+
public function getConditions(): Maho_FeedManager_Model_Rule_Condition_Combine
83+
{
84+
if ($this->_conditions === null) {
85+
$this->_conditions = Mage::getModel('feedmanager/rule_condition_combine');
86+
$this->_conditions->setRule($this)->setId('1')->setPrefix('conditions');
87+
88+
if ($this->hasConditionsSerialized()) {
89+
$conditions = $this->getConditionsSerialized();
90+
if (!empty($conditions)) {
91+
$decoded = Mage::helper('core')->jsonDecode($conditions);
92+
if (is_array($decoded) && !empty($decoded)) {
93+
$this->_conditions->loadArray($decoded);
94+
}
95+
}
96+
$this->unsConditionsSerialized();
97+
}
98+
}
99+
return $this->_conditions;
100+
}
101+
74102
#[\Override]
75103
protected function _construct(): void
76104
{

0 commit comments

Comments
 (0)