Permalink
Browse files

Handles basket quantity correctly

  • Loading branch information...
1 parent 23acd3d commit 694808b65f2dd0f601bfd33fb2038c89f703090c Chris Houghton committed Mar 12, 2013
Showing with 12 additions and 4 deletions.
  1. +12 −4 app/code/local/QuBit/UniversalVariable/Model/Page/Observer.php
@@ -301,7 +301,7 @@ public function _getProductCategories($product) {
}
- public function _getLineItems($items) {
+ public function _getLineItems($items, $page_type) {
$line_items = array();
foreach($items as $item) {
$productId = $item->getProductId();
@@ -310,9 +310,17 @@ public function _getLineItems($items) {
if ($product->isVisibleInSiteVisibility()) {
$litem_model = array();
$litem_model['product'] = $this->_getProductModel($product);
- $litem_model['quantity'] = (float) $item->getQtyOrdered();
+
+
$litem_model['subtotal'] = (float) $item->getRowTotalInclTax();
$litem_model['total_discount'] = (float) $item->getDiscountAmount();
+
+ if ($page_type == 'basket') {
+ $litem_model['quantity'] = (float) $item->getQty();
+ } else {
+ $litem_model['quantity'] = (float) $item->getQtyOrdered();
+ }
+
array_push($line_items, $litem_model);
}
}
@@ -363,7 +371,7 @@ public function _setBasket() {
// Line items
$items = $quote->getAllItems();
- $basket['line_items'] = $this->_getLineItems($items);
+ $basket['line_items'] = $this->_getLineItems($items, 'basket');
$this->_basket = $basket;
}
@@ -414,7 +422,7 @@ public function _setTranscation() {
// Get items
$items = $order->getAllItems();
- $line_items = $this->_getLineItems($items);
+ $line_items = $this->_getLineItems($items, 'transaction');
$transaction['line_items'] = $line_items;
$this->_transaction = $transaction;

0 comments on commit 694808b

Please sign in to comment.