本文整理汇总了PHP中zen_get_products_price_is_priced_by_attributes函数的典型用法代码示例。如果您正苦于以下问题:PHP zen_get_products_price_is_priced_by_attributes函数的具体用法?PHP zen_get_products_price_is_priced_by_attributes怎么用?PHP zen_get_products_price_is_priced_by_attributes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zen_get_products_price_is_priced_by_attributes函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_content_type
/**
* Method to calculate the content type of a cart
*
* @param boolean whether to test for Gift Vouchers only
* @return string
*/
function get_content_type($gv_only = 'false')
{
global $db;
$this->content_type = false;
$gift_voucher = 0;
// if ( (DOWNLOAD_ENABLED == 'true') && ($this->count_contents() > 0) ) {
if ($this->count_contents() > 0) {
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$free_ship_check = $db->Execute("select products_virtual, products_model, products_price, product_is_always_free_shipping from " . TABLE_PRODUCTS . " where products_id = '" . zen_get_prid($products_id) . "'");
$virtual_check = false;
if (preg_match('/^GIFT/', addslashes($free_ship_check->fields['products_model']))) {
// @TODO - fix GIFT price in cart special/attribute
$gift_special = zen_get_products_special_price(zen_get_prid($products_id), true);
$gift_pba = zen_get_products_price_is_priced_by_attributes(zen_get_prid($products_id));
//echo '$products_id: ' . zen_get_prid($products_id) . ' price: ' . ($free_ship_check->fields['products_price'] + $this->attributes_price($products_id)) . ' vs special price: ' . $gift_special . ' qty: ' . $this->contents[$products_id]['qty'] . ' PBA: ' . ($gift_pba ? 'YES' : 'NO') . '<br>';
if (!$gift_pba && $gift_special != 0 && $gift_special != $free_ship_check->fields['products_price']) {
$gift_voucher += $gift_special * $this->contents[$products_id]['qty'];
} else {
$gift_voucher += ($free_ship_check->fields['products_price'] + $this->attributes_price($products_id)) * $this->contents[$products_id]['qty'];
}
}
// product_is_always_free_shipping = 2 is special requires shipping
// Example: Product with download
if (isset($this->contents[$products_id]['attributes']) and $free_ship_check->fields['product_is_always_free_shipping'] != 2) {
reset($this->contents[$products_id]['attributes']);
while (list(, $value) = each($this->contents[$products_id]['attributes'])) {
$virtual_check_query = "select count(*) as total\n from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n where pa.products_id = '" . (int) $products_id . "'\n and pa.options_values_id = '" . (int) $value . "'\n and pa.products_attributes_id = pad.products_attributes_id";
$virtual_check = $db->Execute($virtual_check_query);
if ($virtual_check->fields['total'] > 0) {
switch ($this->content_type) {
case 'physical':
$this->content_type = 'mixed';
if ($gv_only == 'true') {
return $gift_voucher;
} else {
return $this->content_type;
}
break;
default:
$this->content_type = 'virtual';
break;
}
} else {
switch ($this->content_type) {
case 'virtual':
if ($free_ship_check->fields['products_virtual'] == '1') {
$this->content_type = 'virtual';
} else {
$this->content_type = 'mixed';
if ($gv_only == 'true') {
return $gift_voucher;
} else {
return $this->content_type;
}
}
break;
case 'physical':
if ($free_ship_check->fields['products_virtual'] == '1') {
$this->content_type = 'mixed';
if ($gv_only == 'true') {
return $gift_voucher;
} else {
return $this->content_type;
}
} else {
$this->content_type = 'physical';
}
break;
default:
if ($free_ship_check->fields['products_virtual'] == '1') {
$this->content_type = 'virtual';
} else {
$this->content_type = 'physical';
}
}
}
}
} else {
switch ($this->content_type) {
case 'virtual':
if ($free_ship_check->fields['products_virtual'] == '1') {
$this->content_type = 'virtual';
} else {
$this->content_type = 'mixed';
if ($gv_only == 'true') {
return $gift_voucher;
} else {
return $this->content_type;
}
}
break;
case 'physical':
if ($free_ship_check->fields['products_virtual'] == '1') {
//.........这里部分代码省略.........
示例2: zen_get_products_price_is_priced_by_attributes
<td colspan="2"><table border="0" cellspacing="0" cellpadding="2">
<?php
if ($_GET['products_filter'] != '') {
?>
<tr>
<td class="main" width="200" align="left" valign="top"> </td>
<td colspan="2" class="main"><?php
echo TEXT_PRODUCT_TO_VIEW;
?>
</td>
</tr>
<tr>
<td class="main" width="200" align="center" valign="top">
<?php
$display_priced_by_attributes = zen_get_products_price_is_priced_by_attributes($_GET['products_filter']);
echo $display_priced_by_attributes ? '<span class="alert">' . TEXT_PRICED_BY_ATTRIBUTES . '</span>' . '<br />' : '';
echo zen_get_products_display_price($_GET['products_filter']) . '<br /><br />';
echo zen_get_products_quantity_min_units_display($_GET['products_filter'], $include_break = true);
?>
</td>
<td class="attributes-even" align="center"><?php
echo zen_draw_products_pull_down('products_filter', 'size="10"', '', true, $_GET['products_filter'], true, true);
?>
</td>
<td class="main" align="right" valign="top"><?php
echo zen_image_submit('button_display.gif', IMAGE_DISPLAY);
?>
</td>
</tr>
</table></td>
示例3: 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) {
//.........这里部分代码省略.........
示例4: update_credit_account
/**
* queue or release newly-purchased GV's
*/
function update_credit_account($i)
{
global $db, $order, $insert_id;
// only act on newly-purchased gift certificates
if (preg_match('/^GIFT/', addslashes($order->products[$i]['model']))) {
// determine how much GV was purchased
// check if GV was purchased on Special
$gv_original_price = zen_products_lookup((int) $order->products[$i]['id'], 'products_price');
// if prices differ assume Special ang get Special Price
// Do not use this on GVs Priced by Attribute
if (MODULE_ORDER_TOTAL_GV_SPECIAL == 'true' && ($gv_original_price != 0 && $gv_original_price != $order->products[$i]['final_price'] && !zen_get_products_price_is_priced_by_attributes((int) $order->products[$i]['id']))) {
$gv_order_amount = $gv_original_price * $order->products[$i]['qty'];
} else {
$gv_order_amount = $order->products[$i]['final_price'] * $order->products[$i]['qty'];
}
// if tax is to be calculated on purchased GVs, calculate it
if ($this->credit_tax == 'true') {
$gv_order_amount = $gv_order_amount * (100 + $order->products[$i]['tax']) / 100;
}
$gv_order_amount = $gv_order_amount * 100 / 100;
if (MODULE_ORDER_TOTAL_GV_QUEUE == 'false') {
// GV_QUEUE is false so release amount to account immediately
$gv_result = $this->user_has_gv_account($_SESSION['customer_id']);
$customer_gv = false;
$total_gv_amount = 0;
if ($gv_result) {
$total_gv_amount = $gv_result;
$customer_gv = true;
}
$total_gv_amount = $total_gv_amount + $gv_order_amount;
if ($customer_gv) {
$db->Execute("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $total_gv_amount . "' where customer_id = '" . (int) $_SESSION['customer_id'] . "'");
} else {
$db->Execute("insert into " . TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('" . (int) $_SESSION['customer_id'] . "', '" . $total_gv_amount . "')");
}
} else {
// GV_QUEUE is true - so queue the gv for release by store owner
$db->Execute("insert into " . TABLE_COUPON_GV_QUEUE . " (customer_id, order_id, amount, date_created, ipaddr) values ('" . (int) $_SESSION['customer_id'] . "', '" . (int) $insert_id . "', '" . $gv_order_amount . "', NOW(), '" . $_SERVER['REMOTE_ADDR'] . "')");
}
}
}
示例5: zen_get_products_price_is_priced_by_attributes
<tr>
<td class="main" align="left"><?php
echo TEXT_PRODUCTS_DISCOUNT_QTY_TITLE;
?>
</td>
<td class="main" align="left"><?php
echo TEXT_PRODUCTS_DISCOUNT_QTY;
?>
</td>
<td class="main" align="left" style="border-right:0;"><?php
echo TEXT_PRODUCTS_DISCOUNT_PRICE;
?>
</td>
</tr>
<?php
$display_priced_by_attributes = zen_get_products_price_is_priced_by_attributes($category_id);
$display_price = zen_get_products_base_price($category_id);
$display_specials_price = zen_get_products_special_price($category_id, true);
$discount_query = "SELECT discount_id,discount_qty,discount_price FROM " . TABLE_CATEGORIES_DISCOUNT_QUANTITY . " WHERE categories_id = " . $category_id;
$discount = $db->Execute($discount_query);
$i = 0;
while (!$discount->EOF) {
$i++;
$discount_name[] = array('id' => $i, 'discount_qty' => $discount->fields['discount_qty'], 'discount_price' => $discount->fields['discount_price']);
$discount->MoveNext();
}
for ($i = 0, $n = 6; $i < $n; $i++) {
switch ($pInfo->products_discount_type) {
// none
case '0':
$discounted_price = 0;