本文整理汇总了PHP中OrderReturn::getOrdersReturn方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderReturn::getOrdersReturn方法的具体用法?PHP OrderReturn::getOrdersReturn怎么用?PHP OrderReturn::getOrdersReturn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderReturn
的用法示例。
在下文中一共展示了OrderReturn::getOrdersReturn方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTemplateVarOrderReturn
public function getTemplateVarOrderReturn($orderReturn)
{
$orderReturns = OrderReturn::getOrdersReturn($orderReturn->id_customer, $orderReturn->id_order);
foreach ($orderReturns as $return) {
if ($orderReturn->id_order == $return['id_order']) {
break;
}
}
$orderReturnPresenter = new OrderReturnPresenter(Configuration::get('PS_RETURN_PREFIX', $this->context->language->id), $this->context->link);
return $orderReturnPresenter->present($return);
}
示例2: preProcess
public function preProcess()
{
parent::preProcess();
if (Tools::isSubmit('submitReturnMerchandise')) {
$customizationQtyInput = Tools::getValue('customization_qty_input');
if (!($id_order = (int) Tools::getValue('id_order'))) {
Tools::redirect('history.php');
}
if (!($order_qte_input = Tools::getValue('order_qte_input'))) {
Tools::redirect('order-follow.php?errorDetail1');
}
if ($customizationIds = Tools::getValue('customization_ids') and !$customizationQtyInput) {
Tools::redirect('order-follow.php?errorDetail1');
}
if (!($ids_order_detail = Tools::getValue('ids_order_detail')) and !$customizationIds) {
Tools::redirect('order-follow.php?errorDetail2');
}
$order = new Order((int) $id_order);
if (!$order->isReturnable()) {
Tools::redirect('order-follow.php?errorNotReturnable');
}
if ($order->id_customer != self::$cookie->id_customer) {
die(Tools::displayError());
}
$orderReturn = new OrderReturn();
$orderReturn->id_customer = (int) self::$cookie->id_customer;
$orderReturn->id_order = $id_order;
$orderReturn->question = strval(Tools::getValue('returnText'));
if (empty($orderReturn->question)) {
Tools::redirect('order-follow.php?errorMsg');
}
if (!$orderReturn->checkEnoughProduct($ids_order_detail, $order_qte_input, $customizationIds, $customizationQtyInput)) {
Tools::redirect('order-follow.php?errorQuantity');
}
$orderReturn->state = 1;
$orderReturn->add();
$orderReturn->addReturnDetail($ids_order_detail, $order_qte_input, $customizationIds, $customizationQtyInput);
Module::hookExec('orderReturn', array('orderReturn' => $orderReturn));
Tools::redirect('order-follow.php');
}
$ordersReturn = OrderReturn::getOrdersReturn((int) self::$cookie->id_customer);
if (Tools::isSubmit('errorQuantity')) {
self::$smarty->assign('errorQuantity', true);
} elseif (Tools::isSubmit('errorMsg')) {
self::$smarty->assign('errorMsg', true);
} elseif (Tools::isSubmit('errorDetail1')) {
self::$smarty->assign('errorDetail1', true);
} elseif (Tools::isSubmit('errorDetail2')) {
self::$smarty->assign('errorDetail2', true);
} elseif (Tools::isSubmit('errorNotReturnable')) {
self::$smarty->assign('errorNotReturnable', true);
}
self::$smarty->assign('ordersReturn', $ordersReturn);
}
示例3: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
$ordersReturn = OrderReturn::getOrdersReturn($this->context->customer->id);
if (Tools::isSubmit('errorQuantity')) {
$this->context->smarty->assign('errorQuantity', true);
} elseif (Tools::isSubmit('errorMsg')) {
$this->context->smarty->assign(array('errorMsg' => true, 'ids_order_detail' => Tools::getValue('ids_order_detail', array()), 'order_qte_input' => Tools::getValue('order_qte_input', array()), 'id_order' => Tools::getValue('id_order')));
} elseif (Tools::isSubmit('errorDetail1')) {
$this->context->smarty->assign('errorDetail1', true);
} elseif (Tools::isSubmit('errorDetail2')) {
$this->context->smarty->assign('errorDetail2', true);
} elseif (Tools::isSubmit('errorNotReturnable')) {
$this->context->smarty->assign('errorNotReturnable', true);
}
$this->context->smarty->assign('ordersReturn', $ordersReturn);
$this->setTemplate(_PS_THEME_DIR_ . 'order-follow.tpl');
}
示例4: checkEnoughProduct
public function checkEnoughProduct($orderDetailList, $productQtyList, $customizationIds, $customizationQtyInput)
{
$order = new Order((int) $this->id_order);
if (!Validate::isLoadedObject($order)) {
die(Tools::displayError());
}
$products = $order->getProducts();
/* Products already returned */
$order_return = OrderReturn::getOrdersReturn($order->id_customer, $order->id, true);
foreach ($order_return as $or) {
$order_return_products = OrderReturn::getOrdersReturnProducts($or['id_order_return'], $order);
foreach ($order_return_products as $key => $orp) {
$products[$key]['product_quantity'] -= (int) $orp['product_quantity'];
}
}
/* Quantity check */
if ($orderDetailList) {
foreach (array_keys($orderDetailList) as $key) {
if ($qty = (int) $productQtyList[$key]) {
if ($products[$key]['product_quantity'] - $qty < 0) {
return false;
}
}
}
}
/* Customization quantity check */
if ($customizationIds) {
$orderedCustomizations = Customization::getOrderedCustomizations((int) $order->id_cart);
foreach ($customizationIds as $customizations) {
foreach ($customizations as $customizationId) {
$customizationId = (int) $customizationId;
if (!isset($orderedCustomizations[$customizationId])) {
return false;
}
$quantity = isset($customizationQtyInput[$customizationId]) ? (int) $customizationQtyInput[$customizationId] : 0;
if ((int) $orderedCustomizations[$customizationId]['quantity'] - $quantity < 0) {
return false;
}
}
}
}
return true;
}
示例5: getReturn
public function getReturn()
{
return OrderReturn::getOrdersReturn($this->id_customer, $this->id);
}
示例6: 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;
}
示例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: viewDetails
//.........这里部分代码省略.........
<td align="center">' . ($discount['value'] != 0.0 ? '- ' : '') . Tools::displayPrice($discount['value'], $currency, false) . '</td>
</tr>';
}
echo '
</table></div>';
}
echo '
</div>';
// Cancel product
echo '
<div style="clear:both; height:15px;"> </div>
<div style="float: right; width: 160px;">';
if ($order->hasBeenDelivered() and Configuration::get('PS_ORDER_RETURN')) {
echo '
<input type="checkbox" id="reinjectQuantities" name="reinjectQuantities" class="button" /> <label for="reinjectQuantities" style="float:none; font-weight:normal;">' . $this->l('Re-stock products') . '</label><br />';
}
if (!$order->hasBeenDelivered() and $order->hasBeenPaid() or $order->hasBeenDelivered() and Configuration::get('PS_ORDER_RETURN')) {
echo '
<input type="checkbox" id="generateCreditSlip" name="generateCreditSlip" class="button" onclick="toogleShippingCost(this)" /> <label for="generateCreditSlip" style="float:none; font-weight:normal;">' . $this->l('Generate a credit slip') . '</label><br />
<input type="checkbox" id="generateDiscount" name="generateDiscount" class="button" onclick="toogleShippingCost(this)" /> <label for="generateDiscount" style="float:none; font-weight:normal;">' . $this->l('Generate a voucher') . '</label><br />
<span id="spanShippingBack" style="display:none;"><input type="checkbox" id="shippingBack" name="shippingBack" class="button" /> <label for="shippingBack" style="float:none; font-weight:normal;">' . $this->l('Repay shipping costs') . '</label><br /></span>';
}
if (!$order->hasBeenDelivered() or $order->hasBeenDelivered() and Configuration::get('PS_ORDER_RETURN')) {
echo '
<div style="text-align:center; margin-top:5px;"><input type="submit" name="cancelProduct" value="' . ($order->hasBeenDelivered() ? $this->l('Return products') : ($order->hasBeenPaid() ? $this->l('Refund products') : $this->l('Cancel products'))) . '" class="button" style="margin-top:8px;" /></div>';
}
echo '
</div>';
echo '
</fieldset>
</form>
<div class="clear" style="height:20px;"> </div>';
/* Display send a message to customer & returns/credit slip*/
$returns = OrderReturn::getOrdersReturn($order->id_customer, $order->id);
$slips = OrderSlip::getOrdersSlip($order->id_customer, $order->id);
echo '
<div style="float: left">
<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '&token=' . $this->token . '" method="post" onsubmit="if (getE(\'visibility\').checked == true) return confirm(\'' . $this->l('Do you want to send this message to the customer?', __CLASS__, true, false) . '\');">
<fieldset style="width: 400px;">
<legend style="cursor: pointer;" onclick="$(\'#message\').slideToggle();$(\'#message_m\').slideToggle();return false"><img src="../img/admin/email_edit.gif" /> ' . $this->l('New message') . '</legend>
<div id="message_m" style="display: ' . (Tools::getValue('message') ? 'none' : 'block') . '; overflow: auto; width: 400px;">
<a href="#" onclick="$(\'#message\').slideToggle();$(\'#message_m\').slideToggle();return false"><b>' . $this->l('Click here') . '</b> ' . $this->l('to add a comment or send a message to the customer') . '</a>
</div>
<div id="message" style="display: ' . (Tools::getValue('message') ? 'block' : 'none') . '">
<select name="order_message" id="order_message" onchange="orderOverwriteMessage(this, \'' . $this->l('Do you want to overwrite your existing message?') . '\')">
<option value="0" selected="selected">-- ' . $this->l('Choose a standard message') . ' --</option>';
$orderMessages = OrderMessage::getOrderMessages((int) $order->id_lang);
foreach ($orderMessages as $orderMessage) {
echo ' <option value="' . htmlentities($orderMessage['message'], ENT_COMPAT, 'UTF-8') . '">' . $orderMessage['name'] . '</option>';
}
echo ' </select><br /><br />
<b>' . $this->l('Display to consumer?') . '</b>
<input type="radio" name="visibility" id="visibility" value="0" /> ' . $this->l('Yes') . '
<input type="radio" name="visibility" value="1" checked="checked" /> ' . $this->l('No') . '
<p id="nbchars" style="display:inline;font-size:10px;color:#666;"></p><br /><br />
<textarea id="txt_msg" name="message" cols="50" rows="8" onKeyUp="var length = document.getElementById(\'txt_msg\').value.length; if (length > 600) length = \'600+\'; document.getElementById(\'nbchars\').innerHTML = \'' . $this->l('600 chars max') . ' (\' + length + \')\';">' . htmlentities(Tools::getValue('message'), ENT_COMPAT, 'UTF-8') . '</textarea><br /><br />
<input type="hidden" name="id_order" value="' . (int) $order->id . '" />
<input type="hidden" name="id_customer" value="' . (int) $order->id_customer . '" />
<input type="submit" class="button" name="submitMessage" value="' . $this->l('Send') . '" />
</div>
</fieldset>
</form>';
/* Display list of messages */
if (sizeof($messages)) {
echo '
<br />
示例9: OrderReturn
}
$orderReturn = new OrderReturn();
$orderReturn->id_customer = intval($cookie->id_customer);
$orderReturn->id_order = $id_order;
$orderReturn->question = strval(Tools::getValue('returnText'));
if (empty($orderReturn->question)) {
Tools::redirect('order-follow.php?errorMsg');
}
if (!$orderReturn->checkEnoughProduct($ids_order_detail, $order_qte_input, $customizationIds, $customizationQtyInput)) {
Tools::redirect('order-follow.php?errorQuantity');
}
$orderReturn->state = 1;
$orderReturn->add();
$orderReturn->addReturnDetail($ids_order_detail, $order_qte_input, $customizationIds, $customizationQtyInput);
Module::hookExec('orderReturn', array('orderReturn' => $orderReturn));
Tools::redirect('order-follow.php');
}
$ordersReturn = OrderReturn::getOrdersReturn(intval($cookie->id_customer));
if (Tools::isSubmit('errorQuantity')) {
$smarty->assign('errorQuantity', true);
} elseif (Tools::isSubmit('errorMsg')) {
$smarty->assign('errorMsg', true);
} elseif (Tools::isSubmit('errorDetail1')) {
$smarty->assign('errorDetail1', true);
} elseif (Tools::isSubmit('errorDetail2')) {
$smarty->assign('errorDetail2', true);
}
$smarty->assign('ordersReturn', $ordersReturn);
include dirname(__FILE__) . '/header.php';
$smarty->display(_PS_THEME_DIR_ . 'order-follow.tpl');
include dirname(__FILE__) . '/footer.php';
示例10: 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();
}
示例11: getTemplateVarOrdersReturns
public function getTemplateVarOrdersReturns()
{
$orders_returns = array();
$orders_return = OrderReturn::getOrdersReturn($this->context->customer->id);
$orderReturnPresenter = new OrderReturnPresenter(Configuration::get('PS_RETURN_PREFIX', $this->context->language->id), $this->context->link);
foreach ($orders_return as $id_order_return => $order_return) {
$orders_returns[$id_order_return] = $orderReturnPresenter->present($order_return);
}
return $orders_returns;
}
示例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();
}