• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP zen_get_products_discount_price_qty函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中zen_get_products_discount_price_qty函数的典型用法代码示例。如果您正苦于以下问题:PHP zen_get_products_discount_price_qty函数的具体用法?PHP zen_get_products_discount_price_qty怎么用?PHP zen_get_products_discount_price_qty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了zen_get_products_discount_price_qty函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: get_products

 /**
  * Method to return details of all products in the cart
  *
  * @param boolean whether to check if cart contents are valid
  * @return array
  */
 function get_products($check_for_valid_cart = false)
 {
     global $db;
     $this->notify('NOTIFIER_CART_GET_PRODUCTS_START', array(), $check_for_valid_cart);
     if (!is_array($this->contents)) {
         return false;
     }
     $products_array = array();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         $products_query = "select p.products_id, p.master_categories_id, p.products_status, pd.products_name, p.products_model, p.products_image,\n/* Dual Pricing start */\n                                  p.products_price, p.products_price_w, p.products_weight, p.products_tax_class_id,\n/* Dual Pricing end */\n                                  p.products_quantity_order_min, p.products_quantity_order_units, p.products_quantity_order_max,\n                                  p.product_is_free, p.products_priced_by_attribute,\n                                  p.products_discount_type, p.products_discount_type_from, p.products_virtual, p.product_is_always_free_shipping\n                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                           where p.products_id = '" . (int) $products_id . "'\n                           and pd.products_id = p.products_id\n                           and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'";
         if ($products = $db->Execute($products_query)) {
             $prid = $products->fields['products_id'];
             // Dual Pricing start
             if ($_SESSION['customer_id']) {
                 $customers_id = $_SESSION['customer_id'];
                 $customer_check = $db->Execute("select * from " . TABLE_CUSTOMERS . " where customers_id = '{$customers_id}'");
                 if ($customer_check->fields['customers_whole'] != "0") {
                     $i = $customer_check->fields['customers_whole'];
                     $i--;
                     $products_price_array = $products->fields['products_price_w'];
                     $productsprice = explode("-", $products_price_array);
                     $products_price = (double) $productsprice[$i];
                     if ($products_price == '0' || $products_price == '') {
                         $products_price = (double) $productsprice[0];
                     }
                     if ($products_price == '0') {
                         $products_price = $products->fields['products_price'];
                     }
                 } else {
                     $products_price = $products->fields['products_price'];
                 }
             } else {
                 $products_price = $products->fields['products_price'];
             }
             // Dual Pricing end
             //fix here
             /*
             $special_price = zen_get_products_special_price($prid);
             if ($special_price) {
             $products_price = $special_price;
             }
             */
             $special_price = zen_get_products_special_price($prid);
             if ($special_price and $products->fields['products_priced_by_attribute'] == 0) {
                 $products_price = $special_price;
             } else {
                 $special_price = 0;
             }
             if (zen_get_products_price_is_free($products->fields['products_id'])) {
                 // no charge
                 $products_price = 0;
             }
             // adjust price for discounts when priced by attribute
             if ($products->fields['products_priced_by_attribute'] == '1' and zen_has_product_attributes($products->fields['products_id'], 'false')) {
                 // reset for priced by attributes
                 //            $products_price = $products->fields['products_price'];
                 if ($special_price) {
                     $products_price = $special_price;
                 } else {
                     $products_price = $products->fields['products_price'];
                 }
             } else {
                 // discount qty pricing
                 if ($products->fields['products_discount_type'] != '0') {
                     $products_price = zen_get_products_discount_price_qty($products->fields['products_id'], $this->contents[$products_id]['qty']);
                 }
             }
             // validate cart contents for checkout
             if ($check_for_valid_cart == true) {
                 $fix_once = 0;
                 // Check products_status if not already
                 $check_status = $products->fields['products_status'];
                 if ($check_status == 0) {
                     $fix_once++;
                     $_SESSION['valid_to_checkout'] = false;
                     $_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_STATUS_SHOPPING_CART . '<br />';
                     $this->remove($products_id);
                 } else {
                     if (isset($this->contents[$products_id]['attributes'])) {
                         reset($this->contents[$products_id]['attributes']);
                         $chkcount = 0;
                         while (list(, $value) = each($this->contents[$products_id]['attributes'])) {
                             $chkcount++;
                             $chk_attributes_exist_query = "select products_id\n                                          from " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n                                          where pa.products_id = '" . (int) $products_id . "'\n                                          and pa.options_values_id = '" . (int) $value . "'";
                             $chk_attributes_exist = $db->Execute($chk_attributes_exist_query);
                             //echo 'what is it: ' . ' : ' . $products_id . ' - ' . $value . ' records: ' . $chk_attributes_exist->RecordCount() . ' vs ' . print_r($this->contents[$products_id]) . '<br>';
                             if ($chk_attributes_exist->EOF) {
                                 $fix_once++;
                                 $_SESSION['valid_to_checkout'] = false;
                                 $chk_product_attributes = $db->Execute("SELECT products_status FROM " . TABLE_PRODUCTS . " WHERE products_status = 1 and products_id = '" . $products->fields["products_id"] . "' limit 1");
                                 if (!$chk_product_attributes->EOF && $chk_product_attributes->fields['products_status'] == 1) {
                                     $chk_products_link = '<a href="' . zen_href_link(zen_get_info_page($products->fields["products_id"]), 'cPath=' . zen_get_generated_category_path_rev($products->fields["master_categories_id"]) . '&products_id=' . $products->fields["products_id"]) . '">' . $products->fields['products_name'] . '</a>';
                                 } else {
//.........这里部分代码省略.........
开发者ID:jeking928,项目名称:Dual-Pricing-2.1.6,代码行数:101,代码来源:shopping_cart.php


示例2: zen_get_discount_calc

function zen_get_discount_calc($product_id, $attributes_id = false, $attributes_amount = false, $check_qty = false)
{
    global $discount_type_id, $sale_maker_discount;
    global $cart;
    // no charge
    if ($attributes_id > 0 and $attributes_amount == 0) {
        return 0;
    }
    $new_products_price = zen_get_products_base_price($product_id);
    $new_special_price = zen_get_products_special_price($product_id, true);
    $new_sale_price = zen_get_products_special_price($product_id, false);
    $discount_type_id = zen_get_products_sale_discount_type($product_id);
    if ($new_products_price != 0) {
        $special_price_discount = $new_special_price != 0 ? $new_special_price / $new_products_price : 1;
    } else {
        $special_price_discount = '';
    }
    $sale_maker_discount = zen_get_products_sale_discount_type($product_id, '', 'amount');
    // percentage adjustment of discount
    if ($discount_type_id == 120 or $discount_type_id == 1209 or ($discount_type_id == 110 or $discount_type_id == 1109)) {
        $sale_maker_discount = $sale_maker_discount != 0 ? (100 - $sale_maker_discount) / 100 : 1;
    }
    $qty = $check_qty;
    // fix here
    // BOF: percentage discounts apply to price
    switch (true) {
        case zen_get_discount_qty($product_id, $qty) and !$attributes_id:
            // discount quanties exist and this is not an attribute
            // $this->contents[$products_id]['qty']
            $check_discount_qty_price = zen_get_products_discount_price_qty($product_id, $qty, $attributes_amount);
            //echo 'How much 1 ' . $qty . ' : ' . $attributes_amount . ' vs ' . $check_discount_qty_price . '<br />';
            return $check_discount_qty_price;
            break;
        case zen_get_discount_qty($product_id, $qty) and zen_get_products_price_is_priced_by_attributes($product_id):
            // discount quanties exist and this is not an attribute
            // $this->contents[$products_id]['qty']
            $check_discount_qty_price = zen_get_products_discount_price_qty($product_id, $qty, $attributes_amount);
            //echo 'How much 2 ' . $qty . ' : ' . $attributes_amount . ' vs ' . $check_discount_qty_price . '<br />';
            return $check_discount_qty_price;
            break;
        case $discount_type_id == 5:
            // No Sale and No Special
            //        $sale_maker_discount = 1;
            if (!$attributes_id) {
                $sale_maker_discount = $sale_maker_discount;
            } else {
                // compute attribute amount
                if ($attributes_amount != 0) {
                    if ($special_price_discount != 0) {
                        $calc = $attributes_amount * $special_price_discount;
                    } else {
                        $calc = $attributes_amount;
                    }
                    $sale_maker_discount = $calc;
                } else {
                    $sale_maker_discount = $sale_maker_discount;
                }
            }
            //echo 'How much 3 - ' . $qty . ' : ' . $product_id . ' : ' . $qty . ' x ' .  $attributes_amount . ' vs ' . $check_discount_qty_price . ' - ' . $sale_maker_discount . '<br />';
            break;
        case $discount_type_id == 59:
            // No Sale and Special
            //        $sale_maker_discount = $special_price_discount;
            if (!$attributes_id) {
                $sale_maker_discount = $sale_maker_discount;
            } else {
                // compute attribute amount
                if ($attributes_amount != 0) {
                    $calc = $attributes_amount * $special_price_discount;
                    $sale_maker_discount = $calc;
                } else {
                    $sale_maker_discount = $sale_maker_discount;
                }
            }
            break;
            // EOF: percentage discount apply to price
            // BOF: percentage discounts apply to Sale
        // EOF: percentage discount apply to price
        // BOF: percentage discounts apply to Sale
        case $discount_type_id == 120:
            // percentage discount Sale and Special without a special
            if (!$attributes_id) {
                $sale_maker_discount = $sale_maker_discount;
            } else {
                // compute attribute amount
                if ($attributes_amount != 0) {
                    $calc = $attributes_amount * $sale_maker_discount;
                    $sale_maker_discount = $calc;
                } else {
                    $sale_maker_discount = $sale_maker_discount;
                }
            }
            break;
        case $discount_type_id == 1209:
            // percentage discount on Sale and Special with a special
            if (!$attributes_id) {
                $sale_maker_discount = $sale_maker_discount;
            } else {
                // compute attribute amount
                if ($attributes_amount != 0) {
//.........这里部分代码省略.........
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:101,代码来源:functions_prices.php


示例3: get_products

 /**
  * Method to return details of all products in the cart
  *
  * @param boolean whether to check if cart contents are valid
  * @return array
  */
 function get_products($check_for_valid_cart = false)
 {
     global $db;
     $this->notify('NOTIFIER_CART_GET_PRODUCTS_START');
     if (!is_array($this->contents)) {
         return false;
     }
     $products_array = array();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         $products_query = "select p.products_id, p.master_categories_id, p.products_status, pd.products_name, p.products_model, p.products_image,\n                                  p.products_price,p.products_price_sample, p.products_weight, p.products_tax_class_id,\n                                  p.products_quantity_order_min, p.products_quantity_order_units,\n                                  p.product_is_free, p.products_priced_by_attribute,\n                                  p.products_discount_type, p.products_discount_type_from\n                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                           where p.products_id = '" . (int) $products_id . "'\n                           and pd.products_id = p.products_id\n                           and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'";
         if ($products = $db->Execute($products_query)) {
             $prid = $products->fields['products_id'];
             $products_price = $products->fields['products_price'] == 0 ? $products->fields['products_price_sample'] : $products->fields['products_price'];
             //fix here
             /*
             $special_price = zen_get_products_special_price($prid);
             if ($special_price) {
             $products_price = $special_price;
             }
             */
             $special_price = zen_get_products_special_price($prid);
             if ($special_price and $products->fields['products_priced_by_attribute'] == 0) {
                 $products_price = $special_price;
             } else {
                 $special_price = 0;
             }
             if (zen_get_products_price_is_free($products->fields['products_id'])) {
                 // no charge
                 $products_price = 0;
             }
             // adjust price for discounts when priced by attribute
             if ($products->fields['products_priced_by_attribute'] == '1' and zen_has_product_attributes($products->fields['products_id'], 'false')) {
                 // reset for priced by attributes
                 //            $products_price = $products->fields['products_price'];
                 if ($special_price) {
                     $products_price = $special_price;
                 } else {
                     $products_price = $products->fields['products_price'];
                 }
             } else {
                 // discount qty pricing
                 $categories_query = $db->Execute("SELECT categories_discount_type FROM " . TABLE_CATEGORIES . " WHERE categories_id = " . zen_get_products_category_id($products_id));
                 if ($products->fields['products_discount_type'] != 0 || $categories_query->fields['categories_discount_type'] != 0) {
                     $products_price = zen_get_products_discount_price_qty($products->fields['products_id'], $this->contents[$products_id]['qty']);
                 }
             }
             // validate cart contents for checkout
             if ($check_for_valid_cart == true) {
                 $fix_once = 0;
                 // Check products_status if not already
                 $check_status = $products->fields['products_status'];
                 if ($check_status == 0) {
                     $fix_once++;
                     $_SESSION['valid_to_checkout'] = false;
                     $_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_STATUS_SHOPPING_CART . '<br />';
                     $this->remove($products_id);
                 }
                 // check only if valid products_status
                 if ($fix_once == 0) {
                     $check_quantity = $this->contents[$products_id]['qty'];
                     $check_quantity_min = $products->fields['products_quantity_order_min'];
                     // Check quantity min
                     if ($new_check_quantity = $this->in_cart_mixed($prid)) {
                         $check_quantity = $new_check_quantity;
                     }
                 }
                 if ($fix_once == 0) {
                     if ($check_quantity < $check_quantity_min) {
                         $fix_once++;
                         $_SESSION['valid_to_checkout'] = false;
                         $_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_MIN_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
                     }
                 }
                 // Check Quantity Units if not already an error on Quantity Minimum
                 if ($fix_once == 0) {
                     $check_units = $products->fields['products_quantity_order_units'];
                     if (fmod_round($check_quantity, $check_units) != 0) {
                         $_SESSION['valid_to_checkout'] = false;
                         $_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_UNITS_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
                     }
                 }
                 // Verify Valid Attributes
             }
             //clr 030714 update $products_array to include attribute value_text. This is needed for text attributes.
             // convert quantity to proper decimals
             if (QUANTITY_DECIMALS != 0) {
                 //          $new_qty = round($new_qty, QUANTITY_DECIMALS);
                 $fix_qty = $this->contents[$products_id]['qty'];
                 switch (true) {
                     case !strstr($fix_qty, '.'):
                         $new_qty = $fix_qty;
                         break;
                     default:
//.........这里部分代码省略.........
开发者ID:happyxlq,项目名称:lt_svn,代码行数:101,代码来源:shopping_cart.php


示例4: get_products

 /**
  * Method to return details of all products in the cart
  *
  * @param boolean whether to check if cart contents are valid
  * @return array
  */
 public function get_products($check_for_valid_cart = false)
 {
     $this->notify('NOTIFIER_CART_GET_PRODUCTS_START');
     if (!is_array($this->contents)) {
         return false;
     }
     $products_array = array();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         $products_query = "select p.products_id, p.master_categories_id, p.products_status, pd.products_name, p.products_model, p.products_image,\n                p.products_price, p.products_weight, p.products_tax_class_id,\n                p.products_quantity_order_min, p.products_quantity_order_units, p.products_quantity_order_max,\n                p.product_is_free, p.products_priced_by_attribute,\n                p.products_discount_type, p.products_discount_type_from\n                from %table.products% p, %table.products_description% pd\n                where p.products_id = '" . (int) $products_id . "'\n                and pd.products_id = p.products_id\n                and pd.language_id = '" . (int) $this->getSessionVar('languages_id') . "'";
         if ($products = $this->getDb()->Execute($products_query)) {
             $prid = $products->fields['products_id'];
             $products_price = $products->fields['products_price'];
             //fix here
             /*
                     $special_price = zen_get_products_special_price($prid);
                     if ($special_price) {
                     $products_price = $special_price;
                     }
             */
             $special_price = zen_get_products_special_price($prid);
             if ($special_price and $products->fields['products_priced_by_attribute'] == 0) {
                 $products_price = $special_price;
             } else {
                 $special_price = 0;
             }
             if (zen_get_products_price_is_free($products->fields['products_id'])) {
                 // no charge
                 $products_price = 0;
             }
             // adjust price for discounts when priced by attribute
             if ($products->fields['products_priced_by_attribute'] == '1' and zen_has_product_attributes($products->fields['products_id'], 'false')) {
                 if ($special_price) {
                     $products_price = $special_price;
                 } else {
                     $products_price = $products->fields['products_price'];
                 }
             } else {
                 // discount qty pricing
                 if ($products->fields['products_discount_type'] != '0') {
                     $products_price = zen_get_products_discount_price_qty($products->fields['products_id'], $this->contents[$products_id]['qty']);
                 }
             }
             // validate cart contents for checkout
             if ($check_for_valid_cart == true) {
                 $fix_once = 0;
                 // Check products_status if not already
                 $check_status = $products->fields['products_status'];
                 if ($check_status == 0) {
                     $fix_once++;
                     $this->setSessionVar('valid_to_checkout', false);
                     $cart_errors = $this->getSessionVar('cart_errors');
                     $cart_errors .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_STATUS_SHOPPING_CART . '<br />';
                     $this->setSessionVar('cart_errors', $cart_errors);
                     $this->remove($products_id);
                 } else {
                     if (isset($this->contents[$products_id]['attributes'])) {
                         reset($this->contents[$products_id]['attributes']);
                         $chkcount = 0;
                         while (list(, $value) = each($this->contents[$products_id]['attributes'])) {
                             $chkcount++;
                             $chk_attributes_exist_query = "select products_id\n                                    from %table.products_attributes% pa\n                                    where pa.products_id = '" . (int) $products_id . "'\n                                    and pa.options_values_id = '" . (int) $value . "'";
                             $chk_attributes_exist = $this->getDb()->Execute($chk_attributes_exist_query);
                             if ($chk_attributes_exist->EOF) {
                                 $fix_once++;
                                 $this->setSessionVar('valid_to_checkout', false);
                                 $cart_errors = $this->getSessionVar('cart_errors');
                                 $cart_errors .= ERROR_PRODUCT_ATTRIBUTES . $products->fields['products_name'] . ERROR_PRODUCT_STATUS_SHOPPING_CART_ATTRIBUTES . '<br />';
                                 $this->setSessionVar('cart_errors', $cart_errors);
                                 $this->remove($products_id);
                                 break;
                             }
                         }
                     }
                 }
                 // check only if valid products_status
                 if ($fix_once == 0) {
                     $check_quantity = $this->contents[$products_id]['qty'];
                     $check_quantity_min = $products->fields['products_quantity_order_min'];
                     // Check quantity min
                     if ($new_check_quantity = $this->in_cart_mixed($prid)) {
                         $check_quantity = $new_check_quantity;
                     }
                 }
                 // Check Quantity Max if not already an error on Minimum
                 if ($fix_once == 0) {
                     if ($products->fields['products_quantity_order_max'] != 0 && $check_quantity > $products->fields['products_quantity_order_max']) {
                         $fix_once++;
                         $this->setSessionVar('valid_to_checkout', false);
                         $cart_errors = $this->getSessionVar('cart_errors');
                         $cart_errors .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_MAX_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
                         $this->setSessionVar('cart_errors', $cart_errors);
                     }
                 }
//.........这里部分代码省略.........
开发者ID:zenmagick,项目名称:zenmagick,代码行数:101,代码来源:ShoppingCart.php


示例5: eo_get_new_product

function eo_get_new_product($product_id, $product_qty = 1, $product_options = array(), $use_specials = true)
{
    global $db;
    $product_id = (int) $product_id;
    $product_qty = (double) $product_qty;
    $retval = array('id' => $product_id, 'qty' => $product_qty);
    $query = $db->Execute('SELECT `p`.`products_id`, `p`.`master_categories_id`, `p`.`products_status`, ' . '`pd`.`products_name`, `p`.`products_model`, `p`.`products_image`, `p`.`products_price`, ' . '`p`.`products_weight`, `p`.`products_tax_class_id`, `p`.`manufacturers_id`, ' . '`p`.`products_quantity_order_min`, `p`.`products_quantity_order_units`, ' . '`p`.`products_quantity_order_max`, `p`.`product_is_free`, `p`.`products_virtual`, ' . '`p`.`products_discount_type`, `p`.`products_discount_type_from`, ' . '`p`.`products_priced_by_attribute`, `p`.`product_is_always_free_shipping` ' . 'FROM `' . TABLE_PRODUCTS . '` AS `p`, `' . TABLE_PRODUCTS_DESCRIPTION . '` AS `pd` ' . 'WHERE `p`.`products_id`=\'' . (int) $product_id . '\' ' . 'AND `pd`.`products_id`=`p`.`products_id` ' . 'AND `pd`.`language_id`=\'' . (int) $_SESSION['languages_id'] . '\'');
    if (!$query->EOF) {
        // Handle common fields
        $retval = array_merge($retval, array('name' => $query->fields['products_name'], 'model' => $query->fields['products_model'], 'price' => $query->fields['products_price'], 'products_discount_type' => $query->fields['products_discount_type'], 'products_discount_type_from' => $query->fields['products_discount_type_from'], 'products_priced_by_attribute' => $query->fields['products_priced_by_attribute'], 'product_is_free' => $query->fields['product_is_free'], 'products_virtual' => $query->fields['products_virtual'], 'product_is_always_free_shipping' => $query->fields['product_is_always_free_shipping'], 'tax' => number_format(zen_get_tax_rate_value($query->fields['products_tax_class_id']), 4), 'tax_description' => zen_get_tax_description($query->fields['products_tax_class_id'])));
        // Handle pricing
        $special_price = zen_get_products_special_price($product_id);
        if ($use_specials && $special_price && $retval['products_priced_by_attribute'] == 0) {
            $retval['price'] = $special_price;
        } else {
            $special_price = 0;
        }
        if (zen_get_products_price_is_free($product_id)) {
            // no charge
            $retval['price'] = 0;
        }
        // adjust price for discounts when priced by attribute
        if ($retval['products_priced_by_attribute'] == '1' && zen_has_product_attributes($product_id, 'false')) {
            // reset for priced by attributes
            if ($special_price) {
                $retval['price'] = $special_price;
            } else {
                $retval['price'] = $query->fields['products_price'];
                // START MARKUP
                if (isset($GLOBALS['priceMarkup'])) {
                    $retval['price'] = $GLOBALS['priceMarkup']->calculatePrice($product_id, $query->fields['manufacturers_id'], $query->fields['master_categories_id'], $retval['price']);
                }
                // END MARKUP
            }
        } else {
            // discount qty pricing
            if ($retval['products_discount_type'] != '0') {
                $retval['price'] = zen_get_products_discount_price_qty($product_id, $retval['qty']);
            }
            // START MARKUP
            if (isset($GLOBALS['priceMarkup'])) {
                $retval['price'] = $GLOBALS['priceMarkup']->calculatePrice($product_id, $query->fields['manufacturers_id'], $query->fields['master_categories_id'], $retval['price']);
            }
            // END MARKUP
        }
        unset($special_price);
        $retval['onetime_charges'] = 0;
        $retval['final_price'] = $retval['price'];
    }
    // Handle attributes
    if (is_array($product_options) && count($product_options > 0)) {
        $retval['attributes'] = array();
        include_once DIR_WS_CLASSES . 'attributes.php';
        $attributes = new attributes();
        foreach ($product_options as $option_id => $details) {
            $attr = array();
            switch ($details['type']) {
                case PRODUCTS_OPTIONS_TYPE_TEXT:
                case PRODUCTS_OPTIONS_TYPE_FILE:
                    $attr['option_id'] = $option_id;
                    $attr['value'] = $details['value'];
                    if ($attr['value'] == '') {
                        continue 2;
                    }
                    // There should only be one text per name.....
                    $get_attr_id = $attributes->get_attributes_by_option($product_id, $option_id);
                    if (count($get_attr_id) == 1) {
                        $details['value'] = $get_attr_id[0]['products_attributes_id'];
                    }
                    unset($get_attr_id);
                    break;
                case PRODUCTS_OPTIONS_TYPE_CHECKBOX:
                    if (!array_key_exists('value', $details)) {
                        continue 2;
                    }
                    $tmp_id = array_shift($details['value']);
                    foreach ($details['value'] as $attribute_id) {
                        // We only get here if more than one checkbox per
                        // option was selected.
                        $tmp = $attributes->get_attribute_by_id($attribute_id, 'order');
                        $retval['attributes'][] = $tmp;
                        // Handle pricing
                        $prices = eo_get_product_attribute_prices($attribute_id, $tmp['value'], $product_qty);
                        unset($tmp);
                        if (!$query->EOF) {
                            $retval['onetime_charges'] += $prices['onetime_charges'];
                            $retval['final_price'] += $prices['price'];
                        }
                    }
                    $details['value'] = $tmp_id;
                    $attr = $attributes->get_attribute_by_id($details['value'], 'order');
                    unset($attribute_id);
                    unset($attribute_value);
                    unset($tmp_id);
                    break;
                default:
                    $attr = $attributes->get_attribute_by_id($details['value'], 'order');
            }
            $retval['attributes'][] = $attr;
            if (!$query->EOF) {
//.........这里部分代码省略.........
开发者ID:bislewl,项目名称:super_edit_orders_with_ty,代码行数:101,代码来源:edit_orders_functions.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP zen_get_products_display_price函数代码示例发布时间:2022-05-23
下一篇:
PHP zen_get_products_description函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap