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


PHP zen_get_products_stock函数代码示例

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


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

示例1: getLineItemDetails


//.........这里部分代码省略.........
                 if ($shipping_tax_basis == 'Billing') {
                     $shipping_tax = $shippingOnBilling;
                 } elseif ($shipping_tax_basis == 'Shipping') {
                     $shipping_tax = $shippingOnDelivery;
                 } else {
                     if (STORE_ZONE == $order->billing['zone_id']) {
                         $shipping_tax = $shippingOnBilling;
                     } elseif (STORE_ZONE == $order->delivery['zone_id']) {
                         $shipping_tax = $shippingOnDelivery;
                     } else {
                         $shipping_tax = 0;
                     }
                 }
                 $taxAdjustmentForShipping = zen_round(zen_calculate_tax($order->info['shipping_cost'], $shipping_tax), $currencies->currencies[$_SESSION['currency']]['decimal_places']);
                 $optionsST['SHIPPINGAMT'] += $taxAdjustmentForShipping;
                 $optionsST['TAXAMT'] -= $taxAdjustmentForShipping;
             }
         }
         $flagSubtotalsUnknownYet = $optionsST['SHIPPINGAMT'] + $optionsST['SHIPDISCAMT'] + $optionsST['AMT'] + $optionsST['TAXAMT'] + $optionsST['ITEMAMT'] + $optionsST['INSURANCEAMT'] == 0;
     } else {
         // if we get here, we don't have any order-total information yet because the customer has clicked Express before starting normal checkout flow
         // thus, we must make a note to manually calculate subtotals, rather than relying on the more robust order-total infrastructure
         $flagSubtotalsUnknownYet = TRUE;
     }
     // loop thru all products to prepare details of quantity and price.
     for ($i = 0, $n = sizeof($order->products), $k = 0; $i < $n; $i++, $k++) {
         // PayPal won't accept zero-value line-items, so skip this entry if price is zero
         if ($order->products[$i]['final_price'] == 0) {
             continue;
         }
         $optionsLI["L_NUMBER{$k}"] = $order->products[$i]['model'];
         $optionsLI["L_NAME{$k}"] = $order->products[$i]['name'];
         // Append *** if out-of-stock.
         $optionsLI["L_NAME{$k}"] .= zen_get_products_stock($order->products[$i]['id']) - $order->products[$i]['qty'] < 0 ? STOCK_MARK_PRODUCT_OUT_OF_STOCK : '';
         // if there are attributes, loop thru them and add to description
         if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0) {
             $optionsLI["L_DESC{$k}"] = '';
             for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                 $optionsLI["L_DESC{$k}"] .= "\n " . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
             }
             // end loop
         }
         // endif attribute-info
         // check for rounding problems with taxes
         $m1 = zen_round($order->products[$i]['qty'] * $order->products[$i]['final_price'], $currencies->currencies[$_SESSION['currency']]['decimal_places']);
         $m2 = $order->products[$i]['qty'] * zen_round($order->products[$i]['final_price'], $currencies->currencies[$_SESSION['currency']]['decimal_places']);
         $n1 = $order->products[$i]['qty'] * zen_calculate_tax($order->products[$i]['final_price'], $order->products[$i]['tax']);
         $n2 = zen_calculate_tax($order->products[$i]['qty'] * $order->products[$i]['final_price'], $order->products[$i]['tax']);
         if ($m1 != $m2 || zen_round($n1, $currencies->currencies[$_SESSION['currency']]['decimal_places']) != zen_round($n2, $currencies->currencies[$_SESSION['currency']]['decimal_places'])) {
             $flag_treat_as_partial = true;
         }
         // PayPal can't handle partial-quantity values, so fudge it here
         if ($flag_treat_as_partial || $order->products[$i]['qty'] != (int) $order->products[$i]['qty']) {
             $optionsLI["L_NAME{$k}"] = '(' . $order->products[$i]['qty'] . ' x ) ' . $optionsLI["L_NAME{$k}"];
             $optionsLI["L_AMT{$k}"] = zen_round($order->products[$i]['qty'] * $order->products[$i]['final_price'], $currencies->currencies[$_SESSION['currency']]['decimal_places']);
             $optionsLI["L_TAXAMT{$k}"] = zen_calculate_tax(zen_round($order->products[$i]['qty'] * $order->products[$i]['final_price'], $currencies->currencies[$_SESSION['currency']]['decimal_places']), $order->products[$i]['tax']);
             $optionsLI["L_QTY{$k}"] = 1;
         } else {
             $optionsLI["L_AMT{$k}"] = $order->products[$i]['final_price'];
             $optionsLI["L_QTY{$k}"] = $order->products[$i]['qty'];
             $optionsLI["L_TAXAMT{$k}"] = zen_calculate_tax(1 * $order->products[$i]['final_price'], $order->products[$i]['tax']);
         }
         // For tax-included pricing, combine tax with price instead of treating separately:
         if (DISPLAY_PRICE_WITH_TAX == 'true') {
             $optionsLI["L_AMT{$k}"] += $optionsLI["L_TAXAMT{$k}"];
             $optionsLI["L_TAXAMT{$k}"] = 0;
开发者ID:dalinhuang,项目名称:yijinhuanxiang,代码行数:67,代码来源:paypalwpp.php

示例2: getLineItemDetails

 /**
  * Prepare subtotal and line-item detail content to send to PayPal
  */
 function getLineItemDetails()
 {
     global $order, $currencies, $order_totals, $order_total_modules;
     $optionsST = array();
     $optionsLI = array();
     $onetimeSum = 0;
     $onetimeTax = 0;
     $creditsApplied = 0;
     $creditsTax_applied = 0;
     $sumOfLineItems = 0;
     $sumOfLineTax = 0;
     // prepare subtotals
     for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
         if ($order_totals[$i]['code'] == 'ot_subtotal') {
             $optionsST['ITEMAMT'] = round($order_totals[$i]['value'], 2);
         }
         if ($order_totals[$i]['code'] == 'ot_tax') {
             $optionsST['TAXAMT'] = round($order_totals[$i]['value'], 2);
         }
         if ($order_totals[$i]['code'] == 'ot_shipping') {
             $optionsST['SHIPPINGAMT'] = round($order_totals[$i]['value'], 2);
         }
         if ($order_totals[$i]['code'] == 'ot_total') {
             $optionsST['AMT'] = round($order_totals[$i]['value'], 2);
         }
         $optionsST['HANDLINGAMT'] = 0;
         global ${$order_totals[$i]['code']};
         if (isset(${$order_totals[$i]['code']}->credit_class) && ${$order_totals[$i]['code']}->credit_class == true) {
             $creditsApplied += round($order_totals[$i]['value'], 2);
         }
         // treat all other OT's as if they're related to handling fees
         if (!in_array($order_totals[$i]['code'], array('ot_total', 'ot_subtotal', 'ot_tax', 'ot_shipping')) && !(isset(${$order_totals[$i]['code']}->credit_class) && ${$order_totals[$i]['code']}->credit_class == true)) {
             $optionsST['HANDLINGAMT'] += $order_totals[$i]['value'];
         }
     }
     // Move shipping tax amount from Tax subtotal into Shipping subtotal for submission to PayPal
     $module = substr($_SESSION['shipping']['id'], 0, strpos($_SESSION['shipping']['id'], '_'));
     if (zen_not_null($order->info['shipping_method'])) {
         if ($GLOBALS[$module]->tax_class > 0) {
             $shipping_tax_basis = !isset($GLOBALS[$module]->tax_basis) ? STORE_SHIPPING_TAX_BASIS : $GLOBALS[$module]->tax_basis;
             $shippingOnBilling = zen_get_tax_rate($GLOBALS[$module]->tax_class, $order->billing['country']['id'], $order->billing['zone_id']);
             $shippingOnDelivery = zen_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
             if ($shipping_tax_basis == 'Billing') {
                 $shipping_tax = $shippingOnBilling;
             } elseif ($shipping_tax_basis == 'Shipping') {
                 $shipping_tax = $shippingOnDelivery;
             } else {
                 if (STORE_ZONE == $order->billing['zone_id']) {
                     $shipping_tax = $shippingOnBilling;
                 } elseif (STORE_ZONE == $order->delivery['zone_id']) {
                     $shipping_tax = $shippingOnDelivery;
                 } else {
                     $shipping_tax = 0;
                 }
             }
             $taxAdjustmentForShipping = zen_calculate_tax($order->info['shipping_cost'], $shipping_tax);
             $optionsST['SHIPPINGAMT'] += $taxAdjustmentForShipping;
             $optionsST['TAXAMT'] -= $taxAdjustmentForShipping;
         }
     }
     // loop thru all products to display quantity and price. Appends *** if out-of-stock.
     for ($i = 0, $n = sizeof($order->products), $k = 0; $i < $n; $i++, $k++) {
         $optionsLI["L_NUMBER{$k}"] = $order->products[$i]['model'];
         $optionsLI["L_QTY{$k}"] = (int) $order->products[$i]['qty'];
         $optionsLI["L_NAME{$k}"] = $order->products[$i]['name'];
         $optionsLI["L_NAME{$k}"] .= zen_get_products_stock($order->products[$i]['id']) - $order->products[$i]['qty'] < 0 ? STOCK_MARK_PRODUCT_OUT_OF_STOCK : '';
         // if there are attributes, loop thru them and add to description
         if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0) {
             for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                 $optionsLI["L_NAME{$k}"] .= "\n " . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
             }
             // end loop
         }
         // endif attribute-info
         $optionsLI["L_AMT{$k}"] = $order->products[$i]['final_price'];
         $optionsLI["L_TAXAMT{$k}"] = zen_calculate_tax($order->products[$i]['final_price'], $order->products[$i]['tax']);
         // track one-time charges
         if ($order->products[$i]['onetime_charges'] != 0) {
             $onetimeSum += $order->products[$i]['onetime_charges'];
             $onetimeTax += zen_calculate_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']);
         }
         // Replace & and = with * if found.
         $optionsLI["L_NAME{$k}"] = str_replace(array('&', '='), '*', $optionsLI["L_NAME{$k}"]);
         $optionsLI["L_NAME{$k}"] = zen_clean_html($optionsLI["L_NAME{$k}"], 'strong');
         // reformat properly
         $optionsLI["L_NUMBER{$k}"] = substr($optionsLI["L_NUMBER{$k}"], 0, 127);
         $optionsLI["L_NAME{$k}"] = substr($optionsLI["L_NAME{$k}"], 0, 127);
         $optionsLI["L_AMT{$k}"] = $optionsLI["L_AMT{$k}"];
         $optionsLI["L_TAXAMT{$k}"] = round($optionsLI["L_TAXAMT{$k}"], 2);
     }
     // end for loopthru all products
     if ($onetimeSum > 0) {
         $i++;
         $k++;
         $optionsLI["L_NUMBER{$k}"] = $k;
         $optionsLI["L_NAME{$k}"] = 'One-Time Charges';
         $optionsLI["L_AMT{$k}"] = $onetimeSum;
//.........这里部分代码省略.........
开发者ID:BGCX067,项目名称:ez-commerce-svn-to-git,代码行数:101,代码来源:paypalwpp.php

示例3: zen_check_stock

/**
 * Check if the required stock is available.
 *
 * If insufficent stock is available return an out of stock message
 *
 * @param int The product id of the product whos's stock is to be checked
 * @param int Is this amount of stock available
 *
 * @TODO naughty html in a function
*/
function zen_check_stock($products_id, $products_quantity)
{
    $stock_left = zen_get_products_stock($products_id) - $products_quantity;
    $out_of_stock = '';
    if ($stock_left < 0) {
        $out_of_stock = '<span class="markProductOutOfStock">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</span>';
    }
    return $out_of_stock;
}
开发者ID:bobjacobsen,项目名称:EventTools,代码行数:19,代码来源:functions_lookups.php

示例4: actionMultipleAddProduct

 /**
  * Method to handle cart Action - multiple add products
  *
  * @param string forward destination
  * @param url parameters
  * @todo change while loop to a foreach
  */
 function actionMultipleAddProduct($goto, $parameters)
 {
     global $messageStack;
     if ($this->display_debug_messages) {
         $messageStack->add_session('header', 'FUNCTION ' . __FUNCTION__, 'caution');
     }
     $addCount = 0;
     if (is_array($_POST['products_id']) && sizeof($_POST['products_id']) > 0) {
         //echo '<pre>'; echo var_dump($_POST['products_id']); echo '</pre>';
         while (list($key, $val) = each($_POST['products_id'])) {
             $prodId = preg_replace('/[^0-9a-f:.]/', '', $key);
             if (is_numeric($val) && $val > 0) {
                 $adjust_max = false;
                 $qty = $val;
                 $add_max = zen_get_products_quantity_order_max($prodId);
                 $cart_qty = $this->in_cart_mixed($prodId);
                 $new_qty = $this->adjust_quantity($qty, $prodId, 'shopping_cart');
                 // bof: adjust new quantity to be same as current in stock
                 $chk_current_qty = zen_get_products_stock($prodId);
                 if (STOCK_ALLOW_CHECKOUT == 'false' && $new_qty > $chk_current_qty) {
                     $new_qty = $chk_current_qty;
                     $messageStack->add_session('shopping_cart', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . WARNING_PRODUCT_QUANTITY_ADJUSTED . zen_get_products_name($prodId), 'caution');
                 }
                 // eof: adjust new quantity to be same as current in stock
                 if ($add_max == 1 and $cart_qty == 1) {
                     // do not add
                     $adjust_max = 'true';
                 } else {
                     // bof: adjust new quantity to be same as current in stock
                     if (STOCK_ALLOW_CHECKOUT == 'false' && $new_qty + $cart_qty > $chk_current_qty) {
                         $adjust_new_qty = 'true';
                         $alter_qty = $chk_current_qty - $cart_qty;
                         $new_qty = $alter_qty > 0 ? $alter_qty : 0;
                         $messageStack->add_session('shopping_cart', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . WARNING_PRODUCT_QUANTITY_ADJUSTED . zen_get_products_name($prodId), 'caution');
                     }
                     // eof: adjust new quantity to be same as current in stock
                     // adjust quantity if needed
                     if ($new_qty + $cart_qty > $add_max and $add_max != 0) {
                         $adjust_max = 'true';
                         $new_qty = $add_max - $cart_qty;
                     }
                     $this->add_cart($prodId, $this->get_quantity($prodId) + $new_qty);
                     $addCount++;
                 }
                 if ($adjust_max == 'true') {
                     if ($this->display_debug_messages) {
                         $messageStack->add_session('header', 'FUNCTION ' . __FUNCTION__ . '<br>' . ERROR_MAXIMUM_QTY . zen_get_products_name($prodId), 'caution');
                     }
                     $messageStack->add_session('shopping_cart', ERROR_MAXIMUM_QTY . zen_get_products_name($prodId), 'caution');
                 }
             }
             if (!is_numeric($val) || $val < 0) {
                 // adjust quantity when not a value
                 $chk_link = '<a href="' . zen_href_link(zen_get_info_page($prodId), 'cPath=' . zen_get_generated_category_path_rev(zen_get_products_category_id($prodId)) . '&products_id=' . $prodId) . '">' . zen_get_products_name($prodId) . '</a>';
                 $messageStack->add_session('header', ERROR_CORRECTIONS_HEADING . ERROR_PRODUCT_QUANTITY_UNITS_SHOPPING_CART . $chk_link . ' ' . PRODUCTS_ORDER_QTY_TEXT . zen_output_string_protected($val), 'caution');
                 $val = 0;
             }
         }
         // display message if all is good and not on shopping_cart page
         if ($addCount && DISPLAY_CART == 'false' && $_GET['main_page'] != FILENAME_SHOPPING_CART && $messageStack->size('shopping_cart') == 0) {
             $messageStack->add_session('header', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . SUCCESS_ADDED_TO_CART_PRODUCTS, 'success');
         } else {
             if (DISPLAY_CART == 'false') {
                 zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
             }
         }
         zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
     }
 }
开发者ID:jeking928,项目名称:Dual-Pricing-2.1.6,代码行数:76,代码来源:shopping_cart.php

示例5: zen_check_stock

/**
 * Check if the required stock is available.
 *
 * If insufficent stock is available return an out of stock message
 *
 * @param int The product id of the product whos's stock is to be checked
 * @param int Is this amount of stock available
 *
 * @TODO naughty html in a function
*/
function zen_check_stock($products_id, $products_quantity, $attributes = null, $from = 'products')
{
    // START "Stock by Attributes"
    if ($from == 'order' && is_array($attributes)) {
        $tmp_attrib = array();
        foreach ($attributes as $attrib) {
            $tmp_attrib[$attrib['option_id']] = $attrib['value_id'];
        }
        $attributes = $tmp_attrib;
    }
    $stock_left = zen_get_products_stock($products_id, $attributes) - $products_quantity;
    // END "Stock by Attributes"
    $out_of_stock = '';
    if ($stock_left < 0) {
        $out_of_stock = '<span class="markProductOutOfStock">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</span>';
    }
    return $out_of_stock;
}
开发者ID:badarac,项目名称:stock_by_attribute_1.5.4,代码行数:28,代码来源:functions_lookups.php

示例6: zen_redirect

$_SESSION['valid_to_checkout'] = true;
$_SESSION['cart']->get_products(true);
if ($_SESSION['valid_to_checkout'] == false) {
    $messageStack->add('header', ERROR_CART_UPDATE, 'error');
    zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
}
// Stock Check
if (STOCK_CHECK == 'true' && STOCK_ALLOW_CHECKOUT != 'true') {
    $products = $_SESSION['cart']->get_products();
    for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
        if (zen_check_stock($products[$i]['id'], $products[$i]['quantity'])) {
            zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
            break;
        } else {
            // extra check on stock for mixed YES
            if (zen_get_products_stock($products[$i]['id']) - $_SESSION['cart']->in_cart_mixed($products[$i]['id']) < 0) {
                zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
                break;
            }
        }
    }
}
// if no shipping destination address was selected, use the customers own address as default
if (!$_SESSION['sendto']) {
    $_SESSION['sendto'] = $_SESSION['customer_default_address_id'];
} else {
    // verify the selected shipping address
    $check_address_query = "SELECT count(*) AS total\n                            FROM   " . TABLE_ADDRESS_BOOK . "\n                            WHERE  customers_id = :customersID\n                            AND    address_book_id = :addressBookID";
    $check_address_query = $db->bindVars($check_address_query, ':customersID', $_SESSION['customer_id'], 'integer');
    $check_address_query = $db->bindVars($check_address_query, ':addressBookID', $_SESSION['sendto'], 'integer');
    $check_address = $db->Execute($check_address_query);
开发者ID:R-Future,项目名称:zencart,代码行数:31,代码来源:header_php.php

示例7: array

}
//echo $messageStack->size('checkout_payment');
//die('here');
// Stock Check
$flagAnyOutOfStock = false;
$stock_check = array();
if (STOCK_CHECK == 'true') {
    // bof numinix products variants  - check stock
    if (NMX_PRODUCT_VARIANTS_STATUS == 'true') {
        // get option_id/option_value_id array
        $products_attributes = array();
        for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
            foreach ($order->products[$i]['attributes'] as $products_attribute) {
                $products_attributes[$products_attribute['option_id']] = $products_attribute['value_id'];
            }
            $stockUpdate = zen_get_products_stock($order->products[$i]['id'], $products_attributes);
            $stockAvailable = is_array($stockUpdate) ? $stockUpdate['quantity'] : $stockUpdate;
            if ($stockAvailable - $order->products[$i]['qty'] < 0) {
                $flagAnyOutOfStock = true;
                $flagStockCheck = STOCK_MARK_PRODUCT_OUT_OF_STOCK;
            }
        }
    }
    // eof numinix products variants  - check stock
    for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
        if ($stock_check[$i] = zen_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) {
            $flagAnyOutOfStock = true;
        }
    }
    // Out of Stock
    if (STOCK_ALLOW_CHECKOUT != 'true' && $flagAnyOutOfStock == true) {
开发者ID:krakatoa14,项目名称:fec,代码行数:31,代码来源:header_php.php

示例8: zen_get_products_stock

 $stock_id = $db->Execute($query, false, false, 0, true);
 if ($stock_id->RecordCount() > 0) {
     $query = 'select stock_id from ' . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . ' where products_id = :products_id:';
     $query = $db->bindVars($query, ':products_id:', $_POST['products_id'], 'integer');
     $stock_id = $db->Execute($query, false, false, 0, true);
     //  $_SESSION['stock_idquery'] = $stock_id->RecordCount();
     //Check if item is an SBA tracked item, if so, then perform analysis of whether to add or not.
 }
 if ($stock_id->RecordCount() > 0) {
     //Looks like $_SESSION['cart']->in_cart_mixed($prodId) could be used here to pull the attribute related product information to verify same product is being added to cart... This also may help in the shopping_cart routine added for SBA as all SBA products will have this modifier.
     //      $cart_qty = 0;
     $new_qty = $_POST['cart_quantity'];
     //Number of items being added (Known to be SBA tracked already)
     $new_qty = $_SESSION['cart']->adjust_quantity($new_qty, $_POST['products_id'], 'header');
     // bof: adjust new quantity to be same as current in stock
     $chk_current_qty = zen_get_products_stock($product_id, $attributes);
     $_SESSION['cart']->flag_duplicate_msgs_set = FALSE;
     $productAttrAreSBA = zen_get_sba_stock_attribute_id($product_id, $attributes, 'products');
     if ($productAttrAreSBA === false) {
         $the_list .= PWA_COMBO_OUT_OF_STOCK . "<br />";
         foreach ($_POST['id'] as $key2 => $value2) {
             $the_list .= TEXT_ERROR_OPTION_FOR . '<span class="alertBlack">' . zen_options_name($key2) . '</span>' . TEXT_INVALID_SELECTION . '<span class="alertBlack">' . ($value == (int) PRODUCTS_OPTIONS_VALUES_TEXT_ID ? TEXT_INVALID_USER_INPUT : zen_values_name($value2)) . '</span>' . '<br />';
         }
     }
     if (STOCK_ALLOW_CHECKOUT == 'false' && $cart_qty + $new_qty > $chk_current_qty) {
         $new_qty = $chk_current_qty;
         $messageStack->add_session('shopping_cart', ($_SESSION['cart']->display_debug_messages ? 'C: FUNCTION ' . __FUNCTION__ . ': ' : '') . WARNING_PRODUCT_QUANTITY_ADJUSTED . zen_get_products_name($_POST['products_id']), 'caution');
         $_SESSION['cart']->flag_duplicate_msgs_set = TRUE;
     }
     // eof: adjust new quantity to be same as current in stock
     if ($add_max == 1 and $cart_qty == 1) {
开发者ID:badarac,项目名称:stock_by_attribute_1.5.4,代码行数:31,代码来源:stock_by_attributes.php

示例9: _draw_js_stock_array

 function _draw_js_stock_array($combinations)
 {
     if (!(isset($combinations) && is_array($combinations) && sizeof($combinations) > 0)) {
         return '{}';
     }
     $out = '';
     foreach ($combinations[0]['comb'] as $oid => $ovid) {
         $out .= '{' . '"_' . zen_output_string_protected($ovid) . '"' . ':';
         $ovids[] = $ovid;
         $opts[] = $oid;
     }
     if (STOCK_SHOW_ATTRIB_LEVEL_STOCK == 'true') {
         //Search for quantity in the SBA table...
         $numbadd = zen_get_products_stock($_GET['products_id'], $ovids);
         if ($numbadd == 0) {
             $numbadd = '0';
         }
         $out .= $numbadd;
     } else {
         $out .= '1';
     }
     for ($combindex = 1; $combindex < sizeof($combinations); $combindex++) {
         $comb = $combinations[$combindex]['comb'];
         for ($i = 0; $i < sizeof($opts) - 1; $i++) {
             if ($comb[$opts[$i]] != $combinations[$combindex - 1]['comb'][$opts[$i]]) {
                 break;
             }
         }
         $out .= str_repeat('}', sizeof($opts) - 1 - $i) . ',';
         if ($i < sizeof($opts) - 1) {
             for ($j = $i; $j < sizeof($opts) - 1; $j++) {
                 $out .= '"_' . zen_output_string_protected($comb[$opts[$j]]) . '"' . ':{';
             }
         }
         $out .= '"_' . zen_output_string_protected($comb[$opts[sizeof($opts) - 1]]) . '"' . ':';
         if (STOCK_SHOW_ATTRIB_LEVEL_STOCK == 'true') {
             $idvals = array();
             foreach ($comb as $ids => $idvalsadd) {
                 $idvals[] = $idvalsadd;
             }
             $numadd = zen_get_products_stock($_GET['products_id'], $idvals);
             if ($numadd == 0) {
                 $numadd = '0';
             }
             $out .= $numadd;
         } else {
             $out .= '1';
         }
     }
     $out .= str_repeat('}', sizeof($opts));
     return $out;
 }
开发者ID:badarac,项目名称:stock_by_attribute_1.5.4,代码行数:52,代码来源:pad_sba_sequenced_dropdowns.php


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