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


PHP ps_product::get_quantity_options方法代码示例

本文整理汇总了PHP中ps_product::get_quantity_options方法的典型用法代码示例。如果您正苦于以下问题:PHP ps_product::get_quantity_options方法的具体用法?PHP ps_product::get_quantity_options怎么用?PHP ps_product::get_quantity_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ps_product的用法示例。


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

示例1: vmGet

    $delete_message = $VM_LANG->_('PHPSHOP_PRODUCT_FORM_DELETE_PRODUCT_MSG');
}
$display_label = $VM_LANG->_('PHPSHOP_PRODUCT_FORM_ITEM_DISPLAY_LBL');
if (!empty($product_id)) {
    $price = $ps_product->get_retail_price($product_id);
} else {
    $price['product_price'] = vmGet($_REQUEST, 'product_price', '');
}
$quantity_start = 0;
$quantity_end = 0;
$quantity_step = 1;
if (!empty($product_id)) {
    // get the Database object we're filling the product form with
    $db = $ps_product->get($product_id);
    //get quantity options
    $quantity_options = ps_product::get_quantity_options($product_id);
    extract($quantity_options);
    //get list style
    $child_options = ps_product::get_child_options($product_id);
    extract($child_options);
    //Get min max order levels
    $order_levels = ps_product::product_order_levels($product_id);
    if ($order_levels) {
        $min_order = array_shift($order_levels);
        $max_order = array_shift($order_levels);
    }
    // Get category IDs
    $db2 = new ps_DB();
    $q = "SELECT category_id FROM #__{vm}_product_category_xref WHERE product_id='{$product_id}'";
    $db2->query($q);
    while ($db2->next_record()) {
开发者ID:noikiy,项目名称:owaspbwa,代码行数:31,代码来源:product.product_form.php

示例2: show_quantity_box

 /**
  * Creates the Quantity Input Boxes/Radio Buttons/Lists for Products
  *
  * @param int $product_id The Parent Product ID
  * @param int $prod_id The actual Product ID
  * @param string $child
  * @param string $use_parent
  * @return string
  */
 function show_quantity_box($product_id, $prod_id, $child = false, $use_parent = 'N')
 {
     global $VM_LANG;
     $tpl = vmTemplate::getInstance();
     if ($child == 'Y') {
         //We have a child list so get the current quantity;
         $quantity = 0;
         for ($i = 0; $i < $_SESSION["cart"]["idx"]; $i++) {
             if ($_SESSION['cart'][$i]["product_id"] == $prod_id) {
                 $quantity = $_SESSION['cart'][$i]["quantity"];
             }
         }
     } else {
         $quantity = vmrequest::getInt('quantity', 1);
     }
     // Detremine which style to use
     if ($use_parent == 'Y' && !empty($product_id)) {
         $id = $product_id;
     } else {
         $id = $prod_id;
     }
     //Get style to use
     $product_in_stock = ps_product::get_field($id, 'product_in_stock');
     $quantity_options = ps_product::get_quantity_options($id);
     extract($quantity_options);
     //Start output of quantity
     //Check for incompatabilities and reset to normal
     if (CHECK_STOCK == '1' && !$product_in_stock) {
         $display_type = 'hide';
     }
     if (empty($display_type) || @$display_type == "hide" && $child == 'Y' || @$display_type == "radio" && $child == 'YM' || @$display_type == "radio" && !$child) {
         $display_type = "none";
     }
     unset($quantity_options['display_type']);
     $tpl->set('prod_id', $prod_id);
     $tpl->set('quantity', $quantity);
     $tpl->set('display_type', $display_type);
     $tpl->set('child', $child);
     $tpl->set('quantity_options', $quantity_options);
     //Determine if label to be used
     $html = $tpl->fetch('product_details/includes/quantity_box_general.tpl.php');
     return $html;
 }
开发者ID:albertobraschi,项目名称:Hab,代码行数:52,代码来源:ps_product_attribute.php

示例3: update

 /**
  * updates the quantity of a product_id in the cart
  * @author pablo
  * @param array $d
  * @return boolean result of the update
  */
 function update(&$d)
 {
     global $VM_LANG, $vmLogger, $func, $page;
     include_class("product");
     $product_id = (int) $d["prod_id"];
     $quantity = isset($d["quantity"]) ? (int) $d["quantity"] : 1;
     $_SESSION['last_page'] = "shop.cart";
     // Check for negative quantity
     if ($quantity < 0) {
         $vmLogger->warning($VM_LANG->_('PHPSHOP_CART_ERROR_NO_NEGATIVE', false));
         return False;
     }
     if (!is_numeric($quantity)) {
         $vmLogger->warning($VM_LANG->_('PHPSHOP_CART_ERROR_NO_VALID_QUANTITY', false));
         return False;
     }
     if (!$product_id) {
         return false;
     }
     $deleted_prod = 0;
     $updated_prod = 0;
     if ($quantity == 0 && strtolower($func) == "cartupdate") {
         $deleted_prod = $this->delete($d);
     } else {
         for ($i = 0; $i < $_SESSION['cart']["idx"]; $i++) {
             // modified for the advanced attribute modification
             if ($_SESSION['cart'][$i]["product_id"] == $product_id && $_SESSION['cart'][$i]["description"] == $d["description"]) {
                 if (strtolower($func) == 'cartadd') {
                     $quantity += $_SESSION['cart'][$i]["quantity"];
                 }
                 // Get min and max order levels
                 list($min, $max) = ps_product::product_order_levels($product_id);
                 if ($min != 0 && $quantity < $min) {
                     eval("\$msg = \"" . $VM_LANG->_('VM_CART_MIN_ORDER', false) . "\";");
                     $vmLogger->warning($msg);
                     return false;
                 }
                 if ($max != 0 && $quantity > $max) {
                     eval("\$msg = \"" . $VM_LANG->_('VM_CART_MAX_ORDER', false) . "\";");
                     $vmLogger->warning($msg);
                     return false;
                 }
                 $quantity_options = ps_product::get_quantity_options($product_id);
                 if (!empty($quantity_options) && !empty($quantity_options['quantity_step'])) {
                     if ($quantity % $quantity_options['quantity_step'] > 0) {
                         continue;
                     }
                 }
                 // Remove deleted or unpublished products from the cart
                 if (!ps_product::product_exists($product_id)) {
                     $this->delete(array('product_id', $product_id));
                     continue;
                 }
                 // Check to see if checking stock quantity
                 if (CHECK_STOCK) {
                     $product_in_stock = ps_product::get_field($product_id, 'product_in_stock');
                     if (empty($product_in_stock)) {
                         $product_in_stock = 0;
                     }
                     if ($quantity > $product_in_stock) {
                         global $notify;
                         $_SESSION['notify'] = array();
                         $_SESSION['notify']['idx'] = 0;
                         $k = 0;
                         $notify = $_SESSION['notify'];
                         $_SESSION['notify'][$k]["prod_id"] = $product_id;
                         $_SESSION['notify'][$k]["quantity"] = $quantity;
                         $_SESSION['notify']['idx']++;
                         $page = 'shop.waiting_list';
                         return true;
                     }
                 }
                 $_SESSION['cart'][$i]["quantity"] = $quantity;
                 $updated_prod++;
             }
         }
     }
     if (!empty($_SESSION['coupon_discount'])) {
         // Update the Coupon Discount !!
         require_once CLASSPATH . 'ps_coupon.php';
         ps_coupon::process_coupon_code($d);
     }
     ps_cart::saveCart();
     return array($updated_prod, $deleted_prod);
 }
开发者ID:rafarubert,项目名称:megafiltros,代码行数:91,代码来源:ps_cart.php


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