本文整理匯總了PHP中OrderReturn::getOrdersReturnDetail方法的典型用法代碼示例。如果您正苦於以下問題:PHP OrderReturn::getOrdersReturnDetail方法的具體用法?PHP OrderReturn::getOrdersReturnDetail怎麽用?PHP OrderReturn::getOrdersReturnDetail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OrderReturn
的用法示例。
在下文中一共展示了OrderReturn::getOrdersReturnDetail方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: hookOrderReturn
public function hookOrderReturn($params)
{
$result = Db::getInstance()->getRow('
SELECT f.id_loyalty
FROM `' . _DB_PREFIX_ . 'loyalty` f
WHERE f.id_customer = ' . intval($params['orderReturn']->id_customer) . '
AND f.id_order = ' . intval($params['orderReturn']->id_order));
$loyalty = new LoyaltyModule(intval($result['id_loyalty']));
if (!Validate::isLoadedObject($loyalty)) {
return false;
}
$totalPrice = 0;
$details = OrderReturn::getOrdersReturnDetail($params['orderReturn']->id);
foreach ($details as $detail) {
$result = Db::getInstance()->getRow('
SELECT product_price * (1 + (tax_rate / 100)) AS ttc
FROM ' . _DB_PREFIX_ . 'order_detail od
WHERE id_order_detail = ' . intval($detail['id_order_detail']));
$totalPrice += $result['ttc'] * $detail['product_quantity'];
}
$canceledTotal = floor($totalPrice / floatval(Configuration::get('PS_LOYALTY_POINT_RATE')));
if ($canceledTotal > $loyalty->points) {
$canceledTotal = $loyalty->points;
}
Db::getInstance()->Execute('
INSERT INTO `' . _DB_PREFIX_ . 'loyalty_history` (`id_loyalty`, `id_loyalty_state`, `points`, `date_add`)
VALUES (' . intval($loyalty->id) . ', ' . intval(LoyaltyStateModule::getCancelId()) . ', -' . intval($canceledTotal) . ', NOW())');
$loyalty->points -= $canceledTotal;
$loyalty->update();
Db::getInstance()->Execute('
INSERT INTO `' . _DB_PREFIX_ . 'loyalty_history` (`id_loyalty`, `id_loyalty_state`, `points`, `date_add`)
VALUES (' . intval($loyalty->id) . ', ' . intval(LoyaltyStateModule::getValidationId()) . ', ' . intval($loyalty->points) . ', NOW())');
}
示例2: getOrdersReturnProducts
public static function getOrdersReturnProducts($orderReturnId, $order)
{
$productsRet = OrderReturn::getOrdersReturnDetail($orderReturnId);
$products = $order->getProducts();
$tmp = array();
foreach ($productsRet as $return_detail) {
$tmp[$return_detail['id_order_detail']]['quantity'] = isset($tmp[$return_detail['id_order_detail']]['quantity']) ? $tmp[$return_detail['id_order_detail']]['quantity'] + (int) $return_detail['product_quantity'] : (int) $return_detail['product_quantity'];
$tmp[$return_detail['id_order_detail']]['customizations'] = (int) $return_detail['id_customization'];
}
$resTab = array();
foreach ($products as $key => $product) {
if (isset($tmp[$product['id_order_detail']])) {
$resTab[$key] = $product;
$resTab[$key]['product_quantity'] = $tmp[$product['id_order_detail']]['quantity'];
$resTab[$key]['customizations'] = $tmp[$product['id_order_detail']]['customizations'];
}
}
return $resTab;
}
示例3: hookOrderReturn
public function hookOrderReturn($params)
{
include_once dirname(__FILE__) . '/LoyaltyStateModule.php';
include_once dirname(__FILE__) . '/LoyaltyModule.php';
$total_price = 0;
$details = OrderReturn::getOrdersReturnDetail((int) $params['orderReturn']->id);
foreach ($details as $detail) {
$total_price += Db::getInstance()->getValue('
SELECT ROUND(total_price_tax_incl, 2)
FROM ' . _DB_PREFIX_ . 'order_detail od
WHERE id_order_detail = ' . (int) $detail['id_order_detail']);
}
$loyalty_new = new LoyaltyModule();
$loyalty_new->points = (int) (-1 * LoyaltyModule::getNbPointsByPrice($total_price));
$loyalty_new->id_loyalty_state = (int) LoyaltyStateModule::getCancelId();
$loyalty_new->id_order = (int) $params['orderReturn']->id_order;
$loyalty_new->id_customer = (int) $params['orderReturn']->id_customer;
$loyalty_new->save();
}
示例4: hookOrderReturn
public function hookOrderReturn($params)
{
include_once dirname(__FILE__) . '/LoyaltyStateModule.php';
include_once dirname(__FILE__) . '/LoyaltyModule.php';
$totalPrice = 0;
$details = OrderReturn::getOrdersReturnDetail((int) $params['orderReturn']->id);
foreach ($details as $detail) {
$price_wt = Db::getInstance()->getValue('
SELECT product_price * (1 + (tax_rate / 100)) price
FROM ' . _DB_PREFIX_ . 'order_detail od
WHERE id_order_detail = ' . (int) $detail['id_order_detail']);
$totalPrice += number_format($price_wt, 2, '.', '') * $detail['product_quantity'];
}
$loyaltyNew = new LoyaltyModule();
$loyaltyNew->points = (int) (-1 * LoyaltyModule::getNbPointsByPrice($totalPrice));
$loyaltyNew->id_loyalty_state = (int) LoyaltyStateModule::getCancelId();
$loyaltyNew->id_order = (int) $params['orderReturn']->id_order;
$loyaltyNew->id_customer = (int) $params['orderReturn']->id_customer;
$loyaltyNew->save();
}