Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.vscode
.idea/
.DS_STORE
.DS_STORE
11 changes: 10 additions & 1 deletion Model/Dibs/Items.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,16 @@ public function addItems($items)
$sku = $item->getSku();
//make sku unique (sku could not be unique when we have product with options)
if (isset($this->_cart[$sku])) {
$sku = $sku . '-' . $item->getId();
$itemRefId = $item->getId();
/**
* use related order_item_id or quote_item_id when item id is not set
* error is observed when creating an invoice and there is more than two items with the same sku but with different configurations
* items after the second similar sku will replace the second item instead of appending as a separate item
*/
$itemRefId = $itemRefId ? $itemRefId : $item->getData('order_item_id');
$itemRefId = $itemRefId ? $itemRefId : $item->getData('quote_item_id');
$sku = $sku.'-'.$itemRefId;

}

$itemName = $item->getName();
Expand Down