Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions magmi/engines/magmi_productimportengine.php
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ public function createAttributes($pid, &$item, $attmap, $isnew, $itemids)
} else {
// if handled value is a "DELETE" or a NULL , which will also be removed
if ($ovalue == '__MAGMI_DELETE__') {
$deletes[] = $attid;
$deletes[$store_id][] = $attid;
// do not handle value in insert
$ovalue = null;
}
Expand Down Expand Up @@ -1033,10 +1033,12 @@ public function createAttributes($pid, &$item, $attmap, $isnew, $itemids)

//if we have values to delete
if (!empty($deletes)) {
$sidlist = implode(",", $store_ids);
$attidlist = implode(",", $deletes);
$sql = "DELETE FROM $cpet WHERE entity_type_id=? AND attribute_id IN ($attidlist) AND store_id IN ($sidlist) AND entity_id=?";
$this->delete($sql, array($this->getProductEntityType(), $pid));
foreach ($deletes as $store_id => $to_delete) {
$sidlist = $store_id;
$attidlist = implode(",", $to_delete);
$sql = "DELETE FROM $cpet WHERE entity_type_id=? AND attribute_id IN ($attidlist) AND store_id IN ($sidlist) AND entity_id=?";
$this->delete($sql, array($this->getProductEntityType(),$pid));
}
}
//if no values inserted or deleted on a new item, we have a problem
if (empty($deletes) && empty($inserts) && $isnew) {
Expand Down