public function renderView($tpl = null) { if (!$this->loadObject(true)) { return; } if (!isset($this->context)) { $this->context = JeproshopContext::getContext(); } $customer = new JeproshopCustomerModelCustomer($this->cart->customer_id); $currency = new JeproshopCurrencyModelCurrency($this->cart->currency_id); $this->context->cart = $this->cart; $this->context->currency = $currency; $this->context->customer = $customer; //$this->toolbar_title = sprintf($this->l('Cart #%06d'), $this->context->cart->cart_id); $products = $this->cart->getProducts(); $customized_datas = JeproshopProductModelProduct::getAllCustomizedDatas((int) $this->cart->cart_id); JeproshopProductModelProduct::addCustomizationPrice($products, $customized_datas); $summary = $this->cart->getSummaryDetails(); /* Display order information */ $order_id = (int) JeproshopOrderModelOrder::getOrderIdByCartId($this->cart->cart_id); $order = new JeproshopOrderModelOrder($order_id); if (JeproshopTools::isLoadedObject($order, 'order_id')) { $tax_calculation_method = $order->getTaxCalculationMethod(); $shop_id = (int) $order->shop_id; } else { $shop_id = (int) $this->cart->shop_id; $tax_calculation_method = JeproshopGroupModelGroup::getPriceDisplayMethod(JeproshopGroupModelGroup::getCurrent()->group_id); } if ($tax_calculation_method == COM_JEPROSHOP_TAX_EXCLUDED) { $total_products = $summary->total_products; $total_discounts = $summary->total_discounts_tax_exc; $total_wrapping = $summary->total_wrapping_tax_exc; $total_price = $summary->total_price_without_tax; $total_shipping = $summary->total_shipping_tax_exc; } else { $total_products = $summary->total_products_wt; $total_discounts = $summary->total_discounts; $total_wrapping = $summary->total_wrapping; $total_price = $summary->total_price; $total_shipping = $summary->total_shipping; } foreach ($products as $k => &$product) { if ($tax_calculation_method == COM_JEPROSHOP_TAX_EXCLUDED) { $product->product_price = $product->price; $product->product_total = $product->total; } else { $product->product_price = $product->price_wt; $product->product_total = $product->total_wt; } $image = array(); $db = JFactory::getDBO(); if (isset($product->product_attribute_id) && (int) $product->product_attribute_id) { $query = "SELECT " . $db->quoteName('image_id') . " FROM " . $db->quoteName('#__jeproshop_product_attribute_image') . " WHERE product_attribute_id = " . (int) $product->product_attribute_id; $db->setQuery($query); $image = $db->loadObject(); } if (!isset($image->image_id)) { $query = "SELECT " . $db->quoteName('image_id') . " FROM " . $db->quoteName('#__jeproshop_image') . " WHERE " . $db->quoteName('product_id') . " = " . (int) $product->product_id . " AND cover = 1 "; $db->setQuery($query); $image = $db->loadObject(); } $product_obj = new JeproshopProductModelProduct($product->product_id); $product->qty_in_stock = JeproshopStockAvailableModelStockAvailable::getQuantityAvailableByProduct($product->product_id, isset($product->product_attribute_id) ? $product->product_attribute_id : null, (int) $shop_id); $image_product = new JeproshopImageModelImage($image->image_id); $product->image = isset($image->image_id) ? JeproshopImageManager::thumbnail(COM_JEPROSHOP_IMAGE_DIR . 'products/' . $image_product->getExistingImagePath() . '.jpg', 'product_mini_' . (int) $product->product_id . (isset($product->product_attribute_id) ? '_' . (int) $product->product_attribute_id : '') . '.jpg', 45, 'jpg') : '--'; } /*$helper = new HelperKpi(); $helper->id = 'box-kpi-cart'; $helper->icon = 'icon-shopping-cart'; $helper->color = 'color1'; $helper->title = $this->l('Total Cart', null, null, false); $helper->subtitle = sprintf($this->l('Cart #%06d', null, null, false), $cart->id); $helper->value = Tools::displayPrice($total_price, $currency); $kpi = $helper->generate(); */ //$this->assignRef('kpi', $kpi); $this->assignRef('products', $products); $discounts = $this->cart->getCartRules(); $this->assignRef('discounts', $discounts); $this->assignRef('order', $order); $this->assignRef('currency', $currency); $this->assignRef('customer', $customer); $customerStats = $customer->getStats(); $this->assignRef('customer_stats', $customerStats); $this->assignRef('total_products', $total_products); $this->assignRef('total_discounts', $total_discounts); $this->assignRef('total_wrapping', $total_wrapping); $this->assignRef('total_price', $total_price); $this->assignRef('total_shipping', $total_shipping); $this->assignRef('customized_datas', $customized_datas); if ($this->getLayout() != 'modal') { $this->addToolBar(); $this->sideBar = JHtmlSidebar::render(); } parent::display($tpl); }