当前位置: 首页>>代码示例>>PHP>>正文


PHP OrderReturn::getOrdersReturnDetail方法代码示例

本文整理汇总了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())');
    }
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:33,代码来源:loyalty.php

示例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;
 }
开发者ID:zangles,项目名称:lennyba,代码行数:19,代码来源:OrderReturn.php

示例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();
    }
开发者ID:rongandat,项目名称:vatfairfoot,代码行数:19,代码来源:loyalty.php

示例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();
    }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:20,代码来源:loyalty.php


注:本文中的OrderReturn::getOrdersReturnDetail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。