/** * Assign template vars related to page content * @see FrontController::initContent() */ public function initContent() { parent::initContent(); if (!($id_order = (int) Tools::getValue('id_order')) || !Validate::isUnsignedId($id_order)) { $this->errors[] = Tools::displayError('Order ID required'); } else { $order = new Order($id_order); if (Validate::isLoadedObject($order) && $order->id_customer == $this->context->customer->id) { $id_order_state = (int) $order->getCurrentState(); $carrier = new Carrier((int) $order->id_carrier, (int) $order->id_lang); $addressInvoice = new Address((int) $order->id_address_invoice); $addressDelivery = new Address((int) $order->id_address_delivery); $inv_adr_fields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country); $dlv_adr_fields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country); $invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressInvoice, $inv_adr_fields); $deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressDelivery, $dlv_adr_fields); if ($order->total_discounts > 0) { $this->context->smarty->assign('total_old', (double) $order->total_paid - $order->total_discounts); } $products = $order->getProducts(); /* DEPRECATED: customizedDatas @since 1.5 */ $customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart); Product::addCustomizationPrice($products, $customizedDatas); OrderReturn::addReturnedQuantity($products, $order->id); $order_status = new OrderState((int) $id_order_state, (int) $order->id_lang); $customer = new Customer($order->id_customer); //by webkul to show order details properly on order history page if (Module::isInstalled('hotelreservationsystem')) { require_once _PS_MODULE_DIR_ . 'hotelreservationsystem/define.php'; $obj_cart_bk_data = new HotelCartBookingData(); $obj_htl_bk_dtl = new HotelBookingDetail(); $obj_rm_type = new HotelRoomType(); if (!empty($products)) { foreach ($products as $type_key => $type_value) { $product = new Product($type_value['product_id'], false, $this->context->language->id); $cover_image_arr = $product->getCover($type_value['product_id']); if (!empty($cover_image_arr)) { $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id . '-' . $cover_image_arr['id_image'], 'small_default'); } else { $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code . "-default", 'small_default'); } $unit_price = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1); if (isset($customer->id)) { $cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($order->id_cart, (new Cart($order->id_cart))->id_guest, $type_value['product_id'], $customer->id); } else { $cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($order->id_cart, $customer->id_guest, $type_value['product_id']); } $rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id']); $cart_htl_data[$type_key]['id_product'] = $type_value['product_id']; $cart_htl_data[$type_key]['cover_img'] = $cover_img; $cart_htl_data[$type_key]['name'] = $product->name; $cart_htl_data[$type_key]['unit_price'] = $unit_price; $cart_htl_data[$type_key]['adult'] = $rm_dtl['adult']; $cart_htl_data[$type_key]['children'] = $rm_dtl['children']; foreach ($cart_bk_data as $data_k => $data_v) { $date_join = strtotime($data_v['date_from']) . strtotime($data_v['date_to']); if (isset($cart_htl_data[$type_key]['date_diff'][$date_join])) { $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] += 1; $num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days']; $vart_quant = (int) $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] * $num_days; $amount = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1); $amount *= $vart_quant; $cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $amount; } else { $num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']); $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1; $cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from']; $cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to']; $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days; $amount = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1); $amount *= $num_days; $cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $amount; } } } $this->context->smarty->assign('cart_htl_data', $cart_htl_data); } } //end $this->context->smarty->assign(array('shop_name' => strval(Configuration::get('PS_SHOP_NAME')), 'order' => $order, 'return_allowed' => (int) $order->isReturnable(), 'currency' => new Currency($order->id_currency), 'order_state' => (int) $id_order_state, 'invoiceAllowed' => (int) Configuration::get('PS_INVOICE'), 'invoice' => OrderState::invoiceAvailable($id_order_state) && count($order->getInvoicesCollection()), 'logable' => (bool) $order_status->logable, 'order_history' => $order->getHistory($this->context->language->id, false, true), 'products' => $products, 'discounts' => $order->getCartRules(), 'carrier' => $carrier, 'address_invoice' => $addressInvoice, 'invoiceState' => Validate::isLoadedObject($addressInvoice) && $addressInvoice->id_state ? new State($addressInvoice->id_state) : false, 'address_delivery' => $addressDelivery, 'inv_adr_fields' => $inv_adr_fields, 'dlv_adr_fields' => $dlv_adr_fields, 'invoiceAddressFormatedValues' => $invoiceAddressFormatedValues, 'deliveryAddressFormatedValues' => $deliveryAddressFormatedValues, 'deliveryState' => Validate::isLoadedObject($addressDelivery) && $addressDelivery->id_state ? new State($addressDelivery->id_state) : false, 'is_guest' => false, 'messages' => CustomerMessage::getMessagesByOrderId((int) $order->id, false), 'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE, 'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD, 'isRecyclable' => Configuration::get('PS_RECYCLABLE_PACK'), 'use_tax' => Configuration::get('PS_TAX'), 'group_use_tax' => Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC, 'customizedDatas' => $customizedDatas, 'reorderingAllowed' => !(bool) Configuration::get('PS_DISALLOW_HISTORY_REORDERING'))); if ($carrier->url && $order->shipping_number) { $this->context->smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url)); } $this->context->smarty->assign('HOOK_ORDERDETAILDISPLAYED', Hook::exec('displayOrderDetail', array('order' => $order))); Hook::exec('actionOrderDetail', array('carrier' => $carrier, 'order' => $order)); unset($carrier, $addressInvoice, $addressDelivery); } else { $this->errors[] = Tools::displayError('This order cannot be found.'); } unset($order); } $this->setTemplate(_PS_THEME_DIR_ . 'order-detail.tpl'); }
/** * Assign template vars related to page content * @see FrontController::initContent() */ public function initContent() { parent::initContent(); if (!($id_order = (int) Tools::getValue('id_order')) || !Validate::isUnsignedId($id_order)) { $this->errors[] = Tools::displayError('Order ID required'); } else { $order = new Order($id_order); if (Validate::isLoadedObject($order) && $order->id_customer == $this->context->customer->id) { $id_order_state = (int) $order->getCurrentState(); $carrier = new Carrier((int) $order->id_carrier, (int) $order->id_lang); $addressInvoice = new Address((int) $order->id_address_invoice); $addressDelivery = new Address((int) $order->id_address_delivery); $inv_adr_fields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country); $dlv_adr_fields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country); $invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressInvoice, $inv_adr_fields); $deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressDelivery, $dlv_adr_fields); if ($order->total_discounts > 0) { $this->context->smarty->assign('total_old', (double) ($order->total_paid - $order->total_discounts)); } $products = $order->getProducts(); /* DEPRECATED: customizedDatas @since 1.5 */ $customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart); Product::addCustomizationPrice($products, $customizedDatas); OrderReturn::addReturnedQuantity($products, $order->id); $customer = new Customer($order->id_customer); $this->context->smarty->assign(array('shop_name' => strval(Configuration::get('PS_SHOP_NAME')), 'order' => $order, 'return_allowed' => (int) $order->isReturnable(), 'currency' => new Currency($order->id_currency), 'order_state' => (int) $id_order_state, 'invoiceAllowed' => (int) Configuration::get('PS_INVOICE'), 'invoice' => OrderState::invoiceAvailable($id_order_state) && count($order->getInvoicesCollection()), 'order_history' => $order->getHistory($this->context->language->id, false, true), 'products' => $products, 'discounts' => $order->getCartRules(), 'carrier' => $carrier, 'address_invoice' => $addressInvoice, 'invoiceState' => Validate::isLoadedObject($addressInvoice) && $addressInvoice->id_state ? new State($addressInvoice->id_state) : false, 'address_delivery' => $addressDelivery, 'inv_adr_fields' => $inv_adr_fields, 'dlv_adr_fields' => $dlv_adr_fields, 'invoiceAddressFormatedValues' => $invoiceAddressFormatedValues, 'deliveryAddressFormatedValues' => $deliveryAddressFormatedValues, 'deliveryState' => Validate::isLoadedObject($addressDelivery) && $addressDelivery->id_state ? new State($addressDelivery->id_state) : false, 'is_guest' => false, 'messages' => CustomerMessage::getMessagesByOrderId((int) $order->id, false), 'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE, 'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD, 'isRecyclable' => Configuration::get('PS_RECYCLABLE_PACK'), 'use_tax' => Configuration::get('PS_TAX'), 'group_use_tax' => Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC, 'customizedDatas' => $customizedDatas)); if ($carrier->url && $order->shipping_number) { $this->context->smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url)); } $this->context->smarty->assign('HOOK_ORDERDETAILDISPLAYED', Hook::exec('displayOrderDetail', array('order' => $order))); Hook::exec('actionOrderDetail', array('carrier' => $carrier, 'order' => $order)); unset($carrier, $addressInvoice, $addressDelivery); } else { $this->errors[] = Tools::displayError('This order cannot be found.'); } unset($order); } $this->setTemplate(_PS_THEME_DIR_ . 'order-detail.tpl'); }
public function initContent() { ${"GLOBALS"}["wcbwhorf"] = "id_order"; parent::initContent(); if (!(${${"GLOBALS"}["tdrhijkvhp"]} = (int) Tools::getValue("id_order")) || !Validate::isUnsignedId(${${"GLOBALS"}["wcbwhorf"]})) { $this->errors[] = Tools::displayError("Order ID required"); } else { ${"GLOBALS"}["vtkcznmlk"] = "id_customer_seller"; ${"GLOBALS"}["bwkdjg"] = "id_order"; ${${"GLOBALS"}["thtbvco"]} = new Order(${${"GLOBALS"}["bwkdjg"]}); ${"GLOBALS"}["tkggscllp"] = "order"; ${${"GLOBALS"}["gfrblyem"]} = AgileSellerManager::getObjectOwnerID("order", $order->id); ${${"GLOBALS"}["taultlaseq"]} = AgileSellerManager::getLinkedSellerID($this->context->customer->id); if (Validate::isLoadedObject(${${"GLOBALS"}["thtbvco"]}) && ${${"GLOBALS"}["gfrblyem"]} == ${${"GLOBALS"}["vtkcznmlk"]} && ${${"GLOBALS"}["taultlaseq"]} > 0) { $fwsweyfqnpv = "dlv_adr_fields"; $gcjosivnd = "carrier"; ${"GLOBALS"}["pffjtshcnb"] = "deliveryAddressFormatedValues"; $uztnjfwuwsv = "customizedDatas"; $uvmwhue = "addressDelivery"; ${"GLOBALS"}["atrcjjwf"] = "carrier"; ${"GLOBALS"}["flawpcbih"] = "products"; ${${"GLOBALS"}["tthrzd"]} = (int) $order->getCurrentState(); ${$gcjosivnd} = new Carrier((int) $order->id_carrier, (int) $order->id_lang); ${"GLOBALS"}["rovfqvkjb"] = "addressDelivery"; ${${"GLOBALS"}["hoviucftx"]} = new Address((int) $order->id_address_invoice); $mjqwhmgoyrm = "customizedDatas"; ${"GLOBALS"}["qguglflbdd"] = "dlv_adr_fields"; $sitqckqhoebi = "inv_adr_fields"; $vejelhbyrbl = "addressDelivery"; ${"GLOBALS"}["zpyvneijb"] = "addressInvoice"; $tsvbkseunn = "dlv_adr_fields"; ${"GLOBALS"}["cdlqrupc"] = "inv_adr_fields"; ${${"GLOBALS"}["rovfqvkjb"]} = new Address((int) $order->id_address_delivery); ${$sitqckqhoebi} = AddressFormat::getOrderedAddressFields($addressInvoice->id_country); $shfzuivbjgg = "inv_adr_fields"; ${${"GLOBALS"}["qguglflbdd"]} = AddressFormat::getOrderedAddressFields($addressDelivery->id_country); ${${"GLOBALS"}["elucej"]} = AddressFormat::getFormattedAddressFieldsValues(${${"GLOBALS"}["hoviucftx"]}, ${$shfzuivbjgg}); ${${"GLOBALS"}["pffjtshcnb"]} = AddressFormat::getFormattedAddressFieldsValues(${${"GLOBALS"}["gkxhkddsjf"]}, ${$fwsweyfqnpv}); $tbfgtqy = "order"; if ($order->total_discounts > 0) { $this->context->smarty->assign("total_old", (double) ($order->total_paid - $order->total_discounts)); } ${"GLOBALS"}["ikavgzhqpt"] = "deliveryAddressFormatedValues"; ${${"GLOBALS"}["flawpcbih"]} = $order->getProducts(); ${${"GLOBALS"}["gdodxcerle"]} = Product::getAllCustomizedDatas((int) $order->id_cart); Product::addCustomizationPrice(${${"GLOBALS"}["umrxyqn"]}, ${$mjqwhmgoyrm}); $buaccdx = "carrier"; ${${"GLOBALS"}["cdmray"]} = new Customer($order->id_customer); ${"GLOBALS"}["betrwosx"] = "products"; ${${"GLOBALS"}["bfrxhizen"]} = $order->getCurrentOrderState(); ${${"GLOBALS"}["sslziuxrs"]} = OrderState::getOrderStates((int) $this->context->language->id); ${"GLOBALS"}["bwcmquq"] = "addressInvoice"; $this->context->smarty->assign(array("order_states" => ${${"GLOBALS"}["sslziuxrs"]})); $this->context->smarty->assign(array("shop_name" => strval(Configuration::get("PS_SHOP_NAME")), "order" => ${${"GLOBALS"}["thtbvco"]}, "return_allowed" => (int) $order->isReturnable(), "currency" => new Currency($order->id_currency), "order_cur_state" => (int) ${${"GLOBALS"}["tthrzd"]}, "invoiceAllowed" => (int) Configuration::get("PS_INVOICE"), "invoice" => OrderState::invoiceAvailable(${${"GLOBALS"}["tthrzd"]}) && $order->invoice_number, "order_history" => $order->getHistory($this->context->language->id, false, true), "products" => ${${"GLOBALS"}["betrwosx"]}, "discounts" => $order->getCartRules(), "carrier" => ${${"GLOBALS"}["atrcjjwf"]}, "address_invoice" => ${${"GLOBALS"}["bwcmquq"]}, "invoiceState" => Validate::isLoadedObject(${${"GLOBALS"}["zpyvneijb"]}) && $addressInvoice->id_state ? new State($addressInvoice->id_state) : false, "address_delivery" => ${$uvmwhue}, "inv_adr_fields" => ${${"GLOBALS"}["cdlqrupc"]}, "dlv_adr_fields" => ${$tsvbkseunn}, "invoiceAddressFormatedValues" => ${${"GLOBALS"}["elucej"]}, "deliveryAddressFormatedValues" => ${${"GLOBALS"}["ikavgzhqpt"]}, "deliveryState" => Validate::isLoadedObject(${${"GLOBALS"}["gkxhkddsjf"]}) && $addressDelivery->id_state ? new State($addressDelivery->id_state) : false, "is_guest" => false, "messages" => CustomerMessage::getMessagesByOrderId((int) $order->id, false), "CUSTOMIZE_FILE" => Product::CUSTOMIZE_FILE, "CUSTOMIZE_TEXTFIELD" => Product::CUSTOMIZE_TEXTFIELD, "isRecyclable" => Configuration::get("PS_RECYCLABLE_PACK"), "use_tax" => Configuration::get("PS_TAX"), "group_use_tax" => Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC, "customizedDatas" => ${$uztnjfwuwsv})); if ($carrier->url && $order->shipping_number) { $this->context->smarty->assign("followup", str_replace("@", $order->shipping_number, $carrier->url)); } $this->context->smarty->assign("HOOK_ORDERDETAILDISPLAYED", Hook::exec("displayOrderDetail", array("order" => ${${"GLOBALS"}["thtbvco"]}))); Hook::exec("actionOrderDetail", array("carrier" => ${${"GLOBALS"}["tvqrewgc"]}, "order" => ${$tbfgtqy})); unset(${$buaccdx}, ${${"GLOBALS"}["hoviucftx"]}, ${$vejelhbyrbl}); } else { $this->errors[] = Tools::displayError("Cannot find this order"); } unset(${${"GLOBALS"}["tkggscllp"]}); } self::$smarty->assign(array("seller_tab_id" => 4)); $this->setTemplate("sellerorderdetail.tpl"); }