本文整理汇总了PHP中zen_get_products_quantity_order_units函数的典型用法代码示例。如果您正苦于以下问题:PHP zen_get_products_quantity_order_units函数的具体用法?PHP zen_get_products_quantity_order_units怎么用?PHP zen_get_products_quantity_order_units使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zen_get_products_quantity_order_units函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: zen_get_products_quantity_min_units_display
function zen_get_products_quantity_min_units_display($product_id, $include_break = true, $shopping_cart_msg = false)
{
$check_min = zen_get_products_quantity_order_min($product_id);
$check_units = zen_get_products_quantity_order_units($product_id);
$the_min_units = '';
if ($check_min != 1 or $check_units != 1) {
if ($check_min != 1) {
$the_min_units .= PRODUCTS_QUANTITY_MIN_TEXT_LISTING . ' ' . $check_min;
}
if ($check_units != 1) {
$the_min_units .= ($the_min_units ? ' ' : '') . PRODUCTS_QUANTITY_UNIT_TEXT_LISTING . ' ' . $check_units;
}
if (($check_min > 0 or $check_units > 0) and !zen_get_products_quantity_mixed($product_id)) {
if ($include_break == true) {
$the_min_units .= '<br />' . ($shopping_cart_msg == false ? TEXT_PRODUCTS_MIX_OFF : TEXT_PRODUCTS_MIX_OFF_SHOPPING_CART);
} else {
$the_min_units .= ' ' . ($shopping_cart_msg == false ? TEXT_PRODUCTS_MIX_OFF : TEXT_PRODUCTS_MIX_OFF_SHOPPING_CART);
}
} else {
if ($include_break == true) {
$the_min_units .= '<br />' . ($shopping_cart_msg == false ? TEXT_PRODUCTS_MIX_ON : TEXT_PRODUCTS_MIX_ON_SHOPPING_CART);
} else {
$the_min_units .= ' ' . ($shopping_cart_msg == false ? TEXT_PRODUCTS_MIX_ON : TEXT_PRODUCTS_MIX_ON_SHOPPING_CART);
}
}
}
// quantity max
$check_max = zen_get_products_quantity_order_max($product_id);
if ($check_max != 0) {
if ($include_break == true) {
$the_min_units .= ($the_min_units != '' ? '<br />' : '') . PRODUCTS_QUANTITY_MAX_TEXT_LISTING . ' ' . $check_max;
} else {
$the_min_units .= ($the_min_units != '' ? ' ' : '') . PRODUCTS_QUANTITY_MAX_TEXT_LISTING . ' ' . $check_max;
}
}
return $the_min_units;
}
示例2: get_products
//.........这里部分代码省略.........
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 {
$chk_products_link = $products->fields['products_name'];
}
$_SESSION['cart_errors'] .= ERROR_PRODUCT_ATTRIBUTES . $chk_products_link . ERROR_PRODUCT_STATUS_SHOPPING_CART_ATTRIBUTES . '<br />';
$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++;
$_SESSION['valid_to_checkout'] = false;
$_SESSION['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 />';
}
}
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:
$new_qty = preg_replace('/[0]+$/', '', $this->contents[$products_id]['qty']);
break;
}
} else {
$new_qty = $this->contents[$products_id]['qty'];
}
$check_unit_decimals = zen_get_products_quantity_order_units((int) $products->fields['products_id']);
if (strstr($check_unit_decimals, '.')) {
$new_qty = round($new_qty, QUANTITY_DECIMALS);
} else {
$new_qty = round($new_qty, 0);
}
//@@TODO - should be okay to remove
if (false && $new_qty == (int) $new_qty) {
$new_qty = (int) $new_qty;
}
$products_array[] = array('id' => $products_id, 'category' => $products->fields['master_categories_id'], 'name' => $products->fields['products_name'], 'model' => $products->fields['products_model'], 'image' => $products->fields['products_image'], 'price' => $products->fields['product_is_free'] == '1' ? 0 : $products_price, 'quantity' => $new_qty, 'weight' => $products->fields['products_weight'] + $this->attributes_weight($products_id), 'final_price' => $products_price + $this->attributes_price($products_id), 'onetime_charges' => $this->attributes_price_onetime_charges($products_id, $new_qty), 'tax_class_id' => $products->fields['products_tax_class_id'], 'attributes' => isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '', 'attributes_values' => isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : '', 'products_priced_by_attribute' => $products->fields['products_priced_by_attribute'], 'product_is_free' => $products->fields['product_is_free'], 'products_discount_type' => $products->fields['products_discount_type'], 'products_discount_type_from' => $products->fields['products_discount_type_from'], 'products_virtual' => $products->fields['products_virtual'], 'product_is_always_free_shipping' => $products->fields['product_is_always_free_shipping']);
}
}
$this->notify('NOTIFIER_CART_GET_PRODUCTS_END', array(), $products_array);
return $products_array;
}
示例3: zen_get_buy_now_qty
function zen_get_buy_now_qty($product_id)
{
global $cart;
$check_min = zen_get_products_quantity_order_min($product_id);
$check_units = zen_get_products_quantity_order_units($product_id);
$buy_now_qty = 1;
// works on Mixed ON
switch (true) {
case $_SESSION['cart']->in_cart_mixed($product_id) == 0:
if ($check_min >= $check_units) {
$buy_now_qty = $check_min;
} else {
$buy_now_qty = $check_units;
}
break;
case $_SESSION['cart']->in_cart_mixed($product_id) < $check_min:
$buy_now_qty = $check_min - $_SESSION['cart']->in_cart_mixed($product_id);
break;
case $_SESSION['cart']->in_cart_mixed($product_id) > $check_min:
// set to units or difference in units to balance cart
$new_units = $check_units - fmod_round($_SESSION['cart']->in_cart_mixed($product_id), $check_units);
//echo 'Cart: ' . $_SESSION['cart']->in_cart_mixed($product_id) . ' Min: ' . $check_min . ' Units: ' . $check_units . ' fmod: ' . fmod($_SESSION['cart']->in_cart_mixed($product_id), $check_units) . '<br />';
$buy_now_qty = $new_units > 0 ? $new_units : $check_units;
break;
default:
$buy_now_qty = $check_units;
break;
}
if ($buy_now_qty <= 0) {
$buy_now_qty = 1;
}
return $buy_now_qty;
}
示例4: get_products
//.........这里部分代码省略.........
$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);
}
}
if ($fix_once == 0) {
if ($check_quantity < $check_quantity_min) {
$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_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 />';
$this->setSessionVar('cart_errors', $cart_errors);
}
}
// 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) {
$this->setSessionVar('valid_to_checkout', false);
$cart_errors = $this->getSessionVar('cart_errors');
$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 />';
$this->setSessionVar('cart_errors', $cart_errors);
}
}
// 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) {
$fix_qty = $this->contents[$products_id]['qty'];
switch (true) {
case !strstr($fix_qty, '.'):
$new_qty = $fix_qty;
break;
default:
$new_qty = preg_replace('/[0]+$/', '', $this->contents[$products_id]['qty']);
break;
}
} else {
$new_qty = $this->contents[$products_id]['qty'];
}
$check_unit_decimals = zen_get_products_quantity_order_units((int) $products->fields['products_id']);
if (strstr($check_unit_decimals, '.')) {
$new_qty = round($new_qty, QUANTITY_DECIMALS);
} else {
$new_qty = round($new_qty, 0);
}
if ($new_qty == (int) $new_qty) {
$new_qty = (int) $new_qty;
}
$products_array[] = array('id' => $products_id, 'category' => $products->fields['master_categories_id'], 'name' => $products->fields['products_name'], 'model' => $products->fields['products_model'], 'image' => $products->fields['products_image'], 'price' => $products->fields['product_is_free'] == '1' ? 0 : $products_price, 'quantity' => $new_qty, 'weight' => $products->fields['products_weight'] + $this->attributes_weight($products_id), 'final_price' => $products_price + $this->attributes_price($products_id), 'onetime_charges' => $this->attributes_price_onetime_charges($products_id, $new_qty), 'tax_class_id' => $products->fields['products_tax_class_id'], 'attributes' => isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '', 'attributes_values' => isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : '', 'products_priced_by_attribute' => $products->fields['products_priced_by_attribute'], 'product_is_free' => $products->fields['product_is_free'], 'products_discount_type' => $products->fields['products_discount_type'], 'products_discount_type_from' => $products->fields['products_discount_type_from']);
}
}
$this->notify('NOTIFIER_CART_GET_PRODUCTS_END');
return $products_array;
}
示例5: get_products
//.........这里部分代码省略.........
/*
$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:
$new_qty = preg_replace('/[0]+$/', '', $this->contents[$products_id]['qty']);
break;
}
} else {
$new_qty = $this->contents[$products_id]['qty'];
}
$check_unit_decimals = zen_get_products_quantity_order_units((int) $products->fields['products_id']);
if (strstr($check_unit_decimals, '.')) {
$new_qty = round($new_qty, QUANTITY_DECIMALS);
} else {
$new_qty = round($new_qty, 0);
}
if ($new_qty == (int) $new_qty) {
$new_qty = (int) $new_qty;
}
$products_array[] = array('id' => $products_id, 'category' => $products->fields['master_categories_id'], 'name' => $products->fields['products_name'], 'model' => $products->fields['products_model'], 'image' => $products->fields['products_image'], 'price' => $products->fields['product_is_free'] == '1' ? 0 : $products_price, 'quantity' => $new_qty, 'weight' => $products->fields['products_weight'] + $this->attributes_weight($products_id), 'final_price' => $products_price + $this->attributes_price($products_id), 'onetime_charges' => $this->attributes_price_onetime_charges($products_id, $new_qty), 'tax_class_id' => $products->fields['products_tax_class_id'], 'attributes' => isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '', 'attributes_values' => isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : '', 'products_priced_by_attribute' => $products->fields['products_priced_by_attribute'], 'product_is_free' => $products->fields['product_is_free'], 'products_discount_type' => $products->fields['products_discount_type'], 'products_discount_type_from' => $products->fields['products_discount_type_from']);
}
}
$this->notify('NOTIFIER_CART_GET_PRODUCTS_END');
return $products_array;
}