name = 'blockcart'; $this->tab = 'Blocks'; $this->version = '1.2'; parent::__construct(); $this->displayName = $this->l('Cart block'); $this->description = $this->l('Adds a block containing the customer\'s shopping cart'); } public function smartyAssigns(&$smarty, &$params) { global $errors, $cookie; // Set currency if (!intval($params['cart']->id_currency)) $currency = new Currency(intval($params['cookie']->id_currency)); else $currency = new Currency(intval($params['cart']->id_currency)); if (!Validate::isLoadedObject($currency)) $currency = new Currency(intval(Configuration::get('PS_CURRENCY_DEFAULT'))); if ($params['cart']->id_customer) { $customer = new Customer(intval($params['cart']->id_customer)); $taxCalculationMethod = Group::getPriceDisplayMethod(intval($customer->id_default_group)); } else $taxCalculationMethod = Group::getDefaultPriceDisplayMethod(); $usetax = $taxCalculationMethod == PS_TAX_EXC ? false : true; $products = $params['cart']->getProducts(true); $nbTotalProducts = 0; foreach ($products AS $product) $nbTotalProducts += intval($product['cart_quantity']); $wrappingCost = floatval($params['cart']->getOrderTotal($usetax, 6)); $smarty->assign(array( 'products' => $products, 'customizedDatas' => Product::getAllCustomizedDatas(intval($params['cart']->id)), 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'discounts' => $params['cart']->getDiscounts(false, $usetax), 'nb_total_products' => intval($nbTotalProducts), 'shipping_cost' => Tools::displayPrice($params['cart']->getOrderTotal($usetax, 5), $currency), 'show_wrapping' => $wrappingCost > 0 ? true : false, 'wrapping_cost' => Tools::displayPrice($wrappingCost, $currency), 'product_total' => Tools::displayPrice($params['cart']->getOrderTotal($usetax, 4), $currency), 'total' => Tools::displayPrice($params['cart']->getOrderTotal($usetax), $currency), 'id_carrier' => intval($params['cart']->id_carrier), 'ajax_allowed' => intval(Configuration::get('PS_BLOCK_CART_AJAX')) == 1 ? true : false )); if (sizeof($errors)) $smarty->assign('errors', $errors); if(isset($cookie->ajax_blockcart_display)) $smarty->assign('colapseExpandStatus', $cookie->ajax_blockcart_display); } public function getContent() { $output = '
'.$this->l('Settings updated').'