コード例 #1
0
 private function isOrderReady($order_id)
 {
     $order = $this->modelSaleOrder->getOrder($order_id);
     return $order['order_status_id'] == ORDER_STATUS_READY_TO_SHIP;
     $items = $this->model_sale_order->getOrderProducts($order_id);
     $isReady = true;
     $flagReady = false;
     foreach ($items as $index => $item) {
         if ($item['status_id'] == 327683) {
             $flagReady = true;
         } else {
             if ($item['status_id'] == 327684 || $item['status_id'] == 327686 || $item['status_id'] == 327780 || $item['status_id'] == 327781 || $item['status_id'] >= 393217 && $item['status_id'] != 393219 && $item['status_id'] != 393223) {
                 $isReady = $isReady & true;
             } else {
                 $isReady = $isReady & false;
             }
         }
     }
     return $flagReady && $isReady;
 }
コード例 #2
0
ファイル: order.php プロジェクト: ralfeus/moomi-daeri.com
 public function info()
 {
     if (isset($this->request->get['order_id'])) {
         $order_id = $this->request->get['order_id'];
     } else {
         $order_id = 0;
     }
     //		$this->modelSaleOrder->updateOrderTotals($order_id);
     $order_info = $this->modelSaleOrder->getOrder($order_id);
     if ($order_info) {
         $this->document->setTitle($this->language->get('heading_title'));
         $this->data['heading_title'] = $this->language->get('heading_title');
         $this->data['text_order_id'] = $this->language->get('text_order_id');
         $this->data['text_invoice_no'] = $this->language->get('text_invoice_no');
         $this->data['text_invoice_date'] = $this->language->get('text_invoice_date');
         $this->data['text_store_name'] = $this->language->get('text_store_name');
         $this->data['text_store_url'] = $this->language->get('text_store_url');
         $this->data['text_customer'] = $this->language->get('text_customer');
         $this->data['text_customer_group'] = $this->language->get('text_customer_group');
         $this->data['text_email'] = $this->language->get('text_email');
         $this->data['text_ip'] = $this->language->get('text_ip');
         $this->data['text_telephone'] = $this->language->get('text_telephone');
         $this->data['text_fax'] = $this->language->get('text_fax');
         $this->data['text_total'] = $this->language->get('text_total');
         $this->data['text_reward'] = $this->language->get('text_reward');
         $this->data['text_order_status'] = $this->language->get('text_order_status');
         $this->data['text_comment'] = $this->language->get('text_comment');
         $this->data['text_affiliate'] = $this->language->get('text_affiliate');
         $this->data['text_commission'] = $this->language->get('text_commission');
         $this->data['text_date_added'] = $this->language->get('text_date_added');
         $this->data['text_date_modified'] = $this->language->get('text_date_modified');
         $this->data['text_firstname'] = $this->language->get('text_firstname');
         $this->data['text_lastname'] = $this->language->get('text_lastname');
         $this->data['text_company'] = $this->language->get('text_company');
         $this->data['text_phone'] = $this->language->get('text_phone');
         $this->data['text_address_1'] = $this->language->get('text_address_1');
         $this->data['text_address_2'] = $this->language->get('text_address_2');
         $this->data['text_city'] = $this->language->get('text_city');
         $this->data['text_postcode'] = $this->language->get('text_postcode');
         $this->data['text_zone'] = $this->language->get('text_zone');
         $this->data['text_zone_code'] = $this->language->get('text_zone_code');
         $this->data['text_country'] = $this->language->get('text_country');
         $this->data['text_shipping_method'] = $this->language->get('text_shipping_method');
         $this->data['text_payment_method'] = $this->language->get('text_payment_method');
         $this->data['text_download'] = $this->language->get('text_download');
         $this->data['text_wait'] = $this->language->get('text_wait');
         $this->data['text_create_invoice_no'] = $this->language->get('text_create_invoice_no');
         $this->data['text_reward_add'] = $this->language->get('text_reward_add');
         $this->data['text_reward_remove'] = $this->language->get('text_reward_remove');
         $this->data['text_commission_add'] = $this->language->get('text_commission_add');
         $this->data['text_commission_remove'] = $this->language->get('text_commission_remove');
         $this->data['text_credit_add'] = $this->language->get('text_credit_add');
         $this->data['text_credit_remove'] = $this->language->get('text_credit_remove');
         $this->data['column_product'] = $this->language->get('column_product');
         $this->data['column_model'] = $this->language->get('column_model');
         $this->data['column_quantity'] = $this->language->get('column_quantity');
         $this->data['column_price'] = $this->language->get('column_price');
         $this->data['column_total'] = $this->language->get('column_total');
         $this->data['column_download'] = $this->language->get('column_download');
         $this->data['column_filename'] = $this->language->get('column_filename');
         $this->data['column_remaining'] = $this->language->get('column_remaining');
         $this->data['entry_order_status'] = $this->language->get('entry_order_status');
         $this->data['entry_notify'] = $this->language->get('entry_notify');
         $this->data['entry_comment'] = $this->language->get('entry_comment');
         $this->data['button_invoice'] = $this->language->get('button_invoice');
         $this->data['button_cancel'] = $this->language->get('button_cancel');
         $this->data['button_add_history'] = $this->language->get('button_add_history');
         $this->data['tab_order'] = $this->language->get('tab_order');
         $this->data['tab_payment'] = $this->language->get('tab_payment');
         $this->data['tab_shipping'] = $this->language->get('tab_shipping');
         $this->data['tab_product'] = $this->language->get('tab_product');
         $this->data['tab_order_history'] = $this->language->get('tab_order_history');
         $this->data['token'] = $this->session->data['token'];
         $url = '';
         if (isset($this->request->get['filter_order_id'])) {
             $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
         }
         if (isset($this->request->get['filter_customer'])) {
             $url .= '&filter_customer=' . $this->request->get['filter_customer'];
         }
         if (isset($this->request->get['filter_order_status_id'])) {
             $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
         }
         if (isset($this->request->get['filter_total'])) {
             $url .= '&filter_total=' . $this->request->get['filter_total'];
         }
         if (isset($this->request->get['filter_date_added'])) {
             $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
         }
         if (isset($this->request->get['filter_date_modified'])) {
             $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
         }
         if (isset($this->request->get['sort'])) {
             $url .= '&sort=' . $this->request->get['sort'];
         }
         if (isset($this->request->get['order'])) {
             $url .= '&order=' . $this->request->get['order'];
         }
         if (isset($this->request->get['page'])) {
             $url .= '&page=' . $this->request->get['page'];
         }
         $this->data['breadcrumbs'] = array();
         $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'), 'separator' => false);
         $this->data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link('sale/order', 'token=' . $this->session->data['token'], 'SSL'), 'separator' => ' :: ');
         $this->data['invoice'] = $this->url->link('sale/order/invoice', 'token=' . $this->session->data['token'] . '&order_id=' . (int) $this->request->get['order_id'], 'SSL');
         $this->data['cancel'] = $this->url->link('sale/order', 'token=' . $this->session->data['token'] . $url, 'SSL');
         $this->data['order_id'] = $this->request->get['order_id'];
         if ($order_info['invoice_no']) {
             $this->data['invoice_no'] = $order_info['invoice_prefix'] . $order_info['invoice_no'];
         } else {
             $this->data['invoice_no'] = '';
         }
         $this->data['store_name'] = $order_info['store_name'];
         $this->data['store_url'] = $order_info['store_url'];
         $this->data['firstname'] = $order_info['firstname'];
         $this->data['lastname'] = $order_info['lastname'];
         if ($order_info['customer_id']) {
             $this->data['customer'] = $this->url->link('sale/customer/update', 'token=' . $this->session->data['token'] . '&customer_id=' . $order_info['customer_id'], 'SSL');
         } else {
             $this->data['customer'] = '';
         }
         $this->load->model('sale/customer_group');
         $customer_group_info = $this->model_sale_customer_group->getCustomerGroup($order_info['customer_group_id']);
         if ($customer_group_info) {
             $this->data['customer_group'] = $customer_group_info['name'];
         } else {
             $this->data['customer_group'] = '';
         }
         $this->data['email'] = $order_info['email'];
         $this->data['ip'] = $order_info['ip'];
         $this->data['telephone'] = $order_info['telephone'];
         $this->data['fax'] = $order_info['fax'];
         $this->data['comment'] = nl2br($order_info['comment']);
         $this->data['shipping_method'] = $order_info['shipping_method'];
         $this->data['payment_method'] = $order_info['payment_method'];
         $this->data['total'] = $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value']);
         $this->data['reward'] = $order_info['reward'];
         if ($order_info['total'] < 0) {
             $this->data['credit'] = $order_info['total'];
         } else {
             $this->data['credit'] = 0;
         }
         $this->data['credit_total'] = 0;
         //CustomerDAO::getInstance()->getTotalTransactionsByOrderId($this->request->get['order_id']);
         $this->data['reward_total'] = CustomerDAO::getInstance()->getTotalCustomerRewardsByOrderId($this->request->get['order_id']);
         $this->data['affiliate_firstname'] = $order_info['affiliate_firstname'];
         $this->data['affiliate_lastname'] = $order_info['affiliate_lastname'];
         if ($order_info['affiliate_id']) {
             $this->data['affiliate'] = $this->url->link('sale/affiliate/update', 'token=' . $this->session->data['token'] . '&affiliate_id=' . $order_info['affiliate_id'], 'SSL');
         } else {
             $this->data['affiliate'] = '';
         }
         $this->data['commission'] = $this->currency->format($order_info['commission'], $order_info['currency_code'], $order_info['currency_value']);
         $this->load->model('sale/affiliate');
         $this->data['commission_total'] = $this->model_sale_affiliate->getTotalTransactionsByOrderId($this->request->get['order_id']);
         $this->load->model('localisation/order_status');
         $order_status_info = $this->model_localisation_order_status->getOrderStatus($order_info['order_status_id']);
         if ($order_status_info) {
             $this->data['order_status'] = $order_status_info['name'];
         } else {
             $this->data['order_status'] = '';
         }
         $this->data['date_added'] = date($this->language->get('date_format_short'), strtotime($order_info['date_added']));
         $this->data['date_modified'] = date($this->language->get('date_format_short'), strtotime($order_info['date_modified']));
         $this->data['payment_firstname'] = $order_info['payment_firstname'];
         $this->data['payment_lastname'] = $order_info['payment_lastname'];
         $this->data['payment_company'] = $order_info['payment_company'];
         $this->data['payment_address_1'] = $order_info['payment_address_1'];
         $this->data['payment_address_2'] = $order_info['payment_address_2'];
         $this->data['payment_city'] = $order_info['payment_city'];
         $this->data['payment_postcode'] = $order_info['payment_postcode'];
         $this->data['payment_zone'] = $order_info['payment_zone'];
         $this->data['payment_zone_code'] = $order_info['payment_zone_code'];
         $this->data['payment_country'] = $order_info['payment_country'];
         $this->data['shipping_firstname'] = $order_info['shipping_firstname'];
         $this->data['shipping_lastname'] = $order_info['shipping_lastname'];
         $this->data['shipping_phone'] = $order_info['shipping_phone'];
         $this->data['shipping_company'] = $order_info['shipping_company'];
         $this->data['shipping_address_1'] = $order_info['shipping_address_1'];
         $this->data['shipping_address_2'] = $order_info['shipping_address_2'];
         $this->data['shipping_city'] = $order_info['shipping_city'];
         $this->data['shipping_postcode'] = $order_info['shipping_postcode'];
         $this->data['shipping_zone'] = $order_info['shipping_zone'];
         $this->data['shipping_zone_code'] = $order_info['shipping_zone_code'];
         $this->data['shipping_country'] = $order_info['shipping_country'];
         $this->data['products'] = array();
         $products = $this->modelSaleOrder->getOrderProducts($this->request->get['order_id']);
         foreach ($products as $product) {
             $option_data = array();
             $options = $this->modelSaleOrder->getOrderOptions($this->request->get['order_id'], $product['order_product_id']);
             foreach ($options as $option) {
                 if ($option['type'] != 'file') {
                     $option_data[] = array('name' => $option['name'], 'value' => $option['value'], 'type' => $option['type']);
                 } else {
                     $option_data[] = array('name' => $option['name'], 'value' => utf8_substr($option['value'], 0, strrpos($option['value'], '.')), 'type' => $option['type'], 'href' => $this->url->link('sale/order/download', 'token=' . $this->session->data['token'] . '&order_id=' . $this->request->get['order_id'] . '&order_option_id=' . $option['order_option_id'], 'SSL'));
                 }
             }
             $this->data['products'][] = array('order_product_id' => $product['order_product_id'], 'product_id' => $product['product_id'], 'name' => $product['name'], 'model' => $product['model'], 'option' => $option_data, 'quantity' => $product['quantity'], 'price' => $this->currency->format($product['price'], $order_info['currency_code'], $order_info['currency_value']), 'total' => $this->currency->format($product['total'], $order_info['currency_code'], $order_info['currency_value']), 'href' => $this->url->link('catalog/product/update', 'token=' . $this->session->data['token'] . '&product_id=' . $product['product_id'], 'SSL'));
         }
         $this->data['totals'] = $this->model_sale_order->getOrderTotals($this->request->get['order_id']);
         $this->data['coupon_products'] = 0;
         foreach ($this->data['totals'] as $v) {
             if ($v['code'] == 'coupon') {
                 $_code = explode('(', $v['title']);
                 $_code = explode(')', $_code[1]);
                 $code = $_code[0];
                 $coupon_products = $this->model_sale_order->getCouponProducts($code);
                 if ($coupon_products) {
                     $this->data['coupon_products'] = $coupon_products;
                 } else {
                     $this->data['couponed_order'] = 1;
                 }
             }
         }
         $this->data['downloads'] = array();
         $results = $this->model_sale_order->getOrderDownloads($this->request->get['order_id']);
         foreach ($results as $result) {
             $this->data['downloads'][] = array('name' => $result['name'], 'filename' => $result['mask'], 'remaining' => $result['remaining']);
         }
         $this->data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
         $this->data['order_status_id'] = $order_info['order_status_id'];
         $this->template = 'sale/order_info.tpl';
         $this->children = array('common/header', 'common/footer');
         $this->getResponse()->setOutput($this->render());
     } else {
         $this->load->language('error/not_found');
         $this->document->setTitle($this->language->get('heading_title'));
         $this->data['heading_title'] = $this->language->get('heading_title');
         $this->data['text_not_found'] = $this->language->get('text_not_found');
         $this->data['breadcrumbs'] = array();
         $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'), 'separator' => false);
         $this->data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link('error/not_found', 'token=' . $this->session->data['token'], 'SSL'), 'separator' => ' :: ');
         $this->template = 'error/not_found.tpl';
         $this->children = array('common/header', 'common/footer');
         $this->getResponse()->setOutput($this->render());
     }
 }
コード例 #3
0
ファイル: invoice.php プロジェクト: ralfeus/moomi-daeri.com
 private function showCreateForm()
 {
     //$this->log->write(print_r($this->request->request, true));
     if (!sizeof($this->parameters['selectedItems'])) {
         return;
     }
     $orderItems = OrderItemDAO::getInstance()->getOrderItems(array('selected_items' => $this->parameters['selectedItems']), null, true);
     //print_r($orderItems);
     /// Initialize interface values
     $this->data['button_action'] = $this->language->get('buttonCreate');
     $this->data['readOnly'] = "";
     /// Check whether input for invoice creation is valid
     $this->validateInput($orderItems);
     /// Prepare list
     $totalWeight = 0;
     $total = 0;
     $totalCustomerCurrency = 0;
     $orderItemIdParam = '';
     $localShipping = [];
     foreach ($orderItems as $orderItem) {
         //            $orderItemObject = new OrderItem($this->registry, $orderItem['affiliate_id'],
         //                $orderItem['affiliate_transaction_id'], $orderItem['comment'], $orderItem['customer_id'],
         //                $orderItem['customer_name'], $orderItem['customer_nick'], $orderItem['order_item_id'],
         //                $orderItem['image_path'], $orderItem['internal_model'], $orderItem['model'], $orderItem['name'],
         //                $orderItem['order_id'], $orderItem['price'], $orderItem['product_id'], $orderItem['public_comment'],
         //                $orderItem['quantity'], $orderItem['shipping'], $orderItem['status_date'], $orderItem['status_id'],
         //                $orderItem['supplier_group_id'], $orderItem['supplier_id'], $orderItem['supplier_name'], $orderItem['total'],
         //                $orderItem['weight'], $orderItem['weight_class_id']);
         $this->data['orderItems'][$orderItem->getId()] = array('id' => $orderItem->getId(), 'comment' => $orderItem->getPublicComment(), 'image_path' => $this->registry->get('model_tool_image')->getImage($orderItem->getImagePath()), 'model' => $orderItem->getModel(), 'name' => $orderItem->getName(), 'order_id' => $orderItem->getOrderId(), 'options' => OrderItemDAO::getInstance()->getOrderItemOptionsString($orderItem->getId()), 'price' => $this->getCurrency()->format($orderItem->getPrice(), $this->getConfig()->get('config_currency')), 'quantity' => $orderItem->getQuantity(), 'shipping' => $orderItem->getShippingCost(), 'subtotal' => $this->getCurrency()->format($orderItem->getPrice() * $orderItem->getQuantity() + $orderItem->getShippingCost(), $this->getConfig()->get('config_currency')), 'subtotalCustomerCurrency' => $this->getCurrency()->format($orderItem->getPrice(true) * $orderItem->getQuantity() + $orderItem->getShippingCost(true), $orderItem->getCustomer()['base_currency_code'], 1));
         $totalWeight += $this->weight->convert($orderItem->getWeight(), $orderItem->getWeightClassId(), $this->getConfig()->get('config_weight_class_id')) * $orderItem->getQuantity();
         $total += $orderItem->getPrice() * $orderItem->getQuantity();
         // + $orderItem->getShippingCost();
         $totalCustomerCurrency += $orderItem->getPrice(true) * $orderItem->getQuantity();
         // + $orderItem->getShippingCost(true);
         $orderItemIdParam .= '&orderItemId[]=' . $orderItem->getId();
         /// Calculate local shipping
         $localShipping = $this->calculateLocalShipping($orderItem, $localShipping);
     }
     /// Check whether suppliers have free shipping
     $this->checkFreeLocalShipping($localShipping, $total, $totalCustomerCurrency);
     /// Set invoice data
     $firstItemOrder = $this->modelSaleOrder->getOrder($orderItems[0]->getOrderId());
     //        $this->log->write(print_r($firstItemOrder, true));
     $customer = CustomerDAO::getInstance()->getCustomer($firstItemOrder['customer_id']);
     //        $shippingCost = \Shipping::getCost($orderItems, $firstItemOrder['shipping_method'], array('weight' => $totalWeight), $this->registry);
     $shippingCost = ShippingMethodDAO::getInstance()->getMethod(explode('.', $firstItemOrder['shipping_method'])[0])->getCost($firstItemOrder['shipping_method'], $orderItems, ['weight' => $totalWeight]);
     $this->data['comment'] = '';
     $this->data['discount'] = 0;
     $this->data['invoiceId'] = 0;
     $this->data['packageNumber'] = '';
     $this->data['shippingAddress'] = nl2br($this->getOrderAddressString($firstItemOrder)) . " (" . $firstItemOrder['shipping_phone'] . ")";
     $this->data['shippingCost'] = $this->getCurrency()->format($shippingCost, $this->getConfig()->get('config_currency'));
     $this->data['shippingCostRoute'] = $this->url->link('sale/invoice/getShippingCost', 'token=' . $this->parameters['token'] . $orderItemIdParam, 'SSL');
     $this->data['shippingMethod'] = $firstItemOrder['shipping_method'];
     $this->data['shippingMethodCode'] = $firstItemOrder['shipping_method'];
     $this->data['total'] = $this->getCurrency()->format($total, $this->getConfig()->get('config_currency'));
     $this->data['totalRaw'] = $total;
     $this->data['totalWeight'] = $totalWeight;
     $this->data['grandTotal'] = $this->getCurrency()->format($total + $shippingCost, $this->getConfig()->get('config_currency'));
     $this->data['totalCustomerCurrency'] = $this->getCurrency()->format($totalCustomerCurrency + $this->getCurrency()->convert($shippingCost, $this->getConfig()->get('config_currency'), $customer['base_currency_code']), $customer['base_currency_code'], 1);
     $this->data['shippingMethods'] = ShippingMethodDAO::getInstance()->getShippingOptions($this->getOrderAddress($firstItemOrder));
     //        $this->log->write(print_r($this->data, true));
     $this->data['customerCurrencyCode'] = $customer['base_currency_code'];
 }