public function renderForm() { $this->fields_form = array('legend' => array('title' => $this->l('Return Merchandise Authorization (RMA)'), 'image' => '../img/admin/return.gif'), 'input' => array(array('type' => 'hidden', 'name' => 'id_order'), array('type' => 'hidden', 'name' => 'id_customer'), array('type' => 'text_customer', 'label' => $this->l('Customer'), 'name' => '', 'size' => '', 'required' => false), array('type' => 'text_order', 'label' => $this->l('Order'), 'name' => '', 'size' => '', 'required' => false), array('type' => 'free', 'label' => $this->l('Customer explanation'), 'name' => 'question', 'size' => '', 'required' => false), array('type' => 'select', 'label' => $this->l('Status'), 'name' => 'state', 'required' => false, 'options' => array('query' => OrderReturnState::getOrderReturnStates($this->context->language->id), 'id' => 'id_order_return_state', 'name' => 'name'), 'desc' => $this->l('Merchandise return (RMA) status.')), array('type' => 'list_products', 'label' => $this->l('Products'), 'name' => '', 'size' => '', 'required' => false, 'desc' => $this->l('List of products in return package.')), array('type' => 'pdf_order_return', 'label' => $this->l('Return slip'), 'name' => '', 'size' => '', 'required' => false, 'desc' => $this->l('The link is only available after validation and before the parcel gets delivered.'))), 'submit' => array('title' => $this->l('Save'))); $order = new Order($this->object->id_order); $quantity_displayed = array(); // Customized products */ if ($returned_customizations = OrderReturn::getReturnedCustomizedProducts((int) $this->object->id_order)) { foreach ($returned_customizations as $returned_customization) { $quantity_displayed[(int) $returned_customization['id_order_detail']] = isset($quantity_displayed[(int) $returned_customization['id_order_detail']]) ? $quantity_displayed[(int) $returned_customization['id_order_detail']] + (int) $returned_customization['product_quantity'] : (int) $returned_customization['product_quantity']; } } // Classic products $products = OrderReturn::getOrdersReturnProducts($this->object->id, $order); // Prepare customer explanation for display $this->object->question = '<span class="normal-text">' . nl2br($this->object->question) . '</span>'; $this->tpl_form_vars = array('customer' => new Customer($this->object->id_customer), 'url_customer' => 'index.php?tab=AdminCustomers&id_customer=' . (int) $this->object->id_customer . '&viewcustomer&token=' . Tools::getAdminToken('AdminCustomers' . (int) Tab::getIdFromClassName('AdminCustomers') . (int) $this->context->employee->id), 'text_order' => sprintf($this->l('Order #%1$d from %2$s'), $order->id, Tools::displayDate($order->date_upd)), 'url_order' => 'index.php?tab=AdminOrders&id_order=' . (int) $order->id . '&vieworder&token=' . Tools::getAdminToken('AdminOrders' . (int) Tab::getIdFromClassName('AdminOrders') . (int) $this->context->employee->id), 'picture_folder' => _THEME_PROD_PIC_DIR_, 'returnedCustomizations' => $returned_customizations, 'customizedDatas' => Product::getAllCustomizedDatas((int) $order->id_cart), 'products' => $products, 'quantityDisplayed' => $quantity_displayed, 'id_order_return' => $this->object->id, 'state_order_return' => $this->object->state); return parent::renderForm(); }
/** * Returns the template's HTML content * @return string HTML content */ public function getContent() { $delivery_address = new Address((int) $this->order->id_address_delivery); $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' '); $formatted_invoice_address = ''; if ($this->order->id_address_delivery != $this->order->id_address_invoice) { $invoice_address = new Address((int) $this->order->id_address_invoice); $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' '); } $this->smarty->assign(array('order_return' => $this->order_return, 'return_nb_days' => (int) Configuration::get('PS_ORDER_RETURN_NB_DAYS'), 'products' => OrderReturn::getOrdersReturnProducts((int) $this->order_return->id, $this->order), 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'shop_address' => AddressFormat::generateAddress($this->shop->getAddress(), array(), '<br />', ' '))); return $this->smarty->fetch($this->getTemplate('order-return')); }
public function hookOrderReturn($params) { $sEmail = Configuration::get('NOW_ORDER_RETURN_EMAIL'); if (Configuration::get('NOW_ORDER_RETURN_ACTIVE') && $sEmail) { $oOrderReturn = $params['orderReturn']; $oOrder = new Order((int) $oOrderReturn->id_order); if (Validate::isLoadedObject($oOrderReturn)) { $context = Context::getContext(); $aProducts = OrderReturn::getOrdersReturnProducts((int) $oOrderReturn->id, $oOrder); $aParamsEmail = array('{firstname}' => $context->customer->firstname, '{lastname}' => $context->customer->lastname, '{id_order_return}' => $oOrderReturn->id, '{id_order}' => $oOrderReturn->id_order, '{product_html}' => $this->getProductListforEmailHTML($aProducts), '{product_txt}' => $this->getProductListforEmailTXT($aProducts)); $return = Mail::Send($context->language->id, 'order_return', Mail::l('Order Return', $context->language->id), $aParamsEmail, $sEmail, 'Administrator', $context->customer->email, $context->customer->lastname . ' - ' . $context->customer->firstname, NULL, NULL, $this->module_dir . 'mails/'); return $return; } } }
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; }
public function preProcess() { parent::preProcess(); if (!isset($_GET['id_order_return']) or !Validate::isUnsignedId($_GET['id_order_return'])) { $this->errors[] = Tools::displayError('Order ID required'); } else { $orderRet = new OrderReturn((int) $_GET['id_order_return']); if (Validate::isLoadedObject($orderRet) and $orderRet->id_customer == self::$cookie->id_customer) { $order = new Order((int) $orderRet->id_order); if (Validate::isLoadedObject($order)) { $state = new OrderReturnState((int) $orderRet->state); self::$smarty->assign(array('orderRet' => $orderRet, 'order' => $order, 'state_name' => $state->name[(int) self::$cookie->id_lang], 'return_allowed' => false, 'products' => OrderReturn::getOrdersReturnProducts((int) $orderRet->id, $order), 'returnedCustomizations' => OrderReturn::getReturnedCustomizedProducts((int) $orderRet->id_order), 'customizedDatas' => Product::getAllCustomizedDatas((int) $order->id_cart))); } else { $this->errors[] = Tools::displayError('Cannot find this order return'); } } else { $this->errors[] = Tools::displayError('Cannot find this order return'); } } self::$smarty->assign(array('errors' => $this->errors, 'nbdaysreturn' => (int) Configuration::get('PS_ORDER_RETURN_NB_DAYS'))); }
/** * Initialize order return controller * @see FrontController::init() */ public function init() { parent::init(); header('Cache-Control: no-cache, must-revalidate'); header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); if (!isset($_GET['id_order_return']) || !Validate::isUnsignedId($_GET['id_order_return'])) { $this->errors[] = Tools::displayError('Order ID required'); } else { $orderRet = new OrderReturn((int) $_GET['id_order_return']); if (Validate::isLoadedObject($orderRet) && $orderRet->id_customer == $this->context->cookie->id_customer) { $order = new Order((int) $orderRet->id_order); if (Validate::isLoadedObject($order)) { $state = new OrderReturnState((int) $orderRet->state); $this->context->smarty->assign(array('orderRet' => $orderRet, 'order' => $order, 'state_name' => $state->name[(int) $this->context->language->id], 'return_allowed' => false, 'products' => OrderReturn::getOrdersReturnProducts((int) $orderRet->id, $order), 'returnedCustomizations' => OrderReturn::getReturnedCustomizedProducts((int) $orderRet->id_order), 'customizedDatas' => Product::getAllCustomizedDatas((int) $order->id_cart))); } else { $this->errors[] = Tools::displayError('Cannot find the order return.'); } } else { $this->errors[] = Tools::displayError('Cannot find the order return.'); } } }
public function displayForm() { global $currentIndex, $cookie; $obj = $this->loadObject(true); $defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT')); $languages = Language::getLanguages(); echo ' <script type="text/javascript"> id_language = Number(' . $defaultLanguage . '); </script> <form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" method="post"> ' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . ' <input type="hidden" name="id_order" value="' . $obj->id_order . '" /> <input type="hidden" name="id_customer" value="' . $obj->id_customer . '" /> <fieldset class="width3"><legend><img src="../img/admin/return.gif" />' . $this->l('Return Merchandise Authorization (RMA)') . '</legend> <label>' . $this->l('Customer:') . ' </label>'; $customer = new Customer(intval($obj->id_customer)); echo ' <div class="margin-form">' . $customer->firstname . ' ' . $customer->lastname . ' <p style="clear: both"><a href="index.php?tab=AdminCustomers&id_customer=' . $customer->id . '&viewcustomer&token=' . Tools::getAdminToken('AdminCustomers' . intval(Tab::getIdFromClassName('AdminCustomers')) . intval($cookie->id_employee)) . '">' . $this->l('View details on customer page') . '</a></p> </div> <label>' . $this->l('Order:') . ' </label>'; $order = new Order(intval($obj->id_order)); echo ' <div class="margin-form">' . $this->l('Order #') . sprintf('%06d', $order->id) . ' ' . $this->l('from') . ' ' . Tools::displayDate($order->date_upd, $order->id_lang) . ' <p style="clear: both"><a href="index.php?tab=AdminOrders&id_order=' . $order->id . '&vieworder&token=' . Tools::getAdminToken('AdminOrders' . intval(Tab::getIdFromClassName('AdminOrders')) . intval($cookie->id_employee)) . '">' . $this->l('View details on order page') . '</a></p> </div> <label>' . $this->l('Customer explanation:') . ' </label> <div class="margin-form">' . $obj->question . '</div> <input type="submit" value="' . $this->l(' Save ') . '" name="submitAdd' . $this->table . '" class="button" style="float:right; margin-right:120px;"/> <label>' . $this->l('Status:') . ' </label> <div class="margin-form"> <select name=\'state\'>'; $states = OrderReturnState::getOrderReturnStates($cookie->id_lang); foreach ($states as $state) { echo '<option value="' . $state['id_order_return_state'] . '"' . ($obj->state == $state['id_order_return_state'] ? ' selected="selected"' : '') . '>' . $state['name'] . '</option>'; } echo ' </select> <p style="clear: both">' . $this->l('Merchandise return (RMA) status') . '</p> </div>'; if ($obj->state >= 3) { echo ' <label>' . $this->l('Slip:') . ' </label> <div class="margin-form">' . $this->l('Generate a new slip from the customer order') . ' <p style="clear: both"><a href="index.php?tab=AdminOrders&id_order=' . $order->id . '&vieworder&token=' . Tools::getAdminToken('AdminOrders' . intval(Tab::getIdFromClassName('AdminOrders')) . intval($cookie->id_employee)) . '#products">' . $this->l('More information on order page') . '</a></p> </div>'; } echo ' <label>' . $this->l('Products:') . ' </label> <div class="margin-form">'; echo '<table cellpadding="0" cellspacing="0"> <tr> <td class="col-left"> </td> <td> <table cellspacing="0" cellpadding="0" class="table"> <tr> <th style="width: 100px;">' . $this->l('Reference') . '</th> <th>' . $this->l('Product name') . '</th> <th>' . $this->l('Quantity') . '</th> <th>' . $this->l('Action') . '</th> </tr>'; $order = new Order(intval($obj->id_order)); $quantityDisplayed = array(); /* Customized products */ if ($returnedCustomizations = OrderReturn::getReturnedCustomizedProducts(intval($obj->id_order))) { $allCustomizedDatas = Product::getAllCustomizedDatas(intval($order->id_cart)); foreach ($returnedCustomizations as $returnedCustomization) { echo ' <tr> <td>' . $returnedCustomization['reference'] . '</td> <td class="center">' . $returnedCustomization['name'] . '</td> <td class="center">' . intval($returnedCustomization['product_quantity']) . '</td> <td class="center"><a href="' . $currentIndex . '&deleteorder_return_detail&id_order_detail=' . $returnedCustomization['id_order_detail'] . '&id_customization=' . $returnedCustomization['id_customization'] . '&id_order_return=' . $obj->id . '&token=' . $this->token . '"><img src="../img/admin/delete.gif"></a></td> </tr>'; $customizationDatas =& $allCustomizedDatas[intval($returnedCustomization['product_id'])][intval($returnedCustomization['product_attribute_id'])][intval($returnedCustomization['id_customization'])]['datas']; foreach ($customizationDatas as $type => $datas) { echo '<tr> <td colspan="4">'; if ($type == _CUSTOMIZE_FILE_) { $i = 0; echo '<ul style="margin: 4px 0px 4px 0px; padding: 0px; list-style-type: none;">'; foreach ($datas as $data) { echo '<li style="display: inline; margin: 2px;"> <a href="displayImage.php?img=' . $data['value'] . '&name=' . intval($order->id) . '-file' . ++$i . '" target="_blank"><img src="' . _THEME_PROD_PIC_DIR_ . $data['value'] . '_small" alt="" /></a> </li>'; } echo '</ul>'; } elseif ($type == _CUSTOMIZE_TEXTFIELD_) { $i = 0; echo '<ul style="margin: 0px 0px 4px 0px; padding: 0px 0px 0px 6px; list-style-type: none;">'; foreach ($datas as $data) { echo '<li>' . $this->l('Text #') . ++$i . $this->l(':') . ' ' . $data['value'] . '</li>'; } echo '</ul>'; } echo '</td> </tr>'; } $quantityDisplayed[intval($returnedCustomization['id_order_detail'])] = isset($quantityDisplayed[intval($returnedCustomization['id_order_detail'])]) ? $quantityDisplayed[intval($returnedCustomization['id_order_detail'])] + intval($returnedCustomization['product_quantity']) : intval($returnedCustomization['product_quantity']); } } /* Classic products */ $products = OrderReturn::getOrdersReturnProducts($obj->id, $order); foreach ($products as $k => $product) { if (!isset($quantityDisplayed[intval($product['id_order_detail'])]) or intval($product['product_quantity']) > intval($quantityDisplayed[intval($product['id_order_detail'])])) { echo ' <tr> <td>' . $product['product_reference'] . '</td> <td class="center">' . $product['product_name'] . '</td> <td class="center">' . $product['product_quantity'] . '</td> <td class="center"><a href="' . $currentIndex . '&deleteorder_return_detail&id_order_detail=' . $product['id_order_detail'] . '&id_order_return=' . $obj->id . '&token=' . $this->token . '"><img src="../img/admin/delete.gif"></a></td> </tr>'; } } echo ' </table> </td> </tr> </table> <p>' . $this->l('List of products in return package') . '</p> </div> <div class="margin-form"> </div> </fieldset> </form>'; }
/** * Product table with references, quantities... */ public function ProdReturnTab() { $header = array(array(self::l('Description'), 'L'), array(self::l('Reference'), 'L'), array(self::l('Qty'), 'C')); $w = array(110, 25, 20); $this->SetFont(self::fontname(), 'B', 8); $this->SetFillColor(240, 240, 240); for ($i = 0; $i < sizeof($header); $i++) { $this->Cell($w[$i], 5, $header[$i][0], 'T', 0, $header[$i][1], 1); } $this->Ln(); $this->SetFont(self::fontname(), '', 7); $products = OrderReturn::getOrdersReturnProducts(self::$orderReturn->id, self::$order); foreach ($products as $product) { $before = $this->GetY(); $this->MultiCell($w[0], 5, Tools::iconv('utf-8', self::encoding(), $product['product_name']), 'B'); $lineSize = $this->GetY() - $before; $this->SetXY($this->GetX() + $w[0], $this->GetY() - $lineSize); $this->Cell($w[1], $lineSize, $product['product_reference'] != '' ? Tools::iconv('utf-8', self::encoding(), $product['product_reference']) : '---', 'B'); $this->Cell($w[2], $lineSize, $product['product_quantity'], 'B', 0, 'C'); $this->Ln(); } }
$useSSL = true; include dirname(__FILE__) . '/config/config.inc.php'; require_once dirname(__FILE__) . '/init.php'; $errors = array(); if (!$cookie->isLogged()) { Tools::redirect('authentication.php?back=history.php'); } if (!isset($_GET['id_order_return']) or !Validate::isUnsignedId($_GET['id_order_return'])) { $errors[] = Tools::displayError('order ID is required'); } else { $orderRet = new OrderReturn(intval($_GET['id_order_return'])); if (Validate::isLoadedObject($orderRet) and $orderRet->id_customer == $cookie->id_customer) { $order = new Order(intval($orderRet->id_order)); if (Validate::isLoadedObject($order)) { $state = new OrderReturnState(intval($orderRet->state)); $smarty->assign(array('orderRet' => $orderRet, 'order' => $order, 'state_name' => $state->name[intval($cookie->id_lang)], 'return_allowed' => false, 'products' => OrderReturn::getOrdersReturnProducts(intval($orderRet->id), $order), 'returnedCustomizations' => OrderReturn::getReturnedCustomizedProducts(intval($orderRet->id_order)), 'customizedDatas' => Product::getAllCustomizedDatas(intval($order->id_cart)))); } else { $errors[] = Tools::displayError('cannot find this order return'); } } else { $errors[] = Tools::displayError('cannot find this order return'); } } $smarty->assign(array('errors' => $errors, 'nbdaysreturn' => intval(Configuration::get('PS_ORDER_RETURN_NB_DAYS')))); if (Tools::getValue('ajax') == 'true') { $smarty->display(_PS_THEME_DIR_ . 'order-return.tpl'); } else { include dirname(__FILE__) . '/header.php'; $smarty->display(_PS_THEME_DIR_ . 'order-return.tpl'); include dirname(__FILE__) . '/footer.php'; }
/** * Send a mail when a customer return an order. * * @param array $params Hook params. */ public function hookActionOrderReturn($params) { if (!$this->return_slip || empty($this->return_slip)) { return; } $context = Context::getContext(); $id_lang = (int) $context->language->id; $id_shop = (int) $context->shop->id; $configuration = Configuration::getMultiple(array('PS_SHOP_EMAIL', 'PS_MAIL_METHOD', 'PS_MAIL_SERVER', 'PS_MAIL_USER', 'PS_MAIL_PASSWD', 'PS_SHOP_NAME', 'PS_MAIL_COLOR'), $id_lang, null, $id_shop); // Shop iso $iso = Language::getIsoById((int) Configuration::get('PS_LANG_DEFAULT')); $order = new Order((int) $params['orderReturn']->id_order); $customer = new Customer((int) $params['orderReturn']->id_customer); $delivery = new Address((int) $order->id_address_delivery); $invoice = new Address((int) $order->id_address_invoice); $order_date_text = Tools::displayDate($order->date_add); if ($delivery->id_state) { $delivery_state = new State((int) $delivery->id_state); } if ($invoice->id_state) { $invoice_state = new State((int) $invoice->id_state); } $order_return_products = OrderReturn::getOrdersReturnProducts($params['orderReturn']->id, $order); $items_table = ''; foreach ($order_return_products as $key => $product) { $url = $context->link->getProductLink($product['product_id']); $items_table .= '<tr style="background-color:' . ($key % 2 ? '#DDE2E6' : '#EBECEE') . ';"> <td style="padding:0.6em 0.4em;">' . $product['product_reference'] . '</td> <td style="padding:0.6em 0.4em;"> <strong><a href="' . $url . '">' . $product['product_name'] . '</a> </strong> </td> <td style="padding:0.6em 0.4em; text-align:center;">' . (int) $product['product_quantity'] . '</td> </tr>'; } $template_vars = array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{delivery_block_txt}' => MailAlert::getFormatedAddress($delivery, "\n"), '{invoice_block_txt}' => MailAlert::getFormatedAddress($invoice, "\n"), '{delivery_block_html}' => MailAlert::getFormatedAddress($delivery, '<br />', array('firstname' => '<span style="color:' . $configuration['PS_MAIL_COLOR'] . '; font-weight:bold;">%s</span>', 'lastname' => '<span style="color:' . $configuration['PS_MAIL_COLOR'] . '; font-weight:bold;">%s</span>')), '{invoice_block_html}' => MailAlert::getFormatedAddress($invoice, '<br />', array('firstname' => '<span style="color:' . $configuration['PS_MAIL_COLOR'] . '; font-weight:bold;">%s</span>', 'lastname' => '<span style="color:' . $configuration['PS_MAIL_COLOR'] . '; font-weight:bold;">%s</span>')), '{delivery_company}' => $delivery->company, '{delivery_firstname}' => $delivery->firstname, '{delivery_lastname}' => $delivery->lastname, '{delivery_address1}' => $delivery->address1, '{delivery_address2}' => $delivery->address2, '{delivery_city}' => $delivery->city, '{delivery_postal_code}' => $delivery->postcode, '{delivery_country}' => $delivery->country, '{delivery_state}' => $delivery->id_state ? $delivery_state->name : '', '{delivery_phone}' => $delivery->phone ? $delivery->phone : $delivery->phone_mobile, '{delivery_other}' => $delivery->other, '{invoice_company}' => $invoice->company, '{invoice_firstname}' => $invoice->firstname, '{invoice_lastname}' => $invoice->lastname, '{invoice_address2}' => $invoice->address2, '{invoice_address1}' => $invoice->address1, '{invoice_city}' => $invoice->city, '{invoice_postal_code}' => $invoice->postcode, '{invoice_country}' => $invoice->country, '{invoice_state}' => $invoice->id_state ? $invoice_state->name : '', '{invoice_phone}' => $invoice->phone ? $invoice->phone : $invoice->phone_mobile, '{invoice_other}' => $invoice->other, '{order_name}' => $order->reference, '{shop_name}' => $configuration['PS_SHOP_NAME'], '{date}' => $order_date_text, '{items}' => $items_table, '{message}' => Tools::purifyHTML($params['orderReturn']->question)); // Send 1 email by merchant mail, because Mail::Send doesn't work with an array of recipients $merchant_mails = explode(self::__MA_MAIL_DELIMITOR__, $this->merchant_mails); foreach ($merchant_mails as $merchant_mail) { // Default language $mail_id_lang = $id_lang; $mail_iso = $iso; // Use the merchant lang if he exists as an employee $results = Db::getInstance()->executeS(' SELECT `id_lang` FROM `' . _DB_PREFIX_ . 'employee` WHERE `email` = \'' . pSQL($merchant_mail) . '\' '); if ($results) { $user_iso = Language::getIsoById((int) $results[0]['id_lang']); if ($user_iso) { $mail_id_lang = (int) $results[0]['id_lang']; $mail_iso = $user_iso; } } $dir_mail = false; if (file_exists(dirname(__FILE__) . '/mails/' . $mail_iso . '/return_slip.txt') && file_exists(dirname(__FILE__) . '/mails/' . $mail_iso . '/return_slip.html')) { $dir_mail = dirname(__FILE__) . '/mails/'; } if (file_exists(_PS_MAIL_DIR_ . $mail_iso . '/return_slip.txt') && file_exists(_PS_MAIL_DIR_ . $mail_iso . '/return_slip.html')) { $dir_mail = _PS_MAIL_DIR_; } if ($dir_mail) { Mail::Send($mail_id_lang, 'return_slip', sprintf(Mail::l('New return from order #%d - %s', $mail_id_lang), $order->id, $order->reference), $template_vars, $merchant_mail, null, $configuration['PS_SHOP_EMAIL'], $configuration['PS_SHOP_NAME'], null, null, $dir_mail, null, $id_shop); } } }
public function getTemplateVarProducts($order_return_id, $order) { $products = array(); $return_products = OrderReturn::getOrdersReturnProducts((int) $order_return_id, $order); foreach ($return_products as $id_return_product => $return_product) { if (!isset($return_product['deleted'])) { $products[$id_return_product] = $return_product; $products[$id_return_product]['customizations'] = $return_product['customizedDatas'] ? $this->getTemplateVarCustomization($return_product) : array(); } } return $products; }