示例#1
0
 public static function getHistory($orders)
 {
     $history = array();
     foreach ($orders as $orderData) {
         $order = new Order($orderData['id_order']);
         $currency = new Currency($order->id_currency);
         $status = $order->getCurrentStateFull(Context::getContext()->language->id);
         $history[] = array('id' => $order->id_cart, 'amount' => self::formatDecimals($order->getTotalPaid()), 'due' => self::formatDecimals($order->getTotalPaid()), 'status' => $status['name'], 'type' => $order->module, 'order_date' => date(DATE_ISO8601, strtotime($order->date_add)), 'currency' => $currency->iso_code, 'billing' => self::getAddress(new Address($order->id_address_invoice)), 'shipping' => self::checkoutShipping($order));
     }
     return $history;
 }
 /**
  * Loads the order status data from the order model.
  *
  * @param Order $order the model.
  */
 public function loadData(Order $order)
 {
     // We prefer to use the English state name for the status code, as we use it as an unique identifier of that
     // particular order status. The status label will primarily be in the language of the order.
     $id_lang = (int) Language::getIdByIso('en');
     if (empty($id_lang)) {
         $id_lang = (int) $order->id_lang;
     }
     $state = $order->getCurrentStateFull($id_lang);
     if (!empty($state['name'])) {
         $state_name = $state['name'];
         $this->code = $this->convertNameToCode($state_name);
         if ($id_lang !== (int) $order->id_lang) {
             $state = $order->getCurrentStateFull((int) $order->id_lang);
             if (!empty($state['name'])) {
                 $state_name = $state['name'];
             }
         }
         $this->label = $state_name;
     }
 }
 public function hookPaymentReturn($params)
 {
     global $cookie;
     global $smarty;
     $order_id = (int) Tools::getValue('id_order');
     $order = new Order($order_id);
     $state = $order->getCurrentStateFull((int) $cookie->id_lang);
     $carrier = new Carrier($order->id_carrier, (int) $cookie->id_lang);
     $smarty->assign(array('order' => $order, 'total_paid' => Tools::displayPrice($order->total_paid), 'state' => $state, 'carrier' => $carrier, 'order_id_formatted' => sprintf('#%06d', $order_id)));
     return $this->_fetchTemplate('views/templates/hook/payment_return.tpl');
 }
示例#4
0
 public function getHistory(Customer $customer, $limit)
 {
     $history_collection = Db::getInstance()->executeS('SELECT * FROM ' . _DB_PREFIX_ . 'orders ' . ' WHERE id_customer = ' . $customer->id . ' ' . ' ORDER BY id_order DESC LIMIT ' . $limit);
     $history = array();
     foreach ($history_collection as $order_history) {
         $Order = new Order($order_history['id_order']);
         $Currency = new Currency($Order->id_currency);
         $currency = $Currency->iso_code;
         $BillingAddress = new Address($Order->id_address_invoice);
         $status = $Order->getCurrentStateFull(Context::getContext()->language->id);
         $history[] = array("id" => $Order->id_cart, "amount" => static::formatDecimals($this->_orderTotal($Order)), "due" => static::formatDecimals($this->_orderTotal($Order)), "status" => $status['name'], "type" => $Order->module, "order_date" => date(DATE_ISO8601, strtotime($Order->date_add)), "currency" => $currency, "billing" => $this->_getAddr($BillingAddress), "shipping" => $this->getShipping($Order));
     }
     return $history;
 }
 public function hookPaymentReturn($params)
 {
     $order_id = Tools::getValue('id_order');
     $order = new Order($order_id);
     $state = $order->getCurrentStateFull($this->context->language->id);
     $carrier = new Carrier($order->id_carrier, $this->context->language->id);
     $this->smarty->assign(array('order' => $order, 'total_paid' => Tools::displayPrice($order->total_paid_tax_incl), 'state' => $state, 'carrier' => $carrier, 'order_id_formatted' => sprintf('#%06d', $order_id)));
     return $this->_fetchTemplate('views/templates/hook/payment_return.tpl');
 }