name = 'blockordersummary'; $this->tab = 'front_office_features'; $this->version = '1.0'; $this->author = 'Antadis'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->l('Order summary block'); $this->description = $this->l('Displays a summary of the current order'); } public function install() { return parent::install() && $this->registerHook('leftColumn'); } public function hookLeftColumn($params) { global $cookie, $smarty, $cart; if(($step = (int) Tools::getValue('step')) && ($step == 3 || $step == 4)) { if(Db::getInstance()->getValue(' SELECT `id_carrier` FROM `'._DB_PREFIX_.'carrier` WHERE `id_carrier` = '.(int) $cart->id_carrier.' AND `name` LIKE "%so colissimo%" ')) { $socol = Db::getInstance()->getRow(' SELECT * FROM `'._DB_PREFIX_.'socolissimo_delivery_info` WHERE `id_cart` = '.(int) $cart->id.' '); if($socol) { $order_address = nl2br(preg_replace("/(\r\n){2,}/", "\r\n", implode("\r\n", array( $socol['cefirstname'].' '.$socol['cename'], $socol['cecompanyname'], $socol['prfirstname'].' '.$socol['prname'], $socol['prcompladress'], $socol['pradress1'], $socol['pradress2'], $socol['pradress3'], $socol['pradress4'], $socol['przipcode'].' '.$socol['prtown'], 'FRANCE', $socol['cephonenumber'], !empty($socol['cedoorcode1'])? 'Code porte 1 : '.$socol['cedoorcode1']: '', !empty($socol['cedoorcode2'])? 'Code porte 2 : '.$socol['cedoorcode2']: '', $socol['cedeliveryinformation'], )))); } else { $order_address = nl2br(AddressFormat::generateAddress(new Address((int) $cart->id_address_delivery))); } } else { $order_address = nl2br(AddressFormat::generateAddress(new Address((int) $cart->id_address_delivery))); } $carrier_name = Db::getInstance()->getValue(' SELECT `name` FROM `'._DB_PREFIX_.'carrier` WHERE `id_carrier` = '.(int) $cart->id_carrier.' '); $products_keys = array(); $products_delays = array(); $products = $cart->getProducts(); $i = 0; foreach($products as $product) { $products_keys[(int) $product['id_product']] = $i; $i++; } if(count($products_keys) > 0) { foreach(Db::getInstance()->ExecuteS(' SELECT l.`id_delay`, l.`name`, c.`id_product` FROM `'._DB_PREFIX_.'privatesale_delay_sale` s LEFT JOIN `'._DB_PREFIX_.'privatesale_delay_lang` l ON s.`id_delay` = l.`id_delay` LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c ON s.`id_sale` = c.`id_sale` WHERE l.`id_lang` = '.(int) $cookie->id_lang.' AND s.`id_lang` = '.(int) $cookie->id_lang.' AND c.`id_product` IN ('.implode(', ', array_keys($products_keys)).') GROUP BY c.`id_product` ORDER BY l.`value` ASC ') as $row) { if(!isset($products_delays[$row['name']])) { $products_delays[$row['name']] = array(); } $products_delays[$row['name']][] = $products_keys[(int) $row['id_product']]; } } $smarty->assign(array( 'order_address' => $order_address, 'carrier_name' => $carrier_name, 'products_delays' => $products_delays, )); return $this->display(__FILE__, 'blockordersummary.tpl'); } } public function hookRightColumn($params) { return $this->hookLeftColumn($params); } }