本文整理汇总了PHP中Message::getMessagesByOrderId方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::getMessagesByOrderId方法的具体用法?PHP Message::getMessagesByOrderId怎么用?PHP Message::getMessagesByOrderId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message::getMessagesByOrderId方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
public function preProcess()
{
parent::preProcess();
if (Tools::isSubmit('submitMessage')) {
$idOrder = (int) Tools::getValue('id_order');
$msgText = htmlentities(Tools::getValue('msgText'), ENT_COMPAT, 'UTF-8');
if (!$idOrder or !Validate::isUnsignedId($idOrder)) {
$this->errors[] = Tools::displayError('Order is no longer valid');
} elseif (empty($msgText)) {
$this->errors[] = Tools::displayError('Message cannot be blank');
} elseif (!Validate::isMessage($msgText)) {
$this->errors[] = Tools::displayError('Message is invalid (HTML is not allowed)');
}
if (!sizeof($this->errors)) {
$order = new Order((int) $idOrder);
if (Validate::isLoadedObject($order) and $order->id_customer == self::$cookie->id_customer) {
$message = new Message();
$message->id_customer = (int) self::$cookie->id_customer;
$message->message = $msgText;
$message->id_order = (int) $idOrder;
$message->private = false;
$message->add();
if (!Configuration::get('PS_MAIL_EMAIL_MESSAGE')) {
$to = strval(Configuration::get('PS_SHOP_EMAIL'));
} else {
$to = new Contact((int) Configuration::get('PS_MAIL_EMAIL_MESSAGE'));
$to = strval($to->email);
}
$toName = strval(Configuration::get('PS_SHOP_NAME'));
$customer = new Customer((int) self::$cookie->id_customer);
if (Validate::isLoadedObject($customer)) {
Mail::Send((int) self::$cookie->id_lang, 'order_customer_comment', Mail::l('Message from a customer', (int) self::$cookie->id_lang), array('{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{email}' => $customer->email, '{id_order}' => (int) $message->id_order, '{order_name}' => sprintf("#%06d", (int) $message->id_order), '{message}' => $message->message), $to, $toName, $customer->email, $customer->firstname . ' ' . $customer->lastname);
}
if (Tools::getValue('ajax') != 'true') {
Tools::redirect('order-detail.php?id_order=' . (int) $idOrder);
}
} else {
$this->errors[] = Tools::displayError('Order not found');
}
}
}
if (!($id_order = (int) Tools::getValue('id_order')) or !Validate::isUnsignedId($id_order)) {
$this->errors[] = Tools::displayError('Order ID required');
} else {
$order = new Order($id_order);
if (Validate::isLoadedObject($order) and $order->id_customer == self::$cookie->id_customer) {
$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);
// $stateInvoiceAddress = new State((int)$addressInvoice->id_state);
$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) {
self::$smarty->assign('total_old', (double) ($order->total_paid - $order->total_discounts));
}
$products = $order->getProducts();
$customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart);
Product::addCustomizationPrice($products, $customizedDatas);
$customer = new Customer($order->id_customer);
self::$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((int) $id_order_state) and $order->invoice_number, 'order_history' => $order->getHistory((int) self::$cookie->id_lang, false, true), 'products' => $products, 'discounts' => $order->getDiscounts(), 'carrier' => $carrier, 'address_invoice' => $addressInvoice, 'invoiceState' => (Validate::isLoadedObject($addressInvoice) and $addressInvoice->id_state) ? new State((int) $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) and $addressDelivery->id_state) ? new State((int) $addressDelivery->id_state) : false, 'is_guest' => false, 'messages' => Message::getMessagesByOrderId((int) $order->id), 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _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 and $order->shipping_number) {
self::$smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url));
}
self::$smarty->assign('HOOK_ORDERDETAILDISPLAYED', Module::hookExec('orderDetailDisplayed', array('order' => $order)));
Module::hookExec('OrderDetail', array('carrier' => $carrier, 'order' => $order));
unset($carrier);
unset($addressInvoice);
unset($addressDelivery);
} else {
$this->errors[] = Tools::displayError('Cannot find this order');
}
unset($order);
}
}
示例2: renderView
public function renderView()
{
$order = new Order(Tools::getValue('id_order'));
if (!Validate::isLoadedObject($order)) {
$this->errors[] = Tools::displayError('The order cannot be found within your database.');
}
$customer = new Customer($order->id_customer);
$carrier = new Carrier($order->id_carrier);
$products = $this->getProducts($order);
$currency = new Currency((int) $order->id_currency);
// Carrier module call
$carrier_module_call = null;
if ($carrier->is_module) {
$module = Module::getInstanceByName($carrier->external_module_name);
if (method_exists($module, 'displayInfoByCart')) {
$carrier_module_call = call_user_func(array($module, 'displayInfoByCart'), $order->id_cart);
}
}
// Retrieve addresses information
$addressInvoice = new Address($order->id_address_invoice, $this->context->language->id);
if (Validate::isLoadedObject($addressInvoice) && $addressInvoice->id_state) {
$invoiceState = new State((int) $addressInvoice->id_state);
}
if ($order->id_address_invoice == $order->id_address_delivery) {
$addressDelivery = $addressInvoice;
if (isset($invoiceState)) {
$deliveryState = $invoiceState;
}
} else {
$addressDelivery = new Address($order->id_address_delivery, $this->context->language->id);
if (Validate::isLoadedObject($addressDelivery) && $addressDelivery->id_state) {
$deliveryState = new State((int) $addressDelivery->id_state);
}
}
$this->toolbar_title = sprintf($this->l('Order #%1$d (%2$s) - %3$s %4$s'), $order->id, $order->reference, $customer->firstname, $customer->lastname);
if (Shop::isFeatureActive()) {
$shop = new Shop((int) $order->id_shop);
$this->toolbar_title .= ' - ' . sprintf($this->l('Shop: %s'), $shop->name);
}
// gets warehouses to ship products, if and only if advanced stock management is activated
$warehouse_list = null;
$order_details = $order->getOrderDetailList();
foreach ($order_details as $order_detail) {
$product = new Product($order_detail['product_id']);
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && $product->advanced_stock_management) {
$warehouses = Warehouse::getWarehousesByProductId($order_detail['product_id'], $order_detail['product_attribute_id']);
foreach ($warehouses as $warehouse) {
if (!isset($warehouse_list[$warehouse['id_warehouse']])) {
$warehouse_list[$warehouse['id_warehouse']] = $warehouse;
}
}
}
}
$payment_methods = array();
foreach (PaymentModule::getInstalledPaymentModules() as $payment) {
$module = Module::getInstanceByName($payment['name']);
if (Validate::isLoadedObject($module) && $module->active) {
$payment_methods[] = $module->displayName;
}
}
// display warning if there are products out of stock
$display_out_of_stock_warning = false;
$current_order_state = $order->getCurrentOrderState();
if (Configuration::get('PS_STOCK_MANAGEMENT') && (!Validate::isLoadedObject($current_order_state) || $current_order_state->delivery != 1 && $current_order_state->shipped != 1)) {
$display_out_of_stock_warning = true;
}
// products current stock (from stock_available)
foreach ($products as &$product) {
$product['current_stock'] = StockAvailable::getQuantityAvailableByProduct($product['product_id'], $product['product_attribute_id'], $product['id_shop']);
$resume = OrderSlip::getProductSlipResume($product['id_order_detail']);
$product['quantity_refundable'] = $product['product_quantity'] - $resume['product_quantity'];
$product['amount_refundable'] = $product['total_price_tax_incl'] - $resume['amount_tax_incl'];
$product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl'], $currency);
$product['refund_history'] = OrderSlip::getProductSlipDetail($product['id_order_detail']);
$product['return_history'] = OrderReturn::getProductReturnDetail($product['id_order_detail']);
// if the current stock requires a warning
if ($product['current_stock'] == 0 && $display_out_of_stock_warning) {
$this->displayWarning($this->l('This product is out of stock: ') . ' ' . $product['product_name']);
}
if ($product['id_warehouse'] != 0) {
$warehouse = new Warehouse((int) $product['id_warehouse']);
$product['warehouse_name'] = $warehouse->name;
} else {
$product['warehouse_name'] = '--';
}
}
$gender = new Gender((int) $customer->id_gender, $this->context->language->id);
$history = $order->getHistory($this->context->language->id);
foreach ($history as &$order_state) {
$order_state['text-color'] = Tools::getBrightness($order_state['color']) < 128 ? 'white' : 'black';
}
// Smarty assign
$this->tpl_view_vars = array('order' => $order, 'cart' => new Cart($order->id_cart), 'customer' => $customer, 'gender' => $gender, 'customer_addresses' => $customer->getAddresses($this->context->language->id), 'addresses' => array('delivery' => $addressDelivery, 'deliveryState' => isset($deliveryState) ? $deliveryState : null, 'invoice' => $addressInvoice, 'invoiceState' => isset($invoiceState) ? $invoiceState : null), 'customerStats' => $customer->getStats(), 'products' => $products, 'discounts' => $order->getCartRules(), 'orders_total_paid_tax_incl' => $order->getOrdersTotalPaid(), 'total_paid' => $order->getTotalPaid(), 'returns' => OrderReturn::getOrdersReturn($order->id_customer, $order->id), 'customer_thread_message' => CustomerThread::getCustomerMessages($order->id_customer), 'orderMessages' => OrderMessage::getOrderMessages($order->id_lang), 'messages' => Message::getMessagesByOrderId($order->id, true), 'carrier' => new Carrier($order->id_carrier), 'history' => $history, 'states' => OrderState::getOrderStates($this->context->language->id), 'warehouse_list' => $warehouse_list, 'sources' => ConnectionsSource::getOrderSources($order->id), 'currentState' => $order->getCurrentOrderState(), 'currency' => new Currency($order->id_currency), 'currencies' => Currency::getCurrenciesByIdShop($order->id_shop), 'previousOrder' => $order->getPreviousOrderId(), 'nextOrder' => $order->getNextOrderId(), 'current_index' => self::$currentIndex, 'carrierModuleCall' => $carrier_module_call, 'iso_code_lang' => $this->context->language->iso_code, 'id_lang' => $this->context->language->id, 'can_edit' => $this->tabAccess['edit'] == 1, 'current_id_lang' => $this->context->language->id, 'invoices_collection' => $order->getInvoicesCollection(), 'not_paid_invoices_collection' => $order->getNotPaidInvoicesCollection(), 'payment_methods' => $payment_methods, 'invoice_management_active' => Configuration::get('PS_INVOICE', null, null, $order->id_shop), 'display_warehouse' => (int) Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'));
return parent::renderView();
}
示例3: process
public function process()
{
parent::process();
self::$smarty->assign(array('is_guest' => self::$cookie->is_guest, 'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation((int) $this->id_order), 'HOOK_PAYMENT_RETURN' => Hook::paymentReturn((int) $this->id_order, (int) $this->id_module)));
if (self::$cookie->is_guest) {
self::$smarty->assign(array('id_order' => $this->id_order, 'id_order_formatted' => sprintf('#%06d', $this->id_order)));
/* If guest we clear the cookie for security reason */
self::$cookie->logout();
} else {
self::$smarty->assign(array('id_order' => $this->id_order, 'id_order_formatted' => sprintf('#%06d', $this->id_order)));
}
//assign order details here
$order = new Order($this->id_order);
if (Validate::isLoadedObject($order) and $order->id_customer == self::$cookie->id_customer) {
$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);
// $stateInvoiceAddress = new State((int)$addressInvoice->id_state);
$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) {
self::$smarty->assign('total_old', (double) ($order->total_paid - $order->total_discounts));
}
self::$smarty->assign('order_total', Tools::ps_round($order->total_paid));
self::$smarty->assign('order_total_usd', Tools::ps_round(Tools::convertPrice($order->total_paid, self::$cookie->id_currency, false)));
$products = $order->getProducts();
$customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart);
Product::addCustomizationPrice($products, $customizedDatas);
$customer = new Customer($order->id_customer);
$order->customization_fee = Cart::getCustomizationCostStatic((int) $order->id_cart);
$totalQuantity = 0;
foreach ($products as $productRow) {
$totalQuantity += $productRow['product_quantity'];
}
if (strpos($order->payment, 'COD') === false) {
self::$smarty->assign('paymentMethod', 'ONLINE');
} else {
self::$smarty->assign('paymentMethod', 'COD');
}
$shippingdate = new DateTime($order->expected_shipping_date);
self::$smarty->assign(array('shipping_date' => $shippingdate->format("F j, Y"), '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((int) $id_order_state) and $order->invoice_number, 'order_history' => $order->getHistory((int) self::$cookie->id_lang, false, true), 'products' => $products, 'discounts' => $order->getDiscounts(), 'carrier' => $carrier, 'address_invoice' => $addressInvoice, 'invoiceState' => (Validate::isLoadedObject($addressInvoice) and $addressInvoice->id_state) ? new State((int) $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) and $addressDelivery->id_state) ? new State((int) $addressDelivery->id_state) : false, 'is_guest' => false, 'messages' => Message::getMessagesByOrderId((int) $order->id), 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'use_tax' => Configuration::get('PS_TAX'), 'group_use_tax' => Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC, 'customizedDatas' => $customizedDatas, 'totalQuantity' => $totalQuantity));
if ($carrier->url and $order->shipping_number) {
self::$smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url));
}
self::$smarty->assign('HOOK_ORDERDETAILDISPLAYED', Module::hookExec('orderDetailDisplayed', array('order' => $order)));
Module::hookExec('OrderDetail', array('carrier' => $carrier, 'order' => $order));
//FB Share
//$products = $order->getProducts();
$orderProducts = array();
$productMaxVal = 0;
$productMaxId = null;
foreach ($products as $product) {
array_push($orderProducts, $product['product_id']);
if ($product['product_price'] > $productMaxVal) {
$productMaxId = $product['product_id'];
$productMaxVal = $product['product_price'];
}
}
$productObj = new Product($productMaxId, true, 1);
self::$smarty->assign('fbShareProductObject', $productObj->getLink());
self::$smarty->assign('fbShareProductObjectId', $productMaxId);
self::$smarty->assign('orderProducts', implode(",", $orderProducts));
self::$cookie->shareProductCode = md5(time() . $productMaxId);
self::$cookie->write();
unset($carrier);
unset($addressInvoice);
unset($addressDelivery);
}
}
示例4: renderView
//.........这里部分代码省略.........
if (Shop::isFeatureActive()) {
$shop = new Shop((int) $order->id_shop);
$this->toolbar_title .= ' - ' . sprintf($this->l('Shop: %s'), $shop->name);
}
// gets warehouses to ship products, if and only if advanced stock management is activated
$warehouse_list = null;
$order_details = $order->getOrderDetailList();
foreach ($order_details as $order_detail) {
$product = new Product($order_detail['product_id']);
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && $product->advanced_stock_management) {
$warehouses = Warehouse::getWarehousesByProductId($order_detail['product_id'], $order_detail['product_attribute_id']);
foreach ($warehouses as $warehouse) {
if (!isset($warehouse_list[$warehouse['id_warehouse']])) {
$warehouse_list[$warehouse['id_warehouse']] = $warehouse;
}
}
}
}
$payment_methods = array();
foreach (PaymentModule::getInstalledPaymentModules() as $payment) {
$module = Module::getInstanceByName($payment['name']);
if (Validate::isLoadedObject($module) && $module->active) {
$payment_methods[] = $module->displayName;
}
}
// display warning if there are products out of stock
$display_out_of_stock_warning = false;
$current_order_state = $order->getCurrentOrderState();
if (Configuration::get('PS_STOCK_MANAGEMENT') && (!Validate::isLoadedObject($current_order_state) || $current_order_state->delivery != 1 && $current_order_state->shipped != 1)) {
$display_out_of_stock_warning = true;
}
// products current stock (from stock_available)
foreach ($products as &$product) {
// Get total customized quantity for current product
$customized_product_quantity = 0;
if (is_array($product['customizedDatas'])) {
foreach ($product['customizedDatas'] as $customizationPerAddress) {
foreach ($customizationPerAddress as $customizationId => $customization) {
$customized_product_quantity += (int) $customization['quantity'];
}
}
}
$product['customized_product_quantity'] = $customized_product_quantity;
$product['current_stock'] = StockAvailable::getQuantityAvailableByProduct($product['product_id'], $product['product_attribute_id'], $product['id_shop']);
$resume = OrderSlip::getProductSlipResume($product['id_order_detail']);
$product['quantity_refundable'] = $product['product_quantity'] - $resume['product_quantity'];
$product['amount_refundable'] = $product['total_price_tax_excl'] - $resume['amount_tax_excl'];
$product['amount_refundable_tax_incl'] = $product['total_price_tax_incl'] - $resume['amount_tax_incl'];
$product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl'], $currency);
$product['refund_history'] = OrderSlip::getProductSlipDetail($product['id_order_detail']);
$product['return_history'] = OrderReturn::getProductReturnDetail($product['id_order_detail']);
// if the current stock requires a warning
if ($product['current_stock'] <= 0 && $display_out_of_stock_warning) {
$this->displayWarning($this->l('This product is out of stock: ') . ' ' . $product['product_name']);
}
if ($product['id_warehouse'] != 0) {
$warehouse = new Warehouse((int) $product['id_warehouse']);
$product['warehouse_name'] = $warehouse->name;
$warehouse_location = WarehouseProductLocation::getProductLocation($product['product_id'], $product['product_attribute_id'], $product['id_warehouse']);
if (!empty($warehouse_location)) {
$product['warehouse_location'] = $warehouse_location;
} else {
$product['warehouse_location'] = false;
}
} else {
$product['warehouse_name'] = '--';
$product['warehouse_location'] = false;
}
}
$gender = new Gender((int) $customer->id_gender, $this->context->language->id);
$history = $order->getHistory($this->context->language->id);
foreach ($history as &$order_state) {
$order_state['text-color'] = Tools::getBrightness($order_state['color']) < 128 ? 'white' : 'black';
}
// Smarty assign
$this->tpl_view_vars = array('order' => $order, 'cart' => new Cart($order->id_cart), 'customer' => $customer, 'gender' => $gender, 'customer_addresses' => $customer->getAddresses($this->context->language->id), 'addresses' => array('delivery' => $addressDelivery, 'deliveryState' => isset($deliveryState) ? $deliveryState : null, 'invoice' => $addressInvoice, 'invoiceState' => isset($invoiceState) ? $invoiceState : null), 'customerStats' => $customer->getStats(), 'products' => $products, 'discounts' => $order->getCartRules(), 'orders_total_paid_tax_incl' => $order->getOrdersTotalPaid(), 'total_paid' => $order->getTotalPaid(), 'returns' => OrderReturn::getOrdersReturn($order->id_customer, $order->id), 'customer_thread_message' => CustomerThread::getCustomerMessages($order->id_customer, null, $order->id), 'orderMessages' => OrderMessage::getOrderMessages($order->id_lang), 'messages' => Message::getMessagesByOrderId($order->id, true), 'carrier' => new Carrier($order->id_carrier), 'history' => $history, 'states' => OrderState::getOrderStates($this->context->language->id), 'warehouse_list' => $warehouse_list, 'sources' => ConnectionsSource::getOrderSources($order->id), 'currentState' => $order->getCurrentOrderState(), 'currency' => new Currency($order->id_currency), 'currencies' => Currency::getCurrenciesByIdShop($order->id_shop), 'previousOrder' => $order->getPreviousOrderId(), 'nextOrder' => $order->getNextOrderId(), 'current_index' => self::$currentIndex, 'carrierModuleCall' => $carrier_module_call, 'iso_code_lang' => $this->context->language->iso_code, 'id_lang' => $this->context->language->id, 'can_edit' => $this->tabAccess['edit'] == 1, 'current_id_lang' => $this->context->language->id, 'invoices_collection' => $order->getInvoicesCollection(), 'not_paid_invoices_collection' => $order->getNotPaidInvoicesCollection(), 'payment_methods' => $payment_methods, 'invoice_management_active' => Configuration::get('PS_INVOICE', null, null, $order->id_shop), 'display_warehouse' => (int) Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'), 'HOOK_CONTENT_ORDER' => Hook::exec('displayAdminOrderContentOrder', array('order' => $order, 'products' => $products, 'customer' => $customer)), 'HOOK_CONTENT_SHIP' => Hook::exec('displayAdminOrderContentShip', array('order' => $order, 'products' => $products, 'customer' => $customer)), 'HOOK_TAB_ORDER' => Hook::exec('displayAdminOrderTabOrder', array('order' => $order, 'products' => $products, 'customer' => $customer)), 'HOOK_TAB_SHIP' => Hook::exec('displayAdminOrderTabShip', array('order' => $order, 'products' => $products, 'customer' => $customer)));
$options_time = array();
$time_slice = Configuration::get('APH_CALENDAR_TIME_SLICE');
for ($hours = 0; $hours < 24; $hours++) {
// the interval for hours is '1'
for ($mins = 0; $mins < 60; $mins += $time_slice) {
// the interval for mins is 'APH_CALENDAR_TIME_SLICE'
$options_time[str_pad($hours, 2, '0', STR_PAD_LEFT) . ':' . str_pad($mins, 2, '0', STR_PAD_LEFT)] = str_pad($hours, 2, '0', STR_PAD_LEFT) . ':' . str_pad($mins, 2, '0', STR_PAD_LEFT);
}
}
$this->tpl_view_vars['options_time'] = $options_time;
$employees = array();
$e = AphEmployeeProduct::getEmployeesByShop((int) Context::getContext()->shop->id);
foreach ($e as $employee) {
$employees[$employee['id_employee']] = $employee['fullName'];
}
$this->tpl_view_vars['employees'] = $employees;
$helper = new HelperView($this);
$this->setHelperDisplay($helper);
$helper->tpl_vars = $this->getTemplateViewVars();
$helper->base_folder = $this->getTemplatePath() . 'aph_orders/helpers/';
$helper->base_tpl = 'view/view.tpl';
$view = $helper->generateView();
return $view;
}
示例5: refundOrder
function refundOrder($order = null)
{
$hipay = new HiPay_Tpp();
$amount = -1 * $_POST['refunded_amount'];
// Set refund to negative
$payment_method = 'HiPay - refund';
$payment_transaction_id = '';
$currency = new Currency($order->id_currency);
$payment_date = date("Y-m-d H:i:s");
$order_has_invoice = $order->invoice_number;
// if ($order_has_invoice)
// $order_invoice = new OrderInvoice( Tools::getValue ( 'payment_invoice' ) );
// else
// $order_invoice = null;
if (!addOrderPayment($order->id, $amount)) {
// Ajout commentaire status KO
$msg = new Message();
$message = $hipay->l('HiPay - Refund failed.');
$message .= ' - ' . $hipay->l('Amount refunded failed =') . ' ' . $amount;
$message = strip_tags($message, '<br>');
if (Validate::isCleanHtml($message)) {
$msg->message = $message;
$msg->id_order = intval($order->id);
$msg->private = 1;
$msg->add();
}
} else {
$cart = new Cart((int) $_POST['order']->id);
$order_id = retrieveOrderId($cart->id);
$tag = 'HIPAY_CAPTURE ';
$amount = $_POST['captured_amount'] - $_POST['refunded_amount'];
$msgs = Message::getMessagesByOrderId($order_id, true);
//true for private messages (got example from AdminOrdersController)
$create_new_msg = true;
if (count($msgs)) {
foreach ($msgs as $msg) {
$line = $msg['message'];
if (startsWith($line, $tag)) {
$create_new_msg = false;
$to_update_msg = new Message($msg['id_message']);
$to_update_msg->message = $tag . $amount;
$to_update_msg->save();
break;
}
}
}
}
return true;
}
示例6: hookAdminOrder
public function hookAdminOrder($params)
{
$versionSpecialClass = '';
if (!file_exists(_PS_MODULE_DIR_ . 'seur/img/logonew_32.png') && file_exists(_PS_MODULE_DIR_ . 'seur/img/logonew.png')) {
ImageManager::resize(_PS_MODULE_DIR_ . 'seur/img/logonew.png', _PS_MODULE_DIR_ . 'seur/img/logonew_32.png', 32, 32, 'png');
}
if (version_compare(_PS_VERSION_, '1.5', '<')) {
$versionSpecialClass = 'ver14';
}
$this->displayWarning();
if (Configuration::get('SEUR_Configured') == 1) {
$cookie = $this->context->cookie;
$token = Tools::getValue('token');
$back = Tools::safeOutput($_SERVER['REQUEST_URI']);
$seur_carriers = SeurLib::getSeurCarriers(false);
$ids_seur_carriers = array();
foreach ($seur_carriers as $value) {
$ids_seur_carriers[] = (int) $value['id'];
}
$order = new Order((int) $params['id_order']);
$address_saved = DB::getInstance()->getValue('
SELECT `id_address_delivery`
FROM `' . _DB_PREFIX_ . 'seur_order`
WHERE `id_order` = "' . (int) $order->id . '"
');
if ($address_saved === '0') {
$this->context->smarty->assign('pickup_point_warning', true);
}
if (!Validate::isLoadedObject($order)) {
return false;
}
$delivery_price = $order_weigth = 0;
$products = $order->getProductsDetail();
foreach ($products as $product) {
$order_weigth += (double) $product['product_weight'] * (double) $product['product_quantity'];
}
$order_weigth = $order_weigth < 1.0 ? 1.0 : (double) $order_weigth;
$customer = new Customer((int) $order->id_customer);
$address_delivery = new Address((int) $order->id_address_delivery, (int) $cookie->id_lang);
if (!Validate::isLoadedObject($address_delivery)) {
return false;
}
$iso_country = Country::getIsoById((int) $address_delivery->id_country);
if ($iso_country == 'PT') {
$post_code = explode(' ', $address_delivery->postcode);
$post_code = $post_code[0];
} else {
$post_code = $address_delivery->postcode;
}
$international_orders = SeurLib::getConfigurationField('international_orders');
$date_calculate = strtotime('-14 day', strtotime(date('Y-m-d')));
$date_display = date('Y-m-d H:m:i', $date_calculate);
if (strtotime($order->date_add) > strtotime($date_display) && in_array((int) $order->id_carrier, $ids_seur_carriers)) {
if (!$international_orders && ($iso_country == 'ES' || $iso_country == 'PT' || $iso_country == 'AD') || $international_orders) {
if (!SeurLib::getSeurOrder((int) $order->id)) {
SeurLib::setSeurOrder((int) $order->id, 1, $order_weigth, null);
} elseif (Tools::getValue('numBultos') && Tools::getValue('pesoBultos')) {
SeurLib::setSeurOrder((int) $order->id, (int) Tools::getValue('numBultos'), str_replace(',', '.', Tools::getValue('pesoBultos')), null);
}
$order_data = SeurLib::getSeurOrder((int) $order->id);
$response_post_code = Town::getTowns($post_code);
$order_weigth = (double) $order_weigth != $order_data['peso_bultos'] ? (double) $order_data['peso_bultos'] : (double) $order_weigth;
if (is_object($response_post_code)) {
$towns = array();
$num = (int) $response_post_code->attributes()->NUM[0];
for ($i = 1; $i <= $num; $i++) {
$name = 'REG' . $i;
$towns[] = utf8_decode((string) $response_post_code->{$name}->NOM_POBLACION);
}
}
$name = $address_delivery->firstname . ' ' . $address_delivery->lastname;
$direccion = $address_delivery->address1 . ' ' . $address_delivery->address2;
$newcountry = new Country((int) $address_delivery->id_country, (int) $cookie->id_lang);
$iso_merchant = SeurLib::getMerchantField('country');
$rate_data = array('town' => $address_delivery->city, 'peso' => (double) $order_weigth, 'post_code' => $post_code, 'bultos' => $order_data['numero_bultos'], 'ccc' => SeurLib::getMerchantField('ccc'), 'franchise' => SeurLib::getMerchantField('franchise'), 'iso' => $newcountry->iso_code, 'iso_merchant' => $iso_merchant, 'id_employee' => $cookie->id_employee, 'token' => Tools::getAdminTokenLite('AdminOrders'), 'back' => $back);
$order_messages_str = '';
$info_adicional_str = $address_delivery->other;
$order_messages = Message::getMessagesByOrderId((int) $params['id_order']);
if (is_array($order_messages)) {
foreach ($order_messages as $order_messag_tmp) {
$order_messages_str .= "\n" . $order_messag_tmp['message'];
}
if (substr_count($order_messages_str, "\n") > 5) {
$order_messages_str = str_replace(array("\r", "\n"), ' | ', $order_messages_str);
}
if (Tools::strlen($order_messages_str) > 250) {
$order_messages_str = Tools::substr($order_messages_str, 0, 247) . '...';
}
$order_messages_str = trim($order_messages_str);
}
if (!empty($order_messages_str)) {
$info_adicional_str = $order_messages_str;
}
$label_data = array('pedido' => sprintf('%06d', (int) $order->id), 'total_bultos' => $order_data['numero_bultos'], 'total_kilos' => (double) $order_weigth, 'direccion_consignatario' => $direccion, 'consignee_town' => $address_delivery->city, 'codPostal_consignatario' => $post_code, 'telefono_consignatario' => !empty($address_delivery->phone_mobile) ? $address_delivery->phone_mobile : $address_delivery->phone, 'movil' => $address_delivery->phone_mobile, 'name' => $name, 'companyia' => !empty($address_delivery->company) ? $address_delivery->company : '', 'email_consignatario' => Validate::isLoadedObject($customer) ? $customer->email : '', 'dni' => $address_delivery->dni, 'info_adicional' => $info_adicional_str, 'country' => $newcountry->name, 'iso' => $newcountry->iso_code, 'iso_merchant' => $iso_merchant, 'admin_dir' => utf8_encode(_PS_ADMIN_DIR_), 'id_employee' => $cookie->id_employee, 'token' => Tools::getAdminTokenLite('AdminOrders'), 'back' => $back);
if (strcmp($order->module, 'seurcashondelivery') == 0) {
$rate_data['reembolso'] = (double) $order->total_paid;
$label_data['reembolso'] = (double) $order->total_paid;
}
$carrier_pos = SeurLib::getSeurCarrier('SEP');
$datospos = '';
//.........这里部分代码省略.........
示例7: renderView
//.........这里部分代码省略.........
$module = Module::getInstanceByName($payment['name']);
if (Validate::isLoadedObject($module) && $module->active) {
$payment_methods[] = $module->displayName;
}
}
// display warning if there are products out of stock
$display_out_of_stock_warning = false;
$current_order_state = $order->getCurrentOrderState();
if (Configuration::get('PS_STOCK_MANAGEMENT') && (!Validate::isLoadedObject($current_order_state) || $current_order_state->delivery != 1 && $current_order_state->shipped != 1)) {
$display_out_of_stock_warning = true;
}
// products current stock (from stock_available)
foreach ($products as &$product) {
// Get total customized quantity for current product
$customized_product_quantity = 0;
if (is_array($product['customizedDatas'])) {
foreach ($product['customizedDatas'] as $customizationPerAddress) {
foreach ($customizationPerAddress as $customizationId => $customization) {
$customized_product_quantity += (int) $customization['quantity'];
}
}
}
$product['customized_product_quantity'] = $customized_product_quantity;
$product['current_stock'] = StockAvailable::getQuantityAvailableByProduct($product['product_id'], $product['product_attribute_id'], $product['id_shop']);
$resume = OrderSlip::getProductSlipResume($product['id_order_detail']);
$product['quantity_refundable'] = $product['product_quantity'] - $resume['product_quantity'];
$product['amount_refundable'] = $product['total_price_tax_excl'] - $resume['amount_tax_excl'];
$product['amount_refundable_tax_incl'] = $product['total_price_tax_incl'] - $resume['amount_tax_incl'];
$product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl'], $currency);
$product['refund_history'] = OrderSlip::getProductSlipDetail($product['id_order_detail']);
$product['return_history'] = OrderReturn::getProductReturnDetail($product['id_order_detail']);
// if the current stock requires a warning
if ($product['current_stock'] == 0 && $display_out_of_stock_warning) {
$this->displayWarning($this->l('This product is out of stock: ') . ' ' . $product['product_name']);
}
if ($product['id_warehouse'] != 0) {
$warehouse = new Warehouse((int) $product['id_warehouse']);
$product['warehouse_name'] = $warehouse->name;
$warehouse_location = WarehouseProductLocation::getProductLocation($product['product_id'], $product['product_attribute_id'], $product['id_warehouse']);
if (!empty($warehouse_location)) {
$product['warehouse_location'] = $warehouse_location;
} else {
$product['warehouse_location'] = false;
}
} else {
$product['warehouse_name'] = '--';
$product['warehouse_location'] = false;
}
}
$gender = new Gender((int) $customer->id_gender, $this->context->language->id);
$history = $order->getHistory($this->context->language->id);
foreach ($history as &$order_state) {
$order_state['text-color'] = Tools::getBrightness($order_state['color']) < 128 ? 'white' : 'black';
}
//by webkul to get data to show hotel rooms order data on order detail page
$cart_id = Cart::getCartIdByOrderId(Tools::getValue('id_order'));
$cart_detail_data = array();
$cart_detail_data_obj = new HotelCartBookingData();
$cart_detail_data = $cart_detail_data_obj->getCartCurrentDataByCartId((int) $cart_id);
if ($cart_detail_data) {
foreach ($cart_detail_data as $key => $value) {
$product_image_id = Product::getCover($value['id_product']);
$link_rewrite = (new Product((int) $value['id_product'], Configuration::get('PS_LANG_DEFAULT')))->link_rewrite[Configuration::get('PS_LANG_DEFAULT')];
if ($product_image_id) {
$cart_detail_data[$key]['image_link'] = $this->context->link->getImageLink($link_rewrite, $product_image_id['id_image'], 'small_default');
} else {
$cart_detail_data[$key]['image_link'] = $this->context->link->getImageLink($link_rewrite, $this->context->language->iso_code . "-default", 'small_default');
}
$cart_detail_data[$key]['room_type'] = (new Product((int) $value['id_product']))->name[Configuration::get('PS_LANG_DEFAULT')];
$cart_detail_data[$key]['room_num'] = (new HotelRoomInformation((int) $value['id_room']))->room_num;
$cart_detail_data[$key]['date_from'] = (new DateTime($value['date_from']))->format('d-M Y');
$cart_detail_data[$key]['date_to'] = (new DateTime($value['date_to']))->format('d-M Y');
$cust_obj = new Customer($value['id_customer']);
$cart_detail_data[$key]['alloted_cust_name'] = $cust_obj->firstname . ' ' . $cust_obj->lastname;
$cart_detail_data[$key]['alloted_cust_email'] = $cust_obj->email;
$cart_detail_data[$key]['avail_rooms_to_swap'] = (new HotelBookingDetail())->getAvailableRoomsForSwaping($value['date_from'], $value['date_to'], $value['id_product'], $value['id_hotel']);
$obj_booking_dtl = new HotelBookingDetail();
$num_days = $obj_booking_dtl->getNumberOfDays($cart_detail_data[$key]['date_from'], $cart_detail_data[$key]['date_to']);
//quantity of product
$cart_detail_data[$key]['amt_with_qty'] = $value['amount'] * $num_days;
}
}
//end
//by webkul to send order status on order detail page
$obj_bookin_detail = new HotelBookingDetail();
$htl_booking_data_order_id = $obj_bookin_detail->getBookingDataByOrderId(Tools::getValue('id_order'));
if ($htl_booking_data_order_id) {
foreach ($htl_booking_data_order_id as $key => $value) {
$htl_booking_data_order_id[$key]['room_num'] = (new HotelRoomInformation())->getHotelRoomInfoById($value['id_room']);
$htl_booking_data_order_id[$key]['order_status'] = $value['id_status'];
$htl_booking_data_order_id[$key]['date_from'] = (new DateTime($value['date_from']))->format('d-M Y');
$htl_booking_data_order_id[$key]['date_to'] = (new DateTime($value['date_to']))->format('d-M Y');
}
}
$htl_order_status = HotelOrderStatus::getAllHotelOrderStatus();
//end
// Smarty assign
$this->tpl_view_vars = array('htl_booking_order_data' => $htl_booking_data_order_id, 'hotel_order_status' => $htl_order_status, 'cart_detail_data' => $cart_detail_data, 'order' => $order, 'cart' => new Cart($order->id_cart), 'customer' => $customer, 'gender' => $gender, 'customer_addresses' => $customer->getAddresses($this->context->language->id), 'addresses' => array('delivery' => $addressDelivery, 'deliveryState' => isset($deliveryState) ? $deliveryState : null, 'invoice' => $addressInvoice, 'invoiceState' => isset($invoiceState) ? $invoiceState : null), 'customerStats' => $customer->getStats(), 'products' => $products, 'discounts' => $order->getCartRules(), 'orders_total_paid_tax_incl' => $order->getOrdersTotalPaid(), 'total_paid' => $order->getTotalPaid(), 'returns' => OrderReturn::getOrdersReturn($order->id_customer, $order->id), 'customer_thread_message' => CustomerThread::getCustomerMessages($order->id_customer, null, $order->id), 'orderMessages' => OrderMessage::getOrderMessages($order->id_lang), 'messages' => Message::getMessagesByOrderId($order->id, true), 'carrier' => new Carrier($order->id_carrier), 'history' => $history, 'states' => OrderState::getOrderStates($this->context->language->id), 'warehouse_list' => $warehouse_list, 'sources' => ConnectionsSource::getOrderSources($order->id), 'currentState' => $order->getCurrentOrderState(), 'currency' => new Currency($order->id_currency), 'currencies' => Currency::getCurrenciesByIdShop($order->id_shop), 'previousOrder' => $order->getPreviousOrderId(), 'nextOrder' => $order->getNextOrderId(), 'current_index' => self::$currentIndex, 'carrierModuleCall' => $carrier_module_call, 'iso_code_lang' => $this->context->language->iso_code, 'id_lang' => $this->context->language->id, 'can_edit' => $this->tabAccess['edit'] == 1, 'current_id_lang' => $this->context->language->id, 'invoices_collection' => $order->getInvoicesCollection(), 'not_paid_invoices_collection' => $order->getNotPaidInvoicesCollection(), 'payment_methods' => $payment_methods, 'invoice_management_active' => Configuration::get('PS_INVOICE', null, null, $order->id_shop), 'display_warehouse' => (int) Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'), 'HOOK_CONTENT_ORDER' => Hook::exec('displayAdminOrderContentOrder', array('order' => $order, 'products' => $products, 'customer' => $customer)), 'HOOK_CONTENT_SHIP' => Hook::exec('displayAdminOrderContentShip', array('order' => $order, 'products' => $products, 'customer' => $customer)), 'HOOK_TAB_ORDER' => Hook::exec('displayAdminOrderTabOrder', array('order' => $order, 'products' => $products, 'customer' => $customer)), 'HOOK_TAB_SHIP' => Hook::exec('displayAdminOrderTabShip', array('order' => $order, 'products' => $products, 'customer' => $customer)));
return parent::renderView();
}
示例8: Order
if (!($id_order = intval(Tools::getValue('id_order'))) or !Validate::isUnsignedId($id_order)) {
$errors[] = Tools::displayError('order ID is required');
} else {
$order = new Order($id_order);
if (Validate::isLoadedObject($order) and $order->id_customer == $cookie->id_customer) {
$id_order_state = intval($order->getCurrentState());
$carrier = new Carrier(intval($order->id_carrier), intval($order->id_lang));
$addressInvoice = new Address(intval($order->id_address_invoice));
$addressDelivery = new Address(intval($order->id_address_delivery));
if ($order->total_discounts > 0) {
$smarty->assign('total_old', floatval($order->total_paid - $order->total_discounts));
}
$products = $order->getProducts();
$customizedDatas = Product::getAllCustomizedDatas(intval($order->id_cart));
Product::addCustomizationPrice($products, $customizedDatas);
$smarty->assign(array('shop_name' => strval(Configuration::get('PS_SHOP_NAME')), 'order' => $order, 'return_allowed' => intval($order->isReturnable()), 'currency' => new Currency($order->id_currency), 'order_state' => intval($id_order_state), 'invoiceAllowed' => intval(Configuration::get('PS_INVOICE')), 'invoice' => OrderState::invoiceAvailable(intval($id_order_state)) or $order->invoice_number, 'order_history' => $order->getHistory(intval($cookie->id_lang), false, true), 'products' => $products, 'discounts' => $order->getDiscounts(), 'carrier' => $carrier, 'address_invoice' => $addressInvoice, 'invoiceState' => (Validate::isLoadedObject($addressInvoice) and $addressInvoice->id_state) ? new State(intval($addressInvoice->id_state)) : false, 'address_delivery' => $addressDelivery, 'deliveryState' => (Validate::isLoadedObject($addressDelivery) and $addressDelivery->id_state) ? new State(intval($addressDelivery->id_state)) : false, 'messages' => Message::getMessagesByOrderId(intval($order->id)), 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'customizedDatas' => $customizedDatas));
if ($carrier->url and $order->shipping_number) {
$smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url));
}
} else {
$errors[] = Tools::displayError('cannot find this order');
}
}
$smarty->assign('errors', $errors);
if (Tools::getValue('ajax') == 'true') {
$smarty->display(_PS_THEME_DIR_ . 'order-detail.tpl');
} else {
include dirname(__FILE__) . '/header.php';
$smarty->display(_PS_THEME_DIR_ . 'order-detail.tpl');
include dirname(__FILE__) . '/footer.php';
}
示例9: updateOrderCAPTUREmsg
public function updateOrderCAPTUREmsg($id_order, $amount)
{
$tag = 'HIPAY_CAPTURE ';
// don't forget the space!
$msgs = Message::getMessagesByOrderId($id_order, true);
// true for private messages (got example from AdminOrdersController)
if (count($msgs)) {
foreach ($msgs as $msg) {
$line = $msg['message'];
if ($this->startsWith($line, $tag)) {
$to_update_msg = new Message($msg['id_message']);
$to_update_msg->message = $tag . $amount;
$to_update_msg->save();
break;
}
}
}
}
示例10: viewDetails
public function viewDetails()
{
global $currentIndex, $cookie, $link;
$irow = 0;
if (!($order = $this->loadObject())) {
return;
}
$customer = new Customer($order->id_customer);
$customerStats = $customer->getStats();
$addressInvoice = new Address($order->id_address_invoice, (int) $cookie->id_lang);
if (Validate::isLoadedObject($addressInvoice) and $addressInvoice->id_state) {
$invoiceState = new State((int) $addressInvoice->id_state);
}
$addressDelivery = new Address($order->id_address_delivery, (int) $cookie->id_lang);
if (Validate::isLoadedObject($addressDelivery) and $addressDelivery->id_state) {
$deliveryState = new State((int) $addressDelivery->id_state);
}
$carrier = new Carrier($order->id_carrier);
$history = $order->getHistory($cookie->id_lang);
$products = $order->getProducts();
$customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart);
Product::addCustomizationPrice($products, $customizedDatas);
$discounts = $order->getDiscounts();
$messages = Message::getMessagesByOrderId($order->id, true);
$states = OrderState::getOrderStates((int) $cookie->id_lang);
$currency = new Currency($order->id_currency);
$currentLanguage = new Language((int) $cookie->id_lang);
$currentState = OrderHistory::getLastOrderState($order->id);
$sources = ConnectionsSource::getOrderSources($order->id);
$cart = Cart::getCartByOrderId($order->id);
$row = array_shift($history);
if ($prevOrder = Db::getInstance()->getValue('SELECT id_order FROM ' . _DB_PREFIX_ . 'orders WHERE id_order < ' . (int) $order->id . ' ORDER BY id_order DESC')) {
$prevOrder = '<a href="' . $currentIndex . '&token=' . Tools::getValue('token') . '&vieworder&id_order=' . $prevOrder . '"><img style="width:24px;height:24px" src="../img/admin/arrow-left.png" /></a>';
}
if ($nextOrder = Db::getInstance()->getValue('SELECT id_order FROM ' . _DB_PREFIX_ . 'orders WHERE id_order > ' . (int) $order->id . ' ORDER BY id_order ASC')) {
$nextOrder = '<a href="' . $currentIndex . '&token=' . Tools::getValue('token') . '&vieworder&id_order=' . $nextOrder . '"><img style="width:24px;height:24px" src="../img/admin/arrow-right.png" /></a>';
}
if ($order->total_paid != $order->total_paid_real) {
echo '<center><span class="warning" style="font-size: 16px">' . $this->l('Warning:') . ' ' . Tools::displayPrice($order->total_paid_real, $currency, false) . ' ' . $this->l('paid instead of') . ' ' . Tools::displayPrice($order->total_paid, $currency, false) . ' !</span></center><div class="clear"><br /><br /></div>';
}
// display bar code if module enabled
$hook = Module::hookExec('invoice', array('id_order' => $order->id));
if ($hook !== false) {
echo '<div style="float: right; margin: -40px 40px 10px 0;">';
echo $hook;
echo '</div><br class="clear" />';
}
// display order header
echo '
<div style="float:left" style="width:440px">';
echo '<h2>
' . $prevOrder . '
' . (Validate::isLoadedObject($customer) ? $customer->firstname . ' ' . $customer->lastname . ' - ' : '') . $this->l('Order #') . sprintf('%06d', $order->id) . '
' . $nextOrder . '
</h2>
<div style="width:429px">
' . ((($currentState->invoice or $order->invoice_number) and count($products)) ? '<a href="pdf.php?id_order=' . $order->id . '&pdf"><img src="../img/admin/charged_ok.gif" alt="' . $this->l('View invoice') . '" /> ' . $this->l('View invoice') . '</a>' : '<img src="../img/admin/charged_ko.gif" alt="' . $this->l('No invoice') . '" /> ' . $this->l('No invoice')) . ' -
' . (($currentState->delivery or $order->delivery_number) ? '<a href="pdf.php?id_delivery=' . $order->delivery_number . '"><img src="../img/admin/delivery.gif" alt="' . $this->l('View delivery slip') . '" /> ' . $this->l('View delivery slip') . '</a>' : '<img src="../img/admin/delivery_ko.gif" alt="' . $this->l('No delivery slip') . '" /> ' . $this->l('No delivery slip')) . ' -
<a href="javascript:window.print()"><img src="../img/admin/printer.gif" alt="' . $this->l('Print order') . '" title="' . $this->l('Print order') . '" /> ' . $this->l('Print page') . '</a>
</div>
<div class="clear"> </div>';
/* Display current status */
echo '
<table cellspacing="0" cellpadding="0" class="table" style="width: 429px">
<tr>
<th>' . Tools::displayDate($row['date_add'], (int) $cookie->id_lang, true) . '</th>
<th><img src="../img/os/' . $row['id_order_state'] . '.gif" /></th>
<th>' . stripslashes($row['ostate_name']) . '</th>
<th>' . (!empty($row['employee_lastname']) ? '(' . stripslashes(Tools::substr($row['employee_firstname'], 0, 1)) . '. ' . stripslashes($row['employee_lastname']) . ')' : '') . '</th>
</tr>';
/* Display previous status */
foreach ($history as $row) {
echo '
<tr class="' . ($irow++ % 2 ? 'alt_row' : '') . '">
<td>' . Tools::displayDate($row['date_add'], (int) $cookie->id_lang, true) . '</td>
<td><img src="../img/os/' . $row['id_order_state'] . '.gif" /></td>
<td>' . stripslashes($row['ostate_name']) . '</td>
<td>' . (!empty($row['employee_lastname']) ? '(' . stripslashes(Tools::substr($row['employee_firstname'], 0, 1)) . '. ' . stripslashes($row['employee_lastname']) . ')' : '') . '</td>
</tr>';
}
echo '
</table>
<br />';
/* Display status form */
echo '
<form action="' . $currentIndex . '&view' . $this->table . '&token=' . $this->token . '" method="post" style="text-align:center;">
<select name="id_order_state">';
$currentStateTab = $order->getCurrentStateFull($cookie->id_lang);
foreach ($states as $state) {
echo '<option value="' . $state['id_order_state'] . '"' . ($state['id_order_state'] == $currentStateTab['id_order_state'] ? ' selected="selected"' : '') . '>' . stripslashes($state['name']) . '</option>';
}
echo '
</select>
<input type="hidden" name="id_order" value="' . $order->id . '" />
<input type="submit" name="submitState" value="' . $this->l('Change') . '" class="button" />
</form>';
/* Display customer information */
if (Validate::isLoadedObject($customer)) {
echo '<br />
<fieldset style="width: 400px">
//.........这里部分代码省略.........
示例11: renderView
public function renderView()
{
$neoExchange = new NeoExchanges(Tools::getValue('id_neo_exchange'));
$order = new Order(Tools::getValue('id_neo_exchange'));
if (!Validate::isLoadedObject($neoExchange)) {
$this->errors[] = Tools::displayError('The order cannot be found within your database.');
}
$customer = new Customer($neoExchange->id_customer);
//$carrier = new Carrier($neoExchange->id_carrier);
$currency = new Currency((int) $neoExchange->id_currency);
$buys = new NeoItemsBuyCore(Tools::getValue('id_neo_exchange'));
$sales = new NeoItemsSalesCore(Tools::getValue('id_neo_exchange'));
$products = $this->getProducts($buys);
$products2 = $this->getProducts($sales);
//$products = $this->getProducts($neoExchange);
// Carrier module call
/*$carrier_module_call = null;
if ($carrier->is_module)
{
$module = Module::getInstanceByName($carrier->external_module_name);
if (method_exists($module, 'displayInfoByCart'))
$carrier_module_call = call_user_func(array($module, 'displayInfoByCart'), $neoExchange->id_cart);
}
// Retrieve addresses information
$addressInvoice = new Address($neoExchange->id_address_invoice, $this->context->language->id);
if (Validate::isLoadedObject($addressInvoice) && $addressInvoice->id_state)
$invoiceState = new State((int)$addressInvoice->id_state);
if ($neoExchange->id_address_invoice == $neoExchange->id_address_delivery)
{
$addressDelivery = $addressInvoice;
if (isset($invoiceState))
$deliveryState = $invoiceState;
}
else
{
$addressDelivery = new Address($neoExchange->id_address_delivery, $this->context->language->id);
if (Validate::isLoadedObject($addressDelivery) && $addressDelivery->id_state)
$deliveryState = new State((int)($addressDelivery->id_state));
}*/
$this->toolbar_title = sprintf($this->l('Intercambio #%1$d (%2$s) - %3$s %4$s'), $neoExchange->id, $neoExchange->reference, $customer->firstname, $customer->lastname);
if (Shop::isFeatureActive()) {
$shop = new Shop((int) $neoExchange->id_shop);
$this->toolbar_title .= ' - ' . sprintf($this->l('Shop: %s'), $shop->name);
}
// gets warehouses to ship products, if and only if advanced stock management is activated
$warehouse_list = null;
$payment_methods = array();
foreach (PaymentModule::getInstalledPaymentModules() as $payment) {
$module = Module::getInstanceByName($payment['name']);
if (Validate::isLoadedObject($module) && $module->active) {
$payment_methods[] = $module->displayName;
}
}
// display warning if there are products out of stock
$display_out_of_stock_warning = false;
$current_order_state = $neoExchange->getCurrentOrderState();
if (Configuration::get('PS_STOCK_MANAGEMENT') && (!Validate::isLoadedObject($current_order_state) || $current_order_state->delivery != 1 && $current_order_state->shipped != 1)) {
$display_out_of_stock_warning = true;
}
$total_buy = 0;
$total_sale = 0;
$products_buy = count($products);
$products_sale = count($products2);
// products current stock (from stock_available)
foreach ($products as &$product) {
$total_buy += $product['price'];
}
foreach ($products2 as &$product) {
$total_sale += $product['price'];
}
$gender = new Gender((int) $customer->id_gender, $this->context->language->id);
$history = $neoExchange->getHistory($this->context->language->id);
foreach ($history as &$order_state) {
$order_state['text-color'] = Tools::getBrightness($order_state['color']) < 128 ? 'white' : 'black';
}
// Smarty assign
$this->tpl_view_vars = array('order' => $neoExchange, 'customer' => $customer, 'gender' => $gender, 'customer_addresses' => $customer->getAddresses($this->context->language->id), 'customerStats' => $customer->getStats(), 'products' => $products, 'products2' => $products2, 'total_buy' => $total_buy, 'total_sale' => $total_sale, 'products_buy' => $products_buy, 'products_sale' => $products_sale, 'neo_order_shipping_price' => 0, 'orders_total_paid_tax_incl' => $neoExchange->getOrdersTotalPaid(), 'total_paid' => $neoExchange->getTotalPaid(), 'returns' => OrderReturn::getOrdersReturn($neoExchange->id_customer, $neoExchange->id), 'customer_thread_message' => CustomerThread::getCustomerMessages($neoExchange->id_customer), 'orderMessages' => OrderMessage::getOrderMessages($neoExchange->id_lang), 'messages' => Message::getMessagesByOrderId($neoExchange->id, true), 'history' => $history, 'neoStatus' => NeoStatusCore::getNeoStatus(), 'warehouse_list' => $warehouse_list, 'sources' => ConnectionsSource::getOrderSources($neoExchange->id), 'currentState' => $neoExchange->getCurrentOrderState(), 'currency' => new Currency($neoExchange->id_currency), 'currencies' => Currency::getCurrenciesByIdShop($neoExchange->id_shop), 'previousOrder' => $neoExchange->getPreviousOrderId(), 'nextOrder' => $neoExchange->getNextOrderId(), 'current_index' => self::$currentIndex, 'iso_code_lang' => $this->context->language->iso_code, 'id_lang' => $this->context->language->id, 'can_edit' => $this->tabAccess['edit'] == 1, 'current_id_lang' => $this->context->language->id, 'invoices_collection' => $neoExchange->getInvoicesCollection(), 'not_paid_invoices_collection' => $neoExchange->getNotPaidInvoicesCollection(), 'payment_methods' => $payment_methods, 'invoice_management_active' => Configuration::get('PS_INVOICE', null, null, $neoExchange->id_shop), 'display_warehouse' => (int) Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'), 'HOOK_CONTENT_ORDER' => Hook::exec('displayAdminOrderContentOrder', array('order' => $neoExchange, 'products' => $products, 'customer' => $customer)), 'HOOK_CONTENT_SHIP' => Hook::exec('displayAdminOrderContentShip', array('order' => $neoExchange, 'products' => $products, 'customer' => $customer)), 'HOOK_TAB_ORDER' => Hook::exec('displayAdminOrderTabOrder', array('order' => $neoExchange, 'products' => $products, 'customer' => $customer)), 'HOOK_TAB_SHIP' => Hook::exec('displayAdminOrderTabShip', array('order' => $neoExchange, 'products' => $products, 'customer' => $customer)));
return parent::renderView();
}
示例12: renderView
//.........这里部分代码省略.........
$shop = new Shop((int) $order->id_shop);
$this->toolbar_title .= ' - ' . sprintf($this->trans('Shop: %s', array(), 'Admin.OrdersCustomers.Feature'), $shop->name);
}
// gets warehouses to ship products, if and only if advanced stock management is activated
$warehouse_list = null;
$order_details = $order->getOrderDetailList();
foreach ($order_details as $order_detail) {
$product = new Product($order_detail['product_id']);
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && $product->advanced_stock_management) {
$warehouses = Warehouse::getWarehousesByProductId($order_detail['product_id'], $order_detail['product_attribute_id']);
foreach ($warehouses as $warehouse) {
if (!isset($warehouse_list[$warehouse['id_warehouse']])) {
$warehouse_list[$warehouse['id_warehouse']] = $warehouse;
}
}
}
}
$payment_methods = array();
foreach (PaymentModule::getInstalledPaymentModules() as $payment) {
$module = Module::getInstanceByName($payment['name']);
if (Validate::isLoadedObject($module) && $module->active) {
$payment_methods[] = $module->displayName;
}
}
// display warning if there are products out of stock
$display_out_of_stock_warning = false;
$current_order_state = $order->getCurrentOrderState();
if (Configuration::get('PS_STOCK_MANAGEMENT') && (!Validate::isLoadedObject($current_order_state) || $current_order_state->delivery != 1 && $current_order_state->shipped != 1)) {
$display_out_of_stock_warning = true;
}
// products current stock (from stock_available)
foreach ($products as &$product) {
// Get total customized quantity for current product
$customized_product_quantity = 0;
if (is_array($product['customizedDatas'])) {
foreach ($product['customizedDatas'] as $customizationPerAddress) {
foreach ($customizationPerAddress as $customizationId => $customization) {
$customized_product_quantity += (int) $customization['quantity'];
}
}
}
$product['customized_product_quantity'] = $customized_product_quantity;
$product['current_stock'] = StockAvailable::getQuantityAvailableByProduct($product['product_id'], $product['product_attribute_id'], $product['id_shop']);
$resume = OrderSlip::getProductSlipResume($product['id_order_detail']);
$product['quantity_refundable'] = $product['product_quantity'] - $resume['product_quantity'];
$product['amount_refundable'] = $product['total_price_tax_excl'] - $resume['amount_tax_excl'];
$product['amount_refundable_tax_incl'] = $product['total_price_tax_incl'] - $resume['amount_tax_incl'];
$product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl'], $currency);
$product['refund_history'] = OrderSlip::getProductSlipDetail($product['id_order_detail']);
$product['return_history'] = OrderReturn::getProductReturnDetail($product['id_order_detail']);
// if the current stock requires a warning
if ($product['current_stock'] <= 0 && $display_out_of_stock_warning) {
$this->displayWarning($this->trans('This product is out of stock: ', array(), 'Admin.OrdersCustomers.Notification') . ' ' . $product['product_name']);
}
if ($product['id_warehouse'] != 0) {
$warehouse = new Warehouse((int) $product['id_warehouse']);
$product['warehouse_name'] = $warehouse->name;
$warehouse_location = WarehouseProductLocation::getProductLocation($product['product_id'], $product['product_attribute_id'], $product['id_warehouse']);
if (!empty($warehouse_location)) {
$product['warehouse_location'] = $warehouse_location;
} else {
$product['warehouse_location'] = false;
}
} else {
$product['warehouse_name'] = '--';
$product['warehouse_location'] = false;
}
}
// Package management for order
foreach ($products as &$product) {
$pack_items = $product['cache_is_pack'] ? Pack::getItemTable($product['id_product'], $this->context->language->id, true) : array();
foreach ($pack_items as &$pack_item) {
$pack_item['current_stock'] = StockAvailable::getQuantityAvailableByProduct($pack_item['id_product'], $pack_item['id_product_attribute'], $pack_item['id_shop']);
// if the current stock requires a warning
if ($product['current_stock'] <= 0 && $display_out_of_stock_warning) {
$this->displayWarning($this->trans('This product, included in package (' . $product['product_name'] . ') is out of stock: ', array(), 'Admin.OrdersCustomers.Notification') . ' ' . $pack_item['product_name']);
}
$this->setProductImageInformations($pack_item);
if ($pack_item['image'] != null) {
$name = 'product_mini_' . (int) $pack_item['id_product'] . (isset($pack_item['id_product_attribute']) ? '_' . (int) $pack_item['id_product_attribute'] : '') . '.jpg';
// generate image cache, only for back office
$pack_item['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_ . 'p/' . $pack_item['image']->getExistingImgPath() . '.jpg', $name, 45, 'jpg');
if (file_exists(_PS_TMP_IMG_DIR_ . $name)) {
$pack_item['image_size'] = getimagesize(_PS_TMP_IMG_DIR_ . $name);
} else {
$pack_item['image_size'] = false;
}
}
}
$product['pack_items'] = $pack_items;
}
$gender = new Gender((int) $customer->id_gender, $this->context->language->id);
$history = $order->getHistory($this->context->language->id);
foreach ($history as &$order_state) {
$order_state['text-color'] = Tools::getBrightness($order_state['color']) < 128 ? 'white' : 'black';
}
// Smarty assign
$this->tpl_view_vars = array('order' => $order, 'cart' => new Cart($order->id_cart), 'customer' => $customer, 'gender' => $gender, 'customer_addresses' => $customer->getAddresses($this->context->language->id), 'addresses' => array('delivery' => $addressDelivery, 'deliveryState' => isset($deliveryState) ? $deliveryState : null, 'invoice' => $addressInvoice, 'invoiceState' => isset($invoiceState) ? $invoiceState : null), 'customerStats' => $customer->getStats(), 'products' => $products, 'discounts' => $order->getCartRules(), 'orders_total_paid_tax_incl' => $order->getOrdersTotalPaid(), 'total_paid' => $order->getTotalPaid(), 'returns' => OrderReturn::getOrdersReturn($order->id_customer, $order->id), 'customer_thread_message' => CustomerThread::getCustomerMessages($order->id_customer, null, $order->id), 'orderMessages' => OrderMessage::getOrderMessages($order->id_lang), 'messages' => Message::getMessagesByOrderId($order->id, true), 'carrier' => new Carrier($order->id_carrier), 'history' => $history, 'states' => OrderState::getOrderStates($this->context->language->id), 'warehouse_list' => $warehouse_list, 'sources' => ConnectionsSource::getOrderSources($order->id), 'currentState' => $order->getCurrentOrderState(), 'currency' => new Currency($order->id_currency), 'currencies' => Currency::getCurrenciesByIdShop($order->id_shop), 'previousOrder' => $order->getPreviousOrderId(), 'nextOrder' => $order->getNextOrderId(), 'current_index' => self::$currentIndex, 'carrierModuleCall' => $carrier_module_call, 'iso_code_lang' => $this->context->language->iso_code, 'id_lang' => $this->context->language->id, 'can_edit' => $this->access('edit'), 'current_id_lang' => $this->context->language->id, 'invoices_collection' => $order->getInvoicesCollection(), 'not_paid_invoices_collection' => $order->getNotPaidInvoicesCollection(), 'payment_methods' => $payment_methods, 'invoice_management_active' => Configuration::get('PS_INVOICE', null, null, $order->id_shop), 'display_warehouse' => (int) Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'), 'carrier_list' => $this->getCarrierList($order), 'recalculate_shipping_cost' => (int) Configuration::get('PS_ORDER_RECALCULATE_SHIPPING'), 'HOOK_CONTENT_ORDER' => Hook::exec('displayAdminOrderContentOrder', array('order' => $order, 'products' => $products, 'customer' => $customer)), 'HOOK_CONTENT_SHIP' => Hook::exec('displayAdminOrderContentShip', array('order' => $order, 'products' => $products, 'customer' => $customer)), 'HOOK_TAB_ORDER' => Hook::exec('displayAdminOrderTabOrder', array('order' => $order, 'products' => $products, 'customer' => $customer)), 'HOOK_TAB_SHIP' => Hook::exec('displayAdminOrderTabShip', array('order' => $order, 'products' => $products, 'customer' => $customer)));
return parent::renderView();
}
示例13: addHipayCaptureMessage
function addHipayCaptureMessage($callback_arr, $id_order)
{
//LOG
HipayLog('--------------- Début addHipayCaptureMessage');
// Init / MAJ de la ligne message HIPAY_CAPTURE
$tag = 'HIPAY_CAPTURE ';
$amount = (int) $callback_arr['status'] == HIPAY_STATUS_AUTHORIZED ? '0.00' : (!empty($callback_arr['captured_amount']) ? $callback_arr['captured_amount'] : '0.00');
$msgs = Message::getMessagesByOrderId((int) $id_order, true);
$create_new_msg = true;
if (count($msgs)) {
foreach ($msgs as $msg) {
$line = $msg['message'];
if (startsWith($line, $tag)) {
$create_new_msg = false;
$to_update_msg = new Message($msg['id_message']);
$to_update_msg->message = $tag . $amount;
$to_update_msg->save();
break;
}
}
}
if ($create_new_msg) {
// Create msg
$msg = new Message();
$message = 'HIPAY_CAPTURE ' . $amount;
$message = strip_tags($message, '<br>');
if (Validate::isCleanHtml($message)) {
$msg->message = $message;
$msg->id_order = (int) $id_order;
$msg->private = 1;
$msg->add();
}
}
//LOG
HipayLog('--------------- Fin addHipayCaptureMessage');
}