本文整理汇总了PHP中OrderReturn::checkEnoughProduct方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderReturn::checkEnoughProduct方法的具体用法?PHP OrderReturn::checkEnoughProduct怎么用?PHP OrderReturn::checkEnoughProduct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderReturn
的用法示例。
在下文中一共展示了OrderReturn::checkEnoughProduct方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: OrderReturn
Tools::redirect('order-follow.php?errorDetail1');
}
if ($customizationIds = Tools::getValue('customization_ids') and !($customizationQtyInput = Tools::getValue('customization_qty_input'))) {
Tools::redirect('order-follow.php?errorDetail1');
}
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);