Skip to content

Commit

Permalink
Fixed to work with Commerce 1.1.1207
Browse files Browse the repository at this point in the history
  • Loading branch information
bossanova808 committed May 12, 2016
1 parent 7fd8b16 commit 93ec6ea
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ This plugin has been tested with Craft 2.5 and Craft Commerce 1.0.1187.

## Changelog

0.1.1
* [Fixed] Update for Commerce 1.1.1207 changes to addToCart

0.1.0
* [Improved] Improved error handling.

Expand Down
2 changes: 1 addition & 1 deletion multiadd/MultiAddPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function getName()

public function getVersion()
{
return '0.1.0';
return '0.1.1';
}

public function getSchemaVersion()
Expand Down
19 changes: 15 additions & 4 deletions multiadd/services/MultiAdd_CartService.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,24 @@ public function multiAddToCart($order, $items, &$error = '')
//filling item model
$lineItem = craft()->commerce_lineItems->getLineItemByOrderPurchasableOptions($order->id, $purchasableId, $options);

if ($lineItem) {
if ($lineItem)
{
foreach ($order->getLineItems() as $$item)
{
if ($item->id == $lineItem->id)
{
$lineItem = $item;
}
}
$lineItem->qty += $qty;
} else {
$lineItem = craft()->commerce_lineItems->createLineItem($purchasableId, $order->id, $options, $qty);
}
else
{
$lineItem = craft()->commerce_lineItems->createLineItem($purchasableId, $order, $options, $qty);
}

if ($note) {
if ($note)
{
$lineItem->note = $note;
}

Expand Down
7 changes: 7 additions & 0 deletions releases.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
[
{
"version": "0.1.1",
"downloadUrl": "https://github.com/engram-design/MultiAdd/archive/0.1.1.zip",
"date": "2016-04-27T11:17:28+10:00",
"notes": [
"[Fixed] Updates for addToCart changes in Commerce 1.1.1207",
]
}, {
"version": "0.1.0",
"downloadUrl": "https://github.com/engram-design/MultiAdd/archive/0.1.0.zip",
"date": "2016-04-27T11:17:28+10:00",
Expand Down

0 comments on commit 93ec6ea

Please sign in to comment.