function renderCartTable($cart, $options = array(), $renderer = NULL) { $this->cart = $cart; $trs = ''; $this->_withImage = FALSE; if (isset($options['with_image']) && $options['with_image']) { $this->_withImage = TRUE; } if (!isset($this->withItemTable) || $this->withItemTable) { $tableMode = $this->_getTableMode(); if ($tableMode != 'mini') { $trs .= $this->_getTableHeadRow($options); } if ($cart['items']) { foreach ($cart['items'] as $item) { if ($item['quantity']) { $trs .= $this->_getTableItemRow($item, $options, $renderer); } } } } if (!isset($this->withTotalRows) || $this->withTotalRows) { $trs .= $this->_getItemTotalRow(); $this->_total = Helper_Cart::getItemTotal($this->cart['items']); $trs .= $this->_renderTotalRows($cart); } $table_content = $trs; $empty_div = $this->xmlDiv('Your shopping cart is empty.'); $cart_table = $empty_div; $is_empty = count($cart['items']) == 0; if (!$is_empty) { $cart_table = $this->xmlTag('table', $table_content, array()); } return $cart_table; }
static function getSoldsOfCart($controller, $cartObj) { $solds = array(); $cart = Helper_Cart::cartToArr($cartObj, $controller); $solds = Helper_Cart::cartToSoldProducts(NULL, $cart, 'SoldProduct'); return $solds; }
static function getJneInsurance($items) { return 5000 + self::roundUp(Helper_Cart::getTotalPriceOfItems($items) * 0.002, 3); }
static function _ecommerceProductToArr($controller, $obj) { $arr = self::_basicProductToArr($controller, $obj); if (!$obj instanceof EcommerceProduct) { return $arr; } $tempSimpleProducts = Helper_Krco::getSimpleProductsByAggregatorId($controller, $obj->getId()); $simpleProducts = array(); foreach ($tempSimpleProducts as $simProd) { $newSimProd = Helper_Cart::_combineSimpleFromAggregator($simProd, $obj); $simpleProducts[] = $newSimProd; } $arr['decoration'] = $obj->getRibbon(); $arr['wish_count'] = (int) $obj->getWishCount(); $arr['options'] = $controller->_getProductOptions($obj); $arr['general_options'] = $controller->_getProductGeneralOptions($arr['options']); $arr['is_backorder'] = Helper_Structure::_getAttrFromObj('IsAllowBackorder', $obj); $arr['variants'] = $controller->_getProductVariants($obj, $simpleProducts); $arr['detailed_variants'] = $controller->_getProductVariants($obj, $simpleProducts, TRUE); $arr['prices_by_color'] = $controller->_getPricesByColor($obj, $simpleProducts); $arr['advanced_pricing_rules'] = json_decode($obj->getAdvancedPricingRule(), TRUE); $arr['size'] = $obj->getAttribute1(); $arr['color'] = $obj->getAttribute2(); //$arr['material'] = $obj->getAttribute3(); $options = $controller->getObjKrcoConfig('options', 'products'); if (is_array($options)) { $idx = 3; $defKeys = Helper_Krco::getDefaultProductOptionKeys(); foreach ($options as $key => $opt) { if (in_array($key, $defKeys)) { continue; } $getAttr = "getAttribute{$idx}"; $arr[$key] = $obj->{$getAttr}(); $idx++; } } return $arr; }