Version Notes
Kancart supports guest checkout now;
We developed a promotion mechanism, you can add promotion rules for mobile user;
More details of improvements can be found on www.kancart.com
Download this release
Release Info
Developer | Kancart.com |
Extension | KANCART_MobileAPI |
Version | 2.1.1 |
Comparing to | |
See all releases |
Code changes from version 2.1.0 to 2.1.1
- app/code/community/Kancart/MobileApi/Model/Abstract.php +31 -1
- app/code/community/Kancart/MobileApi/Model/Cart.php +5 -22
- app/code/community/Kancart/MobileApi/Model/Checkout.php +10 -8
- app/code/community/Kancart/MobileApi/Model/Item.php +11 -11
- app/code/community/Kancart/MobileApi/Model/Order.php +6 -4
- app/code/community/Kancart/MobileApi/controllers/IndexController.php +2 -1
- app/code/community/Kancart/MobileApi/etc/system.xml +21 -2
- package.xml +8 -6
app/code/community/Kancart/MobileApi/Model/Abstract.php
CHANGED
@@ -42,6 +42,33 @@ abstract class Kancart_MobileApi_Model_Abstract {
|
|
42 |
return Mage::getSingleton('core/layout');
|
43 |
}
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
public function toAddressData($address) {
|
46 |
if (!$address) {
|
47 |
return array();
|
@@ -144,7 +171,10 @@ abstract class Kancart_MobileApi_Model_Abstract {
|
|
144 |
return Mage::getSingleton('customer/session')->isLoggedIn();
|
145 |
}
|
146 |
|
147 |
-
public function getCurrencyPrice($price, $format = false, $includeContainer = false) {
|
|
|
|
|
|
|
148 |
return Mage::helper('core')->currency($price, $format, $includeContainer);
|
149 |
}
|
150 |
|
42 |
return Mage::getSingleton('core/layout');
|
43 |
}
|
44 |
|
45 |
+
public function getItemRenderer(Mage_Sales_Model_Quote_Item_Abstract $item) {
|
46 |
+
static $cache = array();
|
47 |
+
|
48 |
+
$productType = $item->getProductType();
|
49 |
+
if (!isset($cache[$productType])) {
|
50 |
+
switch ($productType) {
|
51 |
+
case Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE:
|
52 |
+
$renderer = new Mage_Checkout_Block_Cart_Item_Renderer_Configurable();
|
53 |
+
break;
|
54 |
+
case Mage_Catalog_Model_Product_Type::TYPE_BUNDLE:
|
55 |
+
$renderer = new Mage_Bundle_Block_Checkout_Cart_Item_Renderer();
|
56 |
+
break;
|
57 |
+
case Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE:
|
58 |
+
$renderer = new Mage_Downloadable_Block_Checkout_Cart_Item_Renderer();
|
59 |
+
break;
|
60 |
+
default:
|
61 |
+
$renderer = new Mage_Checkout_Block_Cart_Item_Renderer();
|
62 |
+
break;
|
63 |
+
}
|
64 |
+
$cache[$productType] = $renderer;
|
65 |
+
}
|
66 |
+
$renderer = $cache[$productType];
|
67 |
+
$renderer->setItem($item);
|
68 |
+
|
69 |
+
return $renderer;
|
70 |
+
}
|
71 |
+
|
72 |
public function toAddressData($address) {
|
73 |
if (!$address) {
|
74 |
return array();
|
171 |
return Mage::getSingleton('customer/session')->isLoggedIn();
|
172 |
}
|
173 |
|
174 |
+
public function getCurrencyPrice($price, $format = false, $includeContainer = false, $includeTax = PRICE_INCLUDE_TAX) {
|
175 |
+
if ($includeTax && isset($this->product) && is_object($this->product)) {
|
176 |
+
$price = Mage::helper('tax')->getPrice($this->product, $price, true);
|
177 |
+
}
|
178 |
return Mage::helper('core')->currency($price, $format, $includeContainer);
|
179 |
}
|
180 |
|
app/code/community/Kancart/MobileApi/Model/Cart.php
CHANGED
@@ -59,6 +59,7 @@ class Kancart_MobileApi_Model_Cart extends Kancart_MobileApi_Model_Abstract {
|
|
59 |
$displayCartPriceExclTax = Mage::helper('tax')->displayCartPriceExclTax();
|
60 |
$displayCartBothPrices = Mage::helper('tax')->displayCartBothPrices();
|
61 |
foreach ($this->_getItems() as $item) {
|
|
|
62 |
$cartItemArr = array();
|
63 |
$cartItemArr['cart_item_id'] = $item->getId();
|
64 |
$cartItemArr['currency'] = $currency;
|
@@ -66,7 +67,7 @@ class Kancart_MobileApi_Model_Cart extends Kancart_MobileApi_Model_Abstract {
|
|
66 |
$cartItemArr['item_id'] = $item->getProduct()->getId();
|
67 |
$cartItemArr['item_title'] = strip_tags($item->getProduct()->getName());
|
68 |
$cartItemArr['qty'] = $item->getQty();
|
69 |
-
$cartItemArr['thumbnail_pic_url'] = $
|
70 |
|
71 |
if ($displayCartPriceExclTax || $displayCartBothPrices) {
|
72 |
if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales') && $item->getWeeeTaxAppliedAmount()) {
|
@@ -86,7 +87,7 @@ class Kancart_MobileApi_Model_Cart extends Kancart_MobileApi_Model_Abstract {
|
|
86 |
}
|
87 |
|
88 |
$cartItemArr['item_price'] = max($exclPrice, $inclPrice); //only display one
|
89 |
-
$cartItemArr['display_attributes'] = $this->getDisplayAttribute($item);
|
90 |
|
91 |
array_push($cartItemsArr, $cartItemArr);
|
92 |
}
|
@@ -109,27 +110,9 @@ class Kancart_MobileApi_Model_Cart extends Kancart_MobileApi_Model_Abstract {
|
|
109 |
* Cart Item Render
|
110 |
* @param type $product
|
111 |
*/
|
112 |
-
public function getDisplayAttribute(Mage_Sales_Model_Quote_Item $item) {
|
113 |
-
$isDownloadProduct = false;
|
114 |
-
switch ($item->getProductType()) {
|
115 |
-
case Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE:
|
116 |
-
$renderer = new Mage_Checkout_Block_Cart_Item_Renderer_Configurable();
|
117 |
-
break;
|
118 |
-
case Mage_Catalog_Model_Product_Type::TYPE_BUNDLE:
|
119 |
-
$renderer = new Mage_Bundle_Block_Checkout_Cart_Item_Renderer();
|
120 |
-
break;
|
121 |
-
case Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE:
|
122 |
-
$renderer = new Mage_Downloadable_Block_Checkout_Cart_Item_Renderer();
|
123 |
-
$isDownloadProduct = true;
|
124 |
-
break;
|
125 |
-
default:
|
126 |
-
$renderer = new Mage_Checkout_Block_Cart_Item_Renderer();
|
127 |
-
break;
|
128 |
-
}
|
129 |
-
|
130 |
-
$renderer->setItem($item);
|
131 |
$optionsArr = '';
|
132 |
-
if ($
|
133 |
foreach ($renderer->getLinks() as $link) {
|
134 |
$optionsArr .= $renderer->getLinksTitle() . ': ' . $link->getTitle() . '<br/>';
|
135 |
}
|
59 |
$displayCartPriceExclTax = Mage::helper('tax')->displayCartPriceExclTax();
|
60 |
$displayCartBothPrices = Mage::helper('tax')->displayCartBothPrices();
|
61 |
foreach ($this->_getItems() as $item) {
|
62 |
+
$renderer = $this->getItemRenderer($item);
|
63 |
$cartItemArr = array();
|
64 |
$cartItemArr['cart_item_id'] = $item->getId();
|
65 |
$cartItemArr['currency'] = $currency;
|
67 |
$cartItemArr['item_id'] = $item->getProduct()->getId();
|
68 |
$cartItemArr['item_title'] = strip_tags($item->getProduct()->getName());
|
69 |
$cartItemArr['qty'] = $item->getQty();
|
70 |
+
$cartItemArr['thumbnail_pic_url'] = (string) $renderer->getProductThumbnail()->resize(75);
|
71 |
|
72 |
if ($displayCartPriceExclTax || $displayCartBothPrices) {
|
73 |
if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales') && $item->getWeeeTaxAppliedAmount()) {
|
87 |
}
|
88 |
|
89 |
$cartItemArr['item_price'] = max($exclPrice, $inclPrice); //only display one
|
90 |
+
$cartItemArr['display_attributes'] = $this->getDisplayAttribute($item, $renderer);
|
91 |
|
92 |
array_push($cartItemsArr, $cartItemArr);
|
93 |
}
|
110 |
* Cart Item Render
|
111 |
* @param type $product
|
112 |
*/
|
113 |
+
public function getDisplayAttribute(Mage_Sales_Model_Quote_Item $item, $renderer) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
$optionsArr = '';
|
115 |
+
if ($item->getProductType() == Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE) {
|
116 |
foreach ($renderer->getLinks() as $link) {
|
117 |
$optionsArr .= $renderer->getLinksTitle() . ': ' . $link->getTitle() . '<br/>';
|
118 |
}
|
app/code/community/Kancart/MobileApi/Model/Checkout.php
CHANGED
@@ -64,7 +64,7 @@ class Kancart_MobileApi_Model_Checkout extends Kancart_MobileApi_Model_Abstract
|
|
64 |
if ($this->getRequest()->getParam('payment_method_id') == 'paypalwpp') {
|
65 |
Kancart::getModel('PayPalEC')->kancart_shoppingcart_paypalec_detail();
|
66 |
} else {
|
67 |
-
if (!$this->isLoggedIn()
|
68 |
return array(false, '0x0002', 'You need login first.');
|
69 |
}
|
70 |
|
@@ -244,17 +244,18 @@ class Kancart_MobileApi_Model_Checkout extends Kancart_MobileApi_Model_Abstract
|
|
244 |
|
245 |
public function kancart_shoppingcart_coupons_update() {
|
246 |
try {
|
247 |
-
$
|
248 |
$cart = Mage::getSingleton('checkout/cart');
|
249 |
if (!$cart->getQuote()->getItemsCount()) {
|
250 |
throw new Exception('Cart is empty.');
|
251 |
}
|
252 |
-
$couponCode = $params['coupon_id'];
|
253 |
$message = $this->updateCoupon($couponCode);
|
254 |
-
$
|
255 |
-
|
256 |
-
|
257 |
-
|
|
|
|
|
258 |
} catch (Exception $e) {
|
259 |
$_SESSION['checkout_messages'] = array(array(
|
260 |
'type' => 'fail',
|
@@ -268,7 +269,7 @@ class Kancart_MobileApi_Model_Checkout extends Kancart_MobileApi_Model_Abstract
|
|
268 |
public function updateCoupon($couponCode) {
|
269 |
$oldCouponCode = $this->getQuote()->getCouponCode();
|
270 |
if (!strlen($couponCode) && !strlen($oldCouponCode)) {
|
271 |
-
|
272 |
}
|
273 |
$message = '';
|
274 |
try {
|
@@ -337,6 +338,7 @@ class Kancart_MobileApi_Model_Checkout extends Kancart_MobileApi_Model_Abstract
|
|
337 |
);
|
338 |
|
339 |
$kcode = str_replace('kancart_', '', $payment_id);
|
|
|
340 |
$payments = array();
|
341 |
$methods = $this->getAvailablePayment();
|
342 |
if ($methods) {
|
64 |
if ($this->getRequest()->getParam('payment_method_id') == 'paypalwpp') {
|
65 |
Kancart::getModel('PayPalEC')->kancart_shoppingcart_paypalec_detail();
|
66 |
} else {
|
67 |
+
if (!$this->isLoggedIn() && !$this->getRequest()->getParam('guest_checkout')) {
|
68 |
return array(false, '0x0002', 'You need login first.');
|
69 |
}
|
70 |
|
244 |
|
245 |
public function kancart_shoppingcart_coupons_update() {
|
246 |
try {
|
247 |
+
$couponCode = $this->getRequest()->getParam('coupon_id');
|
248 |
$cart = Mage::getSingleton('checkout/cart');
|
249 |
if (!$cart->getQuote()->getItemsCount()) {
|
250 |
throw new Exception('Cart is empty.');
|
251 |
}
|
|
|
252 |
$message = $this->updateCoupon($couponCode);
|
253 |
+
if ($message) {
|
254 |
+
$_SESSION['checkout_messages'] = array(array(
|
255 |
+
'type' => 'success',
|
256 |
+
'content' => $message)
|
257 |
+
);
|
258 |
+
}
|
259 |
} catch (Exception $e) {
|
260 |
$_SESSION['checkout_messages'] = array(array(
|
261 |
'type' => 'fail',
|
269 |
public function updateCoupon($couponCode) {
|
270 |
$oldCouponCode = $this->getQuote()->getCouponCode();
|
271 |
if (!strlen($couponCode) && !strlen($oldCouponCode)) {
|
272 |
+
return;
|
273 |
}
|
274 |
$message = '';
|
275 |
try {
|
338 |
);
|
339 |
|
340 |
$kcode = str_replace('kancart_', '', $payment_id);
|
341 |
+
$kcode = str_replace('magePay-', '', $kcode);
|
342 |
$payments = array();
|
343 |
$methods = $this->getAvailablePayment();
|
344 |
if ($methods) {
|
app/code/community/Kancart/MobileApi/Model/Item.php
CHANGED
@@ -28,7 +28,7 @@ class Kancart_MobileApi_Model_Item extends Kancart_MobileApi_Model_Abstract {
|
|
28 |
* Current product object
|
29 |
* @var Mage_Catalog_Model_Product
|
30 |
*/
|
31 |
-
|
32 |
|
33 |
/**
|
34 |
* the item converted by the current product
|
@@ -68,7 +68,7 @@ class Kancart_MobileApi_Model_Item extends Kancart_MobileApi_Model_Abstract {
|
|
68 |
|
69 |
public function getItemBaseInfo() {
|
70 |
$helper = Mage::helper('catalog/image');
|
71 |
-
$helper->init($this->product, $this->getProductImageType())->keepFrame(
|
72 |
$this->item['item_id'] = $this->product->getId();
|
73 |
$this->item['item_title'] = $this->product->getName();
|
74 |
$this->item['item_url'] = $this->product->getProductUrl();
|
@@ -211,9 +211,9 @@ class Kancart_MobileApi_Model_Item extends Kancart_MobileApi_Model_Abstract {
|
|
211 |
$this->item['short_description'] = $_helper->productAttribute($this->product, nl2br($this->product->getShortDescription()), 'short_description');
|
212 |
$this->item['detail_description'] = $_helper->productAttribute($this->product, $this->product->getDescription(), 'description');
|
213 |
if (preg_match('/{{(.+)}}/i', $this->item['detail_description'])) {
|
214 |
-
$
|
215 |
-
$this->item['detail_description'] = preg_replace('/(\<img[^\<\>]+src\s*=\s*"){{(\w+)\s*url="(.+)}}/i', '$1' . $host . '/$2/$3', $this->item['detail_description']);
|
216 |
}
|
|
|
217 |
$this->item['specifications'] = $this->getProductFeature();
|
218 |
}
|
219 |
|
@@ -249,7 +249,7 @@ class Kancart_MobileApi_Model_Item extends Kancart_MobileApi_Model_Abstract {
|
|
249 |
private function getItemImageUrl($imageFile = null) {
|
250 |
$imageType = $this->getProductImageType();
|
251 |
$helper = Mage::helper('catalog/image');
|
252 |
-
return (string) $helper->init($this->product, $imageType, $imageFile)->keepFrame(
|
253 |
}
|
254 |
|
255 |
public function getItemImages() {
|
@@ -728,17 +728,17 @@ class Kancart_MobileApi_Model_Item extends Kancart_MobileApi_Model_Abstract {
|
|
728 |
if ($DisplayMinimalPrice && $_minimalPriceValue && $_minimalPriceValue < $_finalPrice) {
|
729 |
if (!$UseLinkForAsLowAs) {
|
730 |
if ($_finalPrice > 0) {
|
731 |
-
$this->addtoDisplayPrices($display_prices, 'Price:
|
732 |
}
|
733 |
if (!$this->detail) { //items list show different
|
734 |
-
$this->addtoDisplayPrices($display_prices, $this->__('As low as:
|
735 |
} else if (!$_finalPrice) {
|
736 |
-
$this->addtoDisplayPrices($display_prices, $this->__('As low as:
|
737 |
}
|
738 |
}
|
739 |
} else {
|
740 |
if ($_finalPrice == $_price) {
|
741 |
-
$this->addtoDisplayPrices($display_prices, 'Price:
|
742 |
} else {
|
743 |
$this->addtoDisplayPrices($display_prices, $this->__('Regular Price:'), $this->getCurrencyPrice($_price), 'line-through');
|
744 |
$this->addtoDisplayPrices($display_prices, $this->__('Special Price:'), $this->getCurrencyPrice($_finalPrice));
|
@@ -772,7 +772,7 @@ class Kancart_MobileApi_Model_Item extends Kancart_MobileApi_Model_Abstract {
|
|
772 |
$_finalPrice = $product->getFinalPrice();
|
773 |
if ($product->getPriceView()) {
|
774 |
if ($_finalPrice > 0) {
|
775 |
-
$this->addtoDisplayPrices($display_prices, 'Price:
|
776 |
}
|
777 |
if (!$this->detail) { //items list show different
|
778 |
$this->addtoDisplayPrices($display_prices, $this->__('As low as: ') . $this->getCurrencyPrice($_minimalPrice, true, false), 0, 'free');
|
@@ -784,7 +784,7 @@ class Kancart_MobileApi_Model_Item extends Kancart_MobileApi_Model_Abstract {
|
|
784 |
$this->addtoDisplayPrices($display_prices, $this->__('From:'), $this->getCurrencyPrice($_minimalPrice), 'from');
|
785 |
$this->addtoDisplayPrices($display_prices, $this->__('To:'), $this->getCurrencyPrice($_maximalPrice), 'to');
|
786 |
} else {
|
787 |
-
$this->addtoDisplayPrices($display_prices, 'Price:
|
788 |
}
|
789 |
}
|
790 |
$prices['base_price'] = array('price' => $this->getCurrencyPrice($_finalPrice));
|
28 |
* Current product object
|
29 |
* @var Mage_Catalog_Model_Product
|
30 |
*/
|
31 |
+
protected $product;
|
32 |
|
33 |
/**
|
34 |
* the item converted by the current product
|
68 |
|
69 |
public function getItemBaseInfo() {
|
70 |
$helper = Mage::helper('catalog/image');
|
71 |
+
$helper->init($this->product, $this->getProductImageType())->keepFrame(true); //true
|
72 |
$this->item['item_id'] = $this->product->getId();
|
73 |
$this->item['item_title'] = $this->product->getName();
|
74 |
$this->item['item_url'] = $this->product->getProductUrl();
|
211 |
$this->item['short_description'] = $_helper->productAttribute($this->product, nl2br($this->product->getShortDescription()), 'short_description');
|
212 |
$this->item['detail_description'] = $_helper->productAttribute($this->product, $this->product->getDescription(), 'description');
|
213 |
if (preg_match('/{{(.+)}}/i', $this->item['detail_description'])) {
|
214 |
+
$this->item['detail_description'] = preg_replace('/(\<img[^\<\>]+src\s*=\s*"){{(\w+)\s*url="(.+)}}/i', '$1' . Mage::getBaseUrl() . '/$2/$3', $this->item['detail_description']);
|
|
|
215 |
}
|
216 |
+
$this->item['detail_description'] = preg_replace('/(<img[^<^>]+?src\s*=\s*(\"|\'))([^:\"\']+\2)/i', '$1' . Mage::getBaseUrl() . '$3', $this->item['detail_description']);
|
217 |
$this->item['specifications'] = $this->getProductFeature();
|
218 |
}
|
219 |
|
249 |
private function getItemImageUrl($imageFile = null) {
|
250 |
$imageType = $this->getProductImageType();
|
251 |
$helper = Mage::helper('catalog/image');
|
252 |
+
return (string) $helper->init($this->product, $imageType, $imageFile)->keepFrame(true)->resize(640);
|
253 |
}
|
254 |
|
255 |
public function getItemImages() {
|
728 |
if ($DisplayMinimalPrice && $_minimalPriceValue && $_minimalPriceValue < $_finalPrice) {
|
729 |
if (!$UseLinkForAsLowAs) {
|
730 |
if ($_finalPrice > 0) {
|
731 |
+
$this->addtoDisplayPrices($display_prices, $this->__('Price:'), $this->getCurrencyPrice($_finalPrice));
|
732 |
}
|
733 |
if (!$this->detail) { //items list show different
|
734 |
+
$this->addtoDisplayPrices($display_prices, $this->__('As low as:') . $this->getCurrencyPrice($_minimalPriceValue, true, false), 0, 'free');
|
735 |
} else if (!$_finalPrice) {
|
736 |
+
$this->addtoDisplayPrices($display_prices, $this->__('As low as:'), $this->getCurrencyPrice($_minimalPriceValue));
|
737 |
}
|
738 |
}
|
739 |
} else {
|
740 |
if ($_finalPrice == $_price) {
|
741 |
+
$this->addtoDisplayPrices($display_prices, $this->__('Price:'), $this->getCurrencyPrice($_price));
|
742 |
} else {
|
743 |
$this->addtoDisplayPrices($display_prices, $this->__('Regular Price:'), $this->getCurrencyPrice($_price), 'line-through');
|
744 |
$this->addtoDisplayPrices($display_prices, $this->__('Special Price:'), $this->getCurrencyPrice($_finalPrice));
|
772 |
$_finalPrice = $product->getFinalPrice();
|
773 |
if ($product->getPriceView()) {
|
774 |
if ($_finalPrice > 0) {
|
775 |
+
$this->addtoDisplayPrices($display_prices, $this->__('Price:'), $this->getCurrencyPrice($_finalPrice));
|
776 |
}
|
777 |
if (!$this->detail) { //items list show different
|
778 |
$this->addtoDisplayPrices($display_prices, $this->__('As low as: ') . $this->getCurrencyPrice($_minimalPrice, true, false), 0, 'free');
|
784 |
$this->addtoDisplayPrices($display_prices, $this->__('From:'), $this->getCurrencyPrice($_minimalPrice), 'from');
|
785 |
$this->addtoDisplayPrices($display_prices, $this->__('To:'), $this->getCurrencyPrice($_maximalPrice), 'to');
|
786 |
} else {
|
787 |
+
$this->addtoDisplayPrices($display_prices, $this->__('Price:'), $this->getCurrencyPrice($_minimalPrice), 'normal');
|
788 |
}
|
789 |
}
|
790 |
$prices['base_price'] = array('price' => $this->getCurrencyPrice($_finalPrice));
|
app/code/community/Kancart/MobileApi/Model/Order.php
CHANGED
@@ -126,7 +126,7 @@ class Kancart_MobileApi_Model_Order extends Kancart_MobileApi_Model_Abstract {
|
|
126 |
$ordersCounts = array(
|
127 |
'order_counts' => array(
|
128 |
array('status_ids' => 'all',
|
129 |
-
'status_name' =>
|
130 |
'count' => $collection->getSize())
|
131 |
)
|
132 |
);
|
@@ -223,7 +223,7 @@ class Kancart_MobileApi_Model_Order extends Kancart_MobileApi_Model_Abstract {
|
|
223 |
'display_id' => $item->getId(),
|
224 |
'display_attributes' => $this->getOrderItemOptions($item->getProductOptions()),
|
225 |
'item_title' => strip_tags($item->getName()),
|
226 |
-
'thumbnail_pic_url' => $product->
|
227 |
'qty' => intval($item->getQtyOrdered()),
|
228 |
'price' => $item->getPrice(),
|
229 |
'final_price' => $item->getPrice(),
|
@@ -301,12 +301,14 @@ class Kancart_MobileApi_Model_Order extends Kancart_MobileApi_Model_Abstract {
|
|
301 |
private function getOrderHistory($order, &$orderItem) {
|
302 |
$status = array();
|
303 |
$postion = 0;
|
|
|
304 |
foreach ($order->getAllStatusHistory() as $history) { //getVisibleStatusHistory() show all history for mobile order
|
305 |
strtolower($history->getStatus()) == strtolower($order->getStatus()) && $orderItem['last_status_id'] = $history->getId();
|
|
|
306 |
$status[] = array(
|
307 |
'status_id' => $history->getId(),
|
308 |
-
'status_name' => $
|
309 |
-
'display_text' => $
|
310 |
'language_id' => Mage::app()->getStore()->getCode(),
|
311 |
'date_added' => $history->getCreatedAt(),
|
312 |
'comments' => Mage::helper('core')->escapeHtml($history->getComment()),
|
126 |
$ordersCounts = array(
|
127 |
'order_counts' => array(
|
128 |
array('status_ids' => 'all',
|
129 |
+
'status_name' =>Mage::helper('Sales')->__('My Orders'),
|
130 |
'count' => $collection->getSize())
|
131 |
)
|
132 |
);
|
223 |
'display_id' => $item->getId(),
|
224 |
'display_attributes' => $this->getOrderItemOptions($item->getProductOptions()),
|
225 |
'item_title' => strip_tags($item->getName()),
|
226 |
+
'thumbnail_pic_url' => (string) Mage::helper('catalog/image')->init($product, 'thumbnail')->resize(75),
|
227 |
'qty' => intval($item->getQtyOrdered()),
|
228 |
'price' => $item->getPrice(),
|
229 |
'final_price' => $item->getPrice(),
|
301 |
private function getOrderHistory($order, &$orderItem) {
|
302 |
$status = array();
|
303 |
$postion = 0;
|
304 |
+
$config = Mage::getSingleton('sales/order_config');
|
305 |
foreach ($order->getAllStatusHistory() as $history) { //getVisibleStatusHistory() show all history for mobile order
|
306 |
strtolower($history->getStatus()) == strtolower($order->getStatus()) && $orderItem['last_status_id'] = $history->getId();
|
307 |
+
$label = $config->getStatusLabel($history->getStatus());
|
308 |
$status[] = array(
|
309 |
'status_id' => $history->getId(),
|
310 |
+
'status_name' => $label,
|
311 |
+
'display_text' => $label,
|
312 |
'language_id' => Mage::app()->getStore()->getCode(),
|
313 |
'date_added' => $history->getCreatedAt(),
|
314 |
'comments' => Mage::helper('core')->escapeHtml($history->getComment()),
|
app/code/community/Kancart/MobileApi/controllers/IndexController.php
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
<?php
|
2 |
|
3 |
error_reporting(E_ALL ^ E_NOTICE);
|
4 |
-
define('KANCART_PLUGIN_VERSION', '2.1.
|
5 |
define('KANCART_APP_KEY', Mage::getStoreConfig('Kancart/Kancart_group/Kancart_appkey', Mage::app()->getStore()));
|
6 |
define('KANCART_APP_SECRECT', Mage::getStoreConfig('Kancart/Kancart_group/Kancart_appsecret', Mage::app()->getStore()));
|
|
|
7 |
define('MOBILE_API_ROOT', dirname(dirname(__FILE__)));
|
8 |
include(MOBILE_API_ROOT . DIRECTORY_SEPARATOR . 'Model' . DIRECTORY_SEPARATOR . 'ErrorHandler.php');
|
9 |
include(MOBILE_API_ROOT . DIRECTORY_SEPARATOR . 'Model' . DIRECTORY_SEPARATOR . 'Abstract.php');
|
1 |
<?php
|
2 |
|
3 |
error_reporting(E_ALL ^ E_NOTICE);
|
4 |
+
define('KANCART_PLUGIN_VERSION', '2.1.1');
|
5 |
define('KANCART_APP_KEY', Mage::getStoreConfig('Kancart/Kancart_group/Kancart_appkey', Mage::app()->getStore()));
|
6 |
define('KANCART_APP_SECRECT', Mage::getStoreConfig('Kancart/Kancart_group/Kancart_appsecret', Mage::app()->getStore()));
|
7 |
+
define('PRICE_INCLUDE_TAX', (boolean) Mage::getStoreConfig('Kancart/Kancart_general/price_tax', Mage::app()->getStore()));
|
8 |
define('MOBILE_API_ROOT', dirname(dirname(__FILE__)));
|
9 |
include(MOBILE_API_ROOT . DIRECTORY_SEPARATOR . 'Model' . DIRECTORY_SEPARATOR . 'ErrorHandler.php');
|
10 |
include(MOBILE_API_ROOT . DIRECTORY_SEPARATOR . 'Model' . DIRECTORY_SEPARATOR . 'Abstract.php');
|
app/code/community/Kancart/MobileApi/etc/system.xml
CHANGED
@@ -43,9 +43,28 @@
|
|
43 |
<show_in_default>1</show_in_default>
|
44 |
<show_in_website>1</show_in_website>
|
45 |
<show_in_store>1</show_in_store>
|
46 |
-
</Kancart_appsecret>
|
47 |
</fields>
|
48 |
-
</Kancart_group>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
</groups>
|
50 |
</Kancart>
|
51 |
</sections>
|
43 |
<show_in_default>1</show_in_default>
|
44 |
<show_in_website>1</show_in_website>
|
45 |
<show_in_store>1</show_in_store>
|
46 |
+
</Kancart_appsecret>
|
47 |
</fields>
|
48 |
+
</Kancart_group>
|
49 |
+
<Kancart_general translate="label">
|
50 |
+
<label>Frontend</label>
|
51 |
+
<frontend_type>text</frontend_type>
|
52 |
+
<sort_order>100</sort_order>
|
53 |
+
<show_in_default>1</show_in_default>
|
54 |
+
<show_in_website>1</show_in_website>
|
55 |
+
<show_in_store>1</show_in_store>
|
56 |
+
<fields>
|
57 |
+
<price_tax translate="label">
|
58 |
+
<label>Price Include Tax</label>
|
59 |
+
<comment>Choose Yes if all price listed on mobile client should include tax.</comment>
|
60 |
+
<frontend_type>select</frontend_type>
|
61 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
62 |
+
<sort_order>50</sort_order>
|
63 |
+
<show_in_default>1</show_in_default>
|
64 |
+
<show_in_website>1</show_in_website>
|
65 |
+
</price_tax>
|
66 |
+
</fields>
|
67 |
+
</Kancart_general>
|
68 |
</groups>
|
69 |
</Kancart>
|
70 |
</sections>
|
package.xml
CHANGED
@@ -1,22 +1,24 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>KANCART_MobileAPI</name>
|
4 |
-
<version>2.1.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Kancart Mobile API Service</summary>
|
10 |
-
<description>
|
11 |
-
|
|
|
|
|
12 |
<notes>Kancart supports guest checkout now;
|
13 |
We developed a promotion mechanism, you can add promotion rules for mobile user;
|
14 |
More details of improvements can be found on www.kancart.com
|
15 |
</notes>
|
16 |
<authors><author><name>Kancart.com</name><user>Kancarter</user><email>support@kancart.com</email></author></authors>
|
17 |
-
<date>2013-12-
|
18 |
-
<time>
|
19 |
-
<contents><target name="magecommunity"><dir name="Kancart"><dir name="MobileApi"><dir name="Helper"><file name="CryptoUtil.php" hash="2db9a53cbaed6e8bc5f2dae4ed2ec334"/><file name="DES.php" hash="f038974cc0cf453373a52e6d4770ffdb"/><file name="Data.php" hash="ce8f291eec3277eb01b1f00225e5cbd8"/><file name="Rijndael.php" hash="be7c805f21086f7c26f785d0c0e73afd"/></dir><dir name="Model"><file name="Abstract.php" hash="
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>KANCART_MobileAPI</name>
|
4 |
+
<version>2.1.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Kancart Mobile API Service</summary>
|
10 |
+
<description>1)Fix some bug about guest checkout.
|
11 |
+
2)Fix some text were not well localized issue.
|
12 |
+
3)Add switch to plugin configure page to control if the price on mobile site should includes tax.
|
13 |
+
</description>
|
14 |
<notes>Kancart supports guest checkout now;
|
15 |
We developed a promotion mechanism, you can add promotion rules for mobile user;
|
16 |
More details of improvements can be found on www.kancart.com
|
17 |
</notes>
|
18 |
<authors><author><name>Kancart.com</name><user>Kancarter</user><email>support@kancart.com</email></author></authors>
|
19 |
+
<date>2013-12-20</date>
|
20 |
+
<time>09:42:35</time>
|
21 |
+
<contents><target name="magecommunity"><dir name="Kancart"><dir name="MobileApi"><dir name="Helper"><file name="CryptoUtil.php" hash="2db9a53cbaed6e8bc5f2dae4ed2ec334"/><file name="DES.php" hash="f038974cc0cf453373a52e6d4770ffdb"/><file name="Data.php" hash="ce8f291eec3277eb01b1f00225e5cbd8"/><file name="Rijndael.php" hash="be7c805f21086f7c26f785d0c0e73afd"/></dir><dir name="Model"><file name="Abstract.php" hash="ece61ca6a4697510071a14eb936a8853"/><file name="Cart.php" hash="9fc7f8a3c4f28703b565fee710250b68"/><file name="Category.php" hash="4993c1f1b5c03dccd5b50a8159f4880a"/><file name="Checkout.php" hash="5d7c607c7c20993d9bde207537dec1d1"/><file name="Discount.php" hash="b3f29b73768931a041703a0c7df3db53"/><file name="ErrorHandler.php" hash="6d62e02c4ce592a41b242e781fe2c28a"/><file name="Invoice.php" hash="cf16e5e8429b438d6e929d36e205f60b"/><file name="Item.php" hash="ec9dc4d48dbce01fb2a8e8e4bbe20d3a"/><file name="Items.php" hash="1468b2fa60afe0476b0d10b9b12be182"/><file name="Order.php" hash="2f5fc3ed2959ffcdabe331ec9b364d04"/><file name="PayPalEC.php" hash="936af8c18938954caf8a196f48b9fc5a"/><file name="PayPalWPS.php" hash="50e29c8a8f405cff32267de91adc1e5a"/><file name="Payment.php" hash="337b55ba40a0dbf3214c1b9461cce882"/><file name="Result.php" hash="64759b5dcb022186f12c0cb043877af0"/><file name="Review.php" hash="cd3b705fb6894c36824094f562acc869"/><file name="Store.php" hash="2115e661f8a2c702383a89725aa2b2ed"/><file name="User.php" hash="05200f849e09346bf662ac1157217406"/></dir><dir name="controllers"><file name="IndexController.php" hash="0107661bb0160e45010a2106ae00d17c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="3364317d05e33ac33f067aed7a9f6a58"/><file name="config.xml" hash="2f9d3466e651ac2b2b1f387b1a2356ad"/><file name="system.xml" hash="b66fd59298227a3f38e6ea9f1e5f1138"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Kancart_MobileApi.xml" hash="17ceeb976f959fc6365da95b532dd616"/></dir></target></contents>
|
22 |
<compatible/>
|
23 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
24 |
</package>
|