File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed
app/code/Magento/Bundle/Model/ResourceModel Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -92,29 +92,29 @@ protected function _afterSave(AbstractModel $object)
92
92
{
93
93
parent ::_afterSave ($ object );
94
94
95
- $ condition = [
96
- 'option_id = ? ' => $ object ->getId (),
97
- 'store_id = ? OR store_id = 0 ' => $ object ->getStoreId (),
98
- 'parent_product_id = ? ' => $ object ->getParentId ()
99
- ];
100
-
101
95
$ connection = $ this ->getConnection ();
102
- $ connection ->delete ($ this ->getTable ('catalog_product_bundle_option_value ' ), $ condition );
103
-
104
96
$ data = new DataObject ();
105
97
$ data ->setOptionId ($ object ->getId ())
106
98
->setStoreId ($ object ->getStoreId ())
107
99
->setParentProductId ($ object ->getParentId ())
108
100
->setTitle ($ object ->getTitle ());
109
101
110
- $ connection ->insert ($ this ->getTable ('catalog_product_bundle_option_value ' ), $ data ->getData ());
102
+ $ connection ->insertOnDuplicate (
103
+ $ this ->getTable ('catalog_product_bundle_option_value ' ),
104
+ $ data ->getData (),
105
+ ['title ' ]
106
+ );
111
107
112
108
/**
113
109
* also saving default fallback value
114
110
*/
115
111
if (0 !== (int )$ object ->getStoreId ()) {
116
112
$ data ->setStoreId (0 )->setTitle ($ object ->getDefaultTitle ());
117
- $ connection ->insert ($ this ->getTable ('catalog_product_bundle_option_value ' ), $ data ->getData ());
113
+ $ connection ->insertOnDuplicate (
114
+ $ this ->getTable ('catalog_product_bundle_option_value ' ),
115
+ $ data ->getData (),
116
+ ['title ' ]
117
+ );
118
118
}
119
119
120
120
return $ this ;
You can’t perform that action at this time.
0 commit comments