本文整理汇总了PHP中OrderReturn::addReturnDetail方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderReturn::addReturnDetail方法的具体用法?PHP OrderReturn::addReturnDetail怎么用?PHP OrderReturn::addReturnDetail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderReturn
的用法示例。
在下文中一共展示了OrderReturn::addReturnDetail方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: postProcess
/**
* Start forms process
* @see FrontController::postProcess()
*/
public function postProcess()
{
if (Tools::isSubmit('submitReturnMerchandise')) {
$customizationQtyInput = Tools::getValue('customization_qty_input');
if (!($id_order = (int) Tools::getValue('id_order'))) {
Tools::redirect('index.php?controller=history');
}
if (!($order_qte_input = Tools::getValue('order_qte_input'))) {
Tools::redirect('index.php?controller=order-follow&errorDetail1');
}
if (!$customizationQtyInput && ($customizationIds = Tools::getValue('customization_ids'))) {
Tools::redirect('index.php?controller=order-follow&errorDetail1');
}
if (!$customizationIds && !($ids_order_detail = Tools::getValue('ids_order_detail'))) {
Tools::redirect('index.php?controller=order-follow&errorDetail2');
}
$order = new Order((int) $id_order);
if (!$order->isReturnable()) {
Tools::redirect('index.php?controller=order-follow&errorNotReturnable');
}
if ($order->id_customer != $this->context->customer->id) {
die(Tools::displayError());
}
$orderReturn = new OrderReturn();
$orderReturn->id_customer = (int) $this->context->customer->id;
$orderReturn->id_order = $id_order;
$orderReturn->question = strval(Tools::getValue('returnText'));
if (empty($orderReturn->question)) {
Tools::redirect('index.php?controller=order-follow&errorMsg&' . http_build_query(array('ids_order_detail' => $ids_order_detail, 'order_qte_input' => $order_qte_input, 'id_order' => Tools::getValue('id_order'))));
}
if (!$orderReturn->checkEnoughProduct($ids_order_detail, $order_qte_input, $customizationIds, $customizationQtyInput)) {
Tools::redirect('index.php?controller=order-follow&errorQuantity');
}
$orderReturn->state = 1;
$orderReturn->add();
$orderReturn->addReturnDetail($ids_order_detail, $order_qte_input, $customizationIds, $customizationQtyInput);
Hook::exec('actionOrderReturn', array('orderReturn' => $orderReturn));
Tools::redirect('index.php?controller=order-follow');
}
}
示例3: dirname
if (!($ids_order_detail = Tools::getValue('ids_order_detail')) and !$customizationIds) {
Tools::redirect('order-follow.php?errorDetail2');
}
$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';
示例4: cronReturnSync
public function cronReturnSync()
{
// Check if client is initialized
if (is_null($this->client)) {
return false;
}
//Retrieve returns
$returns = $this->client->getReturns(array(0));
//Check declared returns
if (is_null($returns) || $returns->count() == 0) {
return false;
}
$customizationQtyInput = Tools::getValue('customization_qty_input');
$customizationIds = Tools::getValue('customization_ids');
foreach ($returns as $return) {
$return_lines = $return->getLines();
$channelengine_order_id = $return->getOrderId();
$sql = "SELECT id_order FROM " . _DB_PREFIX_ . "orders WHERE id_channelengine_order ='" . $channelengine_order_id . "'";
$prestashop_order_id = Db::getInstance()->getValue($sql);
$sql = "SELECT id_order_detail FROM" . _DB_PREFIX_ . "order_detail WHERE id_order ='" . $prestashop_order_id . "'";
$ids_order_details = Db::getInstance()->executeS($sql);
$ids_order_detail_array = array();
foreach ($ids_order_details as $key => $ids_order_detail) {
$ids_order_detail_array[$ids_order_detail['id_order_detail']] = $ids_order_detail['id_order_detail'];
}
$quantity_array = array();
$keys = array_keys($ids_order_detail_array);
foreach ($return_lines as $i => $return_line) {
$quantity_array[$keys[$i]] = $return_line->getQuantity();
$order = new Order((int) $prestashop_order_id);
$orderReturn = new OrderReturn();
$orderReturn->id_customer = (int) $order->id_customer;
$orderReturn->id_order = $prestashop_order_id;
$orderReturn->question = htmlspecialchars(Tools::getValue('returnText'));
if (empty($orderReturn->question)) {
http_build_query(array('ids_order_detail' => $ids_order_detail_array, 'order_qte_input' => $quantity_array, 'id_order' => $prestashop_order_id));
}
}
$orderReturn->state = 1;
$orderReturn->add();
$orderReturn->addReturnDetail($ids_order_detail_array, $quantity_array, $customizationIds, $customizationQtyInput);
Hook::exec('actionOrderReturn', array('orderReturn' => $orderReturn));
}
}