public function initOrderDetails() { $this->context->controller->init(); header('Cache-Control: no-cache, must-revalidate'); header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); //$this->initContent(); $app = JFactory::getApplication(); $order_id = $app->input->get('order_id'); if (!$order_id || !JeproshopTools::isUnsignedInt($order_id)) { $this->errors[] = Tools::displayError('Order ID required'); } else { $order = new JeproshopOrderModelOrder($order_id); if (JeproshopTools::isLoadedObject($order, 'order_id') && $order->customer_id == $this->context->customer->customer_id) { $order_status_id = (int) $order->getCurrentState(); $carrier = new JeproshopCarrierModelCarrier((int) $order->carrier_id, (int) $order->lang_id); $invoiceAddress = new JeproshopAddressModelAddress((int) $order->address_invoice_id); $deliveryAddress = new JeproshopAddressModelAddress((int) $order->address_delivery_id); $invoice_address_fields = JeproshopAddressFormatModelAddressFormat::getOrderedAddressFields($invoiceAddress->country_id); $delivery_address_fields = JeproshopAddressFormatModelAddressFormat::getOrderedAddressFields($deliveryAddress->country_id); $invoiceAddressFormatValues = JeproshopAddressFormatModelAddressFormat::getFormattedAddressFieldsValues($invoiceAddress, $invoice_address_fields); $deliveryAddressFormatValues = JeproshopAddressFormatModelAddressFormat::getFormattedAddressFieldsValues($deliveryAddress, $delivery_address_fields); if ($order->total_discounts > 0) { $oldTotal = (double) ($order->total_paid - $order->total_discounts); $this->assignRef('old_total', $oldTotal); } $products = $order->getProducts(); /* DEPRECATED: customizedDatas @since 1.5 */ $customizedDatas = JeproshopProductModelProduct::getAllCustomizedDatas((int) $order->cart_id); JeproshopProductModelProduct::addCustomizationPrice($products, $customizedDatas); JeproshopOrderReturnModelOrderReturn::addReturnedQuantity($products, $order->order_id); $customer = new JeproshopCustomerModelCustomer($order->customer_id); $this->assignRef('order', $order); $isReturnable = (int) $order->isReturnable(); $this->assignRef('return_allowed', $isReturnable); $this->assignRef('currency', new JeproshopCurrencyModelCurrency($order->currency_id)); $order_status_id = (int) $order_status_id; $this->assignRef('order_status_id', $order_status_id); $invoiceAllowed = (int) JeproshopSettingModelSetting::getValue('invoice_allowed'); $this->assignRef('invoice_allowed', $invoiceAllowed); $invoice = JeproshopOrderStatusModelOrderStatus::invoiceAvailable($order_status_id) && count($order->getInvoicesCollection()); $this->assignRef('invoice', $invoice); $this->assignRef('order_history', $order->getHistory($this->context->language->lang_id, false, true)); $this->assignRef('products', $products); $this->assignRef('discounts', $order->getCartRules()); $this->assignRef('carrier', $carrier); $this->assignRef('invoice_address', $invoiceAddress); $this->assignRef('invoice_status', JeproshopTools::isLoadedObject($invoiceAddress, 'address_id') && $invoiceAddress->state_id ? new JeproshopStatusModelStatus($invoiceAddress->state_id) : false); $this->assignRef('delivery_address', $deliveryAddress); $this->assignRef('invoice_address_fields', $invoice_address_fields); $this->assignRef('delivery_address_fields', $delivery_address_fields); $this->assignRef('invoice_address_format_values', $invoiceAddressFormatValues); $this->assignRef('delivery_address_format_values', $deliveryAddressFormatValues); $this->assignRef('delivery_status', JeproshopTools::isLoadedObject($deliveryAddress, 'address_id') && $deliveryAddress->state_id ? new JeproshopStatusModelStatus($deliveryAddress->state_id) : false); $this->assignRef('messages', JeproshopCustomerMessageModelCustomerMessage::getMessagesByOrderId((int) $order->order_id, false)); $files = JeproshopProductModelProduct::CUSTOMIZE_FILE; $this->assignRef('CUSTOMIZE_FILE', $files); $text_fields = JeproshopProductModelProduct::CUSTOMIZE_TEXT_FIELD; $this->assignRef('CUSTOMIZE_TEXT_FIELD', $text_fields); //$this->assignRef('isRecyclable', JeproshopSettingModelSetting::getValue('PS_RECYCLABLE_PACK')); $this->assignRef('use_tax', JeproshopSettingModelSetting::getValue('use_tax')); $group_use_tax = JeproshopGroupModelGroup::getPriceDisplayMethod($customer->default_group_id) == COM_JEPROSHOP_TAX_INCLUDED; $this->assignRef('group_use_tax', $group_use_tax); $this->assignRef('display_price', JeproshopSettingModelSetting::getValue('display_price')); /* DEPRECATED: customizedDatas @since 1.5 */ $this->assignRef('customizedDatas', $customizedDatas); $reordering_allowed = (int) JeproshopSettingModelSetting::getValue('enable_history_reordering'); $this->assignRef('reordering_allowed', $reordering_allowed); /* $this->context->smarty->assign(array( 'deliveryState' => (Validate::isLoadedObject($addressDelivery) && $addressDelivery->state_id) ? new State($addressDelivery->id_state) : false, 'is_guest' => false, 'messages' => CustomerMessage::getMessagesByOrderId((int)($order->id), false), 'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE, 'CUSTOMIZE_TEXT_FIELD' => Product::CUSTOMIZE_TEXT_FIELD, 'isRecyclable' => Configuration::get('PS_RECYCLABLE_PACK'), 'use_tax' => Configuration::get('PS_TAX'), 'group_use_tax' => (Group::getPriceDisplayMethod($customer->default_group_id) == PS_TAX_INC), /* DEPRECATED: customizedDatas @since 1.5 * / 'customizedDatas' => $customizedDatas, /* DEPRECATED: customizedDatas @since 1.5 * / )); */ if ($carrier->url && $order->shipping_number) { $this->assignRef('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 renderStatusList($tpl = null) { $orderStatusModel = new JeproshopOrderStatusModelOrderStatus(); $orderStatusList = $orderStatusModel->getOrderStatusList(); $orderPagination = $orderStatusModel->getPagination(); $this->assignRef('orderStatusList', $orderStatusList); $this->assignRef('statues_pagination', $orderPagination); $returnStatues = $orderStatusModel->getOrderReturnStatusList(); $this->assignRef('returnStatues', $returnStatues); $this->addToolBar(); $this->sideBar = JHtmlSideBar::render(); parent::display($tpl); }