Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 955fbf2

Browse files
Jeroen van LeusdenJeroen
authored andcommitted
Correctly save Product Custom Option values
1 parent ce5eacd commit 955fbf2

File tree

1 file changed

+12
-10
lines changed
  • app/code/Magento/Catalog/Model/Product/Option

1 file changed

+12
-10
lines changed

app/code/Magento/Catalog/Model/Product/Option/Value.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -202,27 +202,29 @@ public function getProduct()
202202
public function saveValues()
203203
{
204204
foreach ($this->getValues() as $value) {
205-
$this->isDeleted(false);
206-
$this->setData(
205+
$optionValue = clone $this;
206+
$optionValue->isDeleted(false);
207+
208+
$optionValue->setData(
207209
$value
208210
)->setData(
209211
'option_id',
210-
$this->getOption()->getId()
212+
$optionValue->getOption()->getId()
211213
)->setData(
212214
'store_id',
213-
$this->getOption()->getStoreId()
215+
$optionValue->getOption()->getStoreId()
214216
);
215217

216-
if ($this->getData('is_delete') == '1') {
217-
if ($this->getId()) {
218-
$this->deleteValues($this->getId());
219-
$this->delete();
218+
if ($optionValue->getData('is_delete') == '1') {
219+
if ($optionValue->getId()) {
220+
$optionValue->deleteValues($optionValue->getId());
221+
$optionValue->delete();
220222
}
221223
} else {
222-
$this->save();
224+
$optionValue->save();
223225
}
224226
}
225-
//eof foreach()
227+
226228
return $this;
227229
}
228230

0 commit comments

Comments
 (0)