本文整理汇总了PHP中zen_get_products_special_price函数的典型用法代码示例。如果您正苦于以下问题:PHP zen_get_products_special_price函数的具体用法?PHP zen_get_products_special_price怎么用?PHP zen_get_products_special_price使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zen_get_products_special_price函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSalePrice
/**
* Test sale price.
*/
public function testSalePrice()
{
foreach ($this->get('productService')->getAllProducts(false, 1) as $product) {
$offers = $product->getOffers();
// without tax
$this->assertEquals(zen_get_products_special_price($product->getId(), false), $offers->getSalePrice(false), '%s productId=' . $product->getId());
}
}
示例2: zen_get_products_display_price_pure_green
function zen_get_products_display_price_pure_green($products_id)
{
global $db, $currencies;
$free_tag = "";
$call_tag = "";
// 0 = normal shopping
// 1 = Login to shop
// 2 = Can browse but no prices
// verify display of prices
switch (true) {
case CUSTOMERS_APPROVAL == '1' and $_SESSION['customer_id'] == '':
// customer must be logged in to browse
return '';
break;
case CUSTOMERS_APPROVAL == '2' and $_SESSION['customer_id'] == '':
// customer may browse but no prices
return TEXT_LOGIN_FOR_PRICE_PRICE;
break;
case CUSTOMERS_APPROVAL == '3' and TEXT_LOGIN_FOR_PRICE_PRICE_SHOWROOM != '':
// customer may browse but no prices
return TEXT_LOGIN_FOR_PRICE_PRICE_SHOWROOM;
break;
case CUSTOMERS_APPROVAL_AUTHORIZATION != '0' and CUSTOMERS_APPROVAL_AUTHORIZATION != '3' and $_SESSION['customer_id'] == '':
// customer must be logged in to browse
return TEXT_AUTHORIZATION_PENDING_PRICE;
break;
case CUSTOMERS_APPROVAL_AUTHORIZATION != '0' and CUSTOMERS_APPROVAL_AUTHORIZATION != '3' and $_SESSION['customers_authorization'] > '0':
// customer must be logged in to browse
return TEXT_AUTHORIZATION_PENDING_PRICE;
break;
default:
// proceed normally
break;
}
// show case only
if (STORE_STATUS != '0') {
if (STORE_STATUS == '1') {
return '';
}
}
// $new_fields = ', product_is_free, product_is_call, product_is_showroom_only';
$product_check = $db->Execute("select products_tax_class_id, products_price, products_priced_by_attribute, product_is_free, product_is_call, products_type from " . TABLE_PRODUCTS . " where products_id = '" . (int) $products_id . "'" . " limit 1");
// no prices on Document General
if ($product_check->fields['products_type'] == 3) {
return '';
}
$show_display_price = '';
$display_normal_price = zen_get_products_base_price($products_id);
$display_special_price = zen_get_products_special_price($products_id, true);
$display_sale_price = zen_get_products_special_price($products_id, false);
$show_sale_discount = '';
if (SHOW_SALE_DISCOUNT_STATUS == '1' and ($display_special_price != 0 or $display_sale_price != 0)) {
if ($display_sale_price) {
if (SHOW_SALE_DISCOUNT == 1) {
if ($display_normal_price != 0) {
$show_discount_amount = number_format(100 - $display_sale_price / $display_normal_price * 100, SHOW_SALE_DISCOUNT_DECIMALS);
} else {
$show_discount_amount = '';
}
$show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . $show_discount_amount . PRODUCT_PRICE_DISCOUNT_PERCENTAGE . '</span>';
} else {
$show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . $currencies->display_price($display_normal_price - $display_sale_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . PRODUCT_PRICE_DISCOUNT_AMOUNT . '</span>';
}
} else {
if (SHOW_SALE_DISCOUNT == 1) {
$show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . number_format(100 - $display_special_price / $display_normal_price * 100, SHOW_SALE_DISCOUNT_DECIMALS) . PRODUCT_PRICE_DISCOUNT_PERCENTAGE . '</span>';
} else {
$show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . $currencies->display_price($display_normal_price - $display_special_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . PRODUCT_PRICE_DISCOUNT_AMOUNT . '</span>';
}
}
}
if ($display_special_price) {
if ($product_check->fields['product_is_free'] == '1' or $product_check->fields['product_is_call'] == '1') {
} else {
$show_normal_price = '<span class="normalprice">' . $currencies->display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . ' </span>';
}
if ($display_sale_price && $display_sale_price != $display_special_price) {
//$show_special_price = ' ' . '<span class="productSpecialPriceSale">' . $currencies->display_price($display_special_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</span>';
if ($product_check->fields['product_is_free'] == '1') {
// $show_sale_price = '<br />' . '<span class="productSalePrice">' . PRODUCT_PRICE_SALE . '<s>' . $currencies->display_price($display_sale_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</s>' . '</span>';
} else {
$show_sale_price = '' . '<span class="productSalePrice">' . $currencies->display_price($display_sale_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</span>';
}
} else {
if ($product_check->fields['product_is_free'] == '1') {
//$show_special_price = ' ' . '<span class="productSpecialPrice">' . '<s>' . $currencies->display_price($display_special_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</s>' . '</span>';
} else {
$show_special_price = ' ' . '<span class="productSpecialPrice">' . $currencies->display_price($display_special_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</span>';
}
$show_sale_price = '';
}
} else {
if ($display_sale_price) {
$show_normal_price = '<span class="normalprice">' . $currencies->display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . ' </span>';
$show_special_price = '';
$show_sale_price = '<span class="productSalePrice">' . $currencies->display_price($display_sale_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</span>';
} else {
if ($product_check->fields['product_is_free'] == '1') {
//$show_normal_price = '<s>' . $currencies->display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</s>';
} else {
//.........这里部分代码省略.........
示例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
*/
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);
}
}
//.........这里部分代码省略.........
示例4: getProperty
// }
// }
// $images = array_unique($images);
$property = getProperty($products->fields['products_id'], $lang_id, true);
$str_py = '';
foreach ($property as $k => $o) {
$str_py .= '<ul>';
$str_py .= '<li>' . $k . '<ul>';
foreach ($o as $v) {
$str_py .= $v;
}
$str_py .= '</ul></li>';
$str_py .= '</ul>';
}
$description .= $str_py;
$description .= $currencies->format(zen_get_products_special_price($products->fields['products_id'], true));
$description .= sprintf('{{%s:%s}}', $host, $products->fields['products_id']);
$wp_category = array();
foreach ($categores as $c) {
if (!empty($c['name'])) {
$wp_category[] = $c['name'];
}
}
$wp_category = implode('>', $wp_category);
$fields = array($products->fields['products_name'] . ' ' . $products->fields['products_model'], $description, $wp_category, str_replace('>', ',', $wp_category), "", "", "", "");
break;
}
$str = '"' . implode('","', $fields) . "\"\n";
fwrite($handle, $str);
$products->MoveNext();
}
示例5: isset
$products_image_name = $pInfo->products_image;
}
$form_action = isset($_GET['pID']) ? 'update_product' : 'insert_product';
echo zen_draw_form($form_action, $type_admin_handler, 'cPath=' . $cPath . (isset($_GET['product_type']) ? '&product_type=' . $_GET['product_type'] : '') . (isset($_GET['pID']) ? '&pID=' . $_GET['pID'] : '') . '&action=' . $form_action . (isset($_GET['page']) ? '&page=' . $_GET['page'] : ''), 'post', 'enctype="multipart/form-data"');
$languages = zen_get_languages();
for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
if (isset($_GET['read']) && $_GET['read'] == 'only') {
$pInfo->products_name = zen_get_products_name($pInfo->products_id, $languages[$i]['id']);
$pInfo->products_description = zen_get_products_description($pInfo->products_id, $languages[$i]['id']);
$pInfo->products_url = zen_get_products_url($pInfo->products_id, $languages[$i]['id']);
} else {
$pInfo->products_name = zen_db_prepare_input($products_name[$languages[$i]['id']]);
$pInfo->products_description = zen_db_prepare_input($products_description[$languages[$i]['id']]);
$pInfo->products_url = zen_db_prepare_input($products_url[$languages[$i]['id']]);
}
$specials_price = zen_get_products_special_price($pID);
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading"><?php
echo zen_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . $pInfo->products_name;
?>
</td>
<td class="pageHeading" align="right"><?php
echo $currencies->format($pInfo->products_price) . ($pInfo->products_virtual == 1 ? '<span class="errorText">' . '<br />' . TEXT_VIRTUAL_PREVIEW . '</span>' : '') . ($pInfo->product_is_always_free_shipping == 1 ? '<span class="errorText">' . '<br />' . TEXT_FREE_SHIPPING_PREVIEW . '</span>' : '') . ($pInfo->products_priced_by_attribute == 1 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_PRICED_BY_ATTRIBUTES_PREVIEW . '</span>' : '') . ($pInfo->product_is_free == 1 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_IS_FREE_PREVIEW . '</span>' : '') . ($pInfo->product_is_call == 1 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_IS_CALL_PREVIEW . '</span>' : '') . ($pInfo->products_qty_box_status == 0 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_QTY_BOX_STATUS_PREVIEW . '</span>' : '') . ($pInfo->products_priced_by_attribute == 1 ? '<br />' . zen_get_products_display_price($_GET['pID']) : '');
?>
</td>
</tr>
</table></td>
示例6: importProduct
//.........这里部分代码省略.........
if (isset($val['language_id'])) {
$sql = 'UPDATE ' . TABLE_PRODUCTS_DESCRIPTION . ' SET ' . $val['csv_columns_dbcolumn'] . '=\'' . zen_db_input($data[$key]) . '\' WHERE products_id=' . $products_id . ' AND language_id=' . $val['language_id'] . '';
$this->db->Execute($sql);
}
} elseif ($val['csv_columns_dbtable'] == 'meta_tags_products_description') {
if (isset($val['language_id'])) {
$meta_tags[$val['language_id']][$val['csv_columns_dbcolumn']] = $data[$key];
}
} elseif ($val['csv_columns_dbtable'] == 'featured') {
$featured[$val['csv_columns_dbcolumn']] = $data[$key];
} elseif ($val['csv_columns_dbtable'] == 'specials') {
$specials[$val['csv_columns_dbcolumn']] = $data[$key];
}
}
if (isset($meta_tags)) {
foreach ($meta_tags as $key => $val) {
if (!empty($val['metatags_title']) || !empty($val['metatags_keywords']) || !empty($val['metatags_description'])) {
// set metatags
$sql = 'SELECT * FROM ' . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . ' WHERE products_id=' . $products_id . ' AND language_id=' . $key . '';
$meta_tags_record = $this->db->Execute($sql);
if ($meta_tags_record->RecordCount() == 0) {
$sql = 'INSERT INTO ' . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . ' (products_id, language_id) VALUES (\'' . $products_id . '\', \'' . $key . '\')';
$this->db->Execute($sql);
}
$sql = 'UPDATE ' . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . ' SET metatags_title=\'' . zen_db_input($val['metatags_title']) . '\', metatags_keywords=\'' . zen_db_input($val['metatags_keywords']) . '\', metatags_description=\'' . zen_db_input($val['metatags_description']) . '\' WHERE products_id=' . $products_id . ' AND language_id=' . $key . '';
$this->db->Execute($sql);
} else {
// delete metatags
$sql = 'DELETE FROM ' . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . ' WHERE products_id=' . $products_id . ' AND language_id=' . $key . '';
$this->db->Execute($sql);
}
}
}
if (isset($featured)) {
if (!empty($featured['featured_date_available']) || !empty($featured['expires_date'])) {
// set featured
$sql = 'SELECT * FROM ' . TABLE_FEATURED . ' WHERE products_id=' . $products_id . '';
$featured_record = $this->db->Execute($sql);
if ($featured_record->RecordCount() == 0) {
$sql = 'INSERT INTO ' . TABLE_FEATURED . ' (products_id) VALUES (\'' . $products_id . '\')';
$this->db->Execute($sql);
}
$sql = 'UPDATE ' . TABLE_FEATURED . ' SET featured_date_available=\'' . zen_db_input($featured['featured_date_available']) . '\', expires_date=\'' . zen_db_input($featured['expires_date']) . '\' WHERE products_id=' . $products_id . '';
$this->db->Execute($sql);
} else {
// delete featured
$sql = 'DELETE FROM ' . TABLE_FEATURED . ' WHERE products_id=' . $products_id . '';
$this->db->Execute($sql);
}
}
if (isset($specials)) {
if (!empty($specials['specials_new_products_price'])) {
// prepare data
$status = 1;
if (!isset($specials['specials_date_available']) || empty($specials['specials_date_available'])) {
$specials['specials_date_available'] = '0001-01-01';
$status = $status * 1;
} else {
$available_time = strtotime($specials['specials_date_available']);
if ($available_time !== false && $available_time <= time()) {
$status = $status * 1;
} else {
$status = $status * 0;
}
}
if (!isset($specials['expires_date']) || empty($specials['expires_date'])) {
$specials['expires_date'] = '0001-01-01';
$status = $status * 1;
} else {
$expire_time = strtotime($specials['expires_date']);
if ($expire_time !== false && $expire_time >= time()) {
$status = $status * 1;
} else {
$status = $status * 0;
}
}
// set specials
$sql = 'SELECT * FROM ' . TABLE_SPECIALS . ' WHERE products_id=' . $products_id . '';
$specials_record = $this->db->Execute($sql);
if ($specials_record->RecordCount() == 0) {
$sql = 'INSERT INTO ' . TABLE_SPECIALS . ' (products_id, specials_date_added, specials_last_modified) VALUES (\'' . $products_id . '\', NOW(), NOW())';
$this->db->Execute($sql);
}
$sql = 'UPDATE ' . TABLE_SPECIALS . ' SET specials_new_products_price=\'' . zen_db_input($specials['specials_new_products_price']) . '\', expires_date=\'' . zen_db_input($specials['expires_date']) . '\', specials_date_available=\'' . zen_db_input($specials['specials_date_available']) . '\', status=' . $status . ', date_status_change=NOW(), specials_last_modified=NOW() WHERE products_id=' . $products_id . '';
$this->db->Execute($sql);
} else {
// delete specials
$sql = 'DELETE FROM ' . TABLE_SPECIALS . ' WHERE products_id=' . $products_id . '';
$this->db->Execute($sql);
}
}
// update products_price_sorter
$special_price = zen_get_products_special_price($products_id);
$products_price = isset($products_price) ? $products_price : 0;
$products_price_sorter = $special_price === false ? $products_price : $special_price;
$sql = 'UPDATE ' . TABLE_PRODUCTS . ' SET products_price_sorter=\'' . zen_db_input($products_price_sorter) . '\' WHERE products_id=' . $products_id;
$this->db->Execute($sql);
$this->messageStack->add(PRODUCT_CSV_MESSAGE_SUCCESS, 'success');
return true;
}
示例7: 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') {
//.........这里部分代码省略.........
示例8: zen_get_products_discount_price_qty
function zen_get_products_discount_price_qty($product_id, $check_qty, $check_amount = 0)
{
global $db, $cart;
$new_qty = $_SESSION['cart']->in_cart_mixed_discount_quantity($product_id);
// check for discount qty mix
if ($new_qty > $check_qty) {
$check_qty = $new_qty;
}
$product_id = (int) $product_id;
$products_query = $db->Execute("select products_discount_type, products_discount_type_from, products_priced_by_attribute from " . TABLE_PRODUCTS . " where products_id='" . $product_id . "'");
$products_discounts_query = $db->Execute("select * from " . TABLE_PRODUCTS_DISCOUNT_QUANTITY . " where products_id='" . $product_id . "' and discount_qty <='" . $check_qty . "' order by discount_qty desc");
$display_price = zen_get_products_base_price($product_id);
$display_specials_price = zen_get_products_special_price($product_id, true);
switch ($products_query->fields['products_discount_type']) {
// none
case $products_discounts_query->EOF:
//no discount applies
$discounted_price = zen_get_products_actual_price($product_id);
break;
case '0':
$discounted_price = zen_get_products_actual_price($product_id);
break;
// percentage discount
// percentage discount
case '1':
if ($products_query->fields['products_discount_type_from'] == '0') {
// priced by attributes
if ($check_amount != 0) {
$discounted_price = $check_amount - $check_amount * ($products_discounts_query->fields['discount_price'] / 100);
//echo 'ID#' . $product_id . ' Amount is: ' . $check_amount . ' discount: ' . $discounted_price . '<br />';
//echo 'I SEE 2 for ' . $products_query->fields['products_discount_type'] . ' - ' . $products_query->fields['products_discount_type_from'] . ' - '. $check_amount . ' new: ' . $discounted_price . ' qty: ' . $check_qty;
} else {
$discounted_price = $display_price - $display_price * ($products_discounts_query->fields['discount_price'] / 100);
}
} else {
if (!$display_specials_price) {
// priced by attributes
if ($check_amount != 0) {
$discounted_price = $check_amount - $check_amount * ($products_discounts_query->fields['discount_price'] / 100);
} else {
$discounted_price = $display_price - $display_price * ($products_discounts_query->fields['discount_price'] / 100);
}
} else {
$discounted_price = $display_specials_price - $display_specials_price * ($products_discounts_query->fields['discount_price'] / 100);
}
}
break;
// actual price
// actual price
case '2':
if ($products_query->fields['products_discount_type_from'] == '0') {
$discounted_price = $products_discounts_query->fields['discount_price'];
} else {
$discounted_price = $products_discounts_query->fields['discount_price'];
}
break;
// amount offprice
// amount offprice
case '3':
if ($products_query->fields['products_discount_type_from'] == '0') {
$discounted_price = $display_price - $products_discounts_query->fields['discount_price'];
} else {
if (!$display_specials_price) {
$discounted_price = $display_price - $products_discounts_query->fields['discount_price'];
} else {
$discounted_price = $display_specials_price - $products_discounts_query->fields['discount_price'];
}
}
break;
}
return $discounted_price;
}
示例9: zen_get_products_base_price
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
<td colspan="2" class="breadCrumb"><?php
echo $breadcrumb->trail(BREAD_CRUMBS_SEPARATOR);
?>
</td>
</tr>
<tr>
<td colspan="2" class="smallText">
<?php
if (false) {
echo 'Looking at ' . (int) $_GET['products_id'] . '<br />';
echo 'Base Price ' . zen_get_products_base_price((int) $_GET['products_id']) . '<br />';
echo 'Actual Price ' . zen_get_products_actual_price((int) $_GET['products_id']) . '<br />';
echo 'Special Price ' . zen_get_products_special_price((int) $_GET['products_id'], true) . '<br />';
echo 'Sale Maker Discount Type ' . zen_get_products_sale_discount_type((int) $_GET['products_id']) . '<br />';
echo 'Discount Calc ' . zen_get_discount_calc((int) $_GET['products_id']) . '<br />';
echo 'Discount Calc Attr $100 $75 $50 $25 ' . zen_get_discount_calc((int) $_GET['products_id'], true, 100) . ' | ' . zen_get_discount_calc((int) $_GET['products_id'], true, 75) . ' | ' . zen_get_discount_calc((int) $_GET['products_id'], true, 50) . ' | ' . zen_get_discount_calc((int) $_GET['products_id'], true, 25) . '<br />';
}
?>
</td>
</tr>
<?php
if (PRODUCT_INFO_PREVIOUS_NEXT == '1' or PRODUCT_INFO_PREVIOUS_NEXT == '3') {
?>
<tr>
<td colspan="2" align="center">
<?php
require $template->get_template_dir('/tpl_products_next_previous.php', DIR_WS_TEMPLATE, $current_page_base, 'templates') . '/tpl_products_next_previous.php';
示例10: zen_get_products_discount_price_qty
function zen_get_products_discount_price_qty($product_id, $check_qty, $check_amount = 0)
{
global $db, $cart;
$new_qty = $_SESSION['cart']->in_cart_mixed_discount_quantity($product_id);
// check for discount qty mix
if ($new_qty > $check_qty) {
$check_qty = $new_qty;
}
$product_id = (int) $product_id;
$products_query = $db->Execute("select products_discount_type, products_discount_type_from, products_priced_by_attribute from " . TABLE_PRODUCTS . " where products_id='" . (int) $product_id . "'");
$products_query_discount_type = $products_query->fields['products_discount_type'];
$products_discounts_query = $db->Execute("select * from " . TABLE_PRODUCTS_DISCOUNT_QUANTITY . " where products_id='" . (int) $product_id . "' and discount_qty <='" . (double) $check_qty . "' order by discount_qty desc");
if ($products_discounts_query->RecordCount() <= 0 and $products_query_discount_type == 0) {
$products_query2 = $db->Execute("select categories_discount_type, categories_discount_type_from FROM " . TABLE_CATEGORIES . " c , " . TABLE_PRODUCTS_TO_CATEGORIES . " pc where c.categories_id = pc.categories_id AND products_id='" . (int) $product_id . "'");
$products_query_discount_type = $products_query2->fields['categories_discount_type'];
$products_discounts_query = $db->Execute("SELECT * FROM " . TABLE_CATEGORIES_DISCOUNT_QUANTITY . " cd," . TABLE_PRODUCTS_TO_CATEGORIES . " pc WHERE cd.categories_id = pc.categories_id AND products_id = " . (int) $product_id . " AND discount_qty <= '" . (double) $check_qty . "' ORDER BY discount_qty DESC");
}
if (zen_get_products_base_price($product_id) == 0) {
$display_price = zen_get_products_sample_price($product_id);
} else {
$display_price = zen_get_products_base_price($product_id);
}
$display_specials_price = zen_get_products_special_price($product_id, true);
switch ($products_query_discount_type) {
// none
case $products_discounts_query->EOF:
//no discount applies
$discounted_price = zen_get_products_actual_price($product_id);
break;
case '0':
$discounted_price = zen_get_products_actual_price($product_id);
break;
// percentage discount
// percentage discount
case '1':
if ($products_query->fields['products_discount_type_from'] == '0') {
// priced by attributes
if ($check_amount != 0) {
$discounted_price = $check_amount - $check_amount * ($products_discounts_query->fields['discount_price'] / 100);
//echo 'ID#' . $product_id . ' Amount is: ' . $check_amount . ' discount: ' . $discounted_price . '<br />';
//echo 'I SEE 2 for ' . $products_query->fields['products_discount_type'] . ' - ' . $products_query->fields['products_discount_type_from'] . ' - '. $check_amount . ' new: ' . $discounted_price . ' qty: ' . $check_qty;
} else {
$discounted_price = $display_price - $display_price * ($products_discounts_query->fields['discount_price'] / 100);
}
} else {
if (!$display_specials_price) {
// priced by attributes
if ($check_amount != 0) {
$discounted_price = $check_amount - $check_amount * ($products_discounts_query->fields['discount_price'] / 100);
} else {
$discounted_price = $display_price - $display_price * ($products_discounts_query->fields['discount_price'] / 100);
}
} else {
$discounted_price = $display_specials_price - $display_specials_price * ($products_discounts_query->fields['discount_price'] / 100);
}
}
break;
// actual price
// actual price
case '2':
if ($products_query->fields['products_discount_type_from'] == '0') {
$discounted_price = $products_discounts_query->fields['discount_price'];
} else {
$discounted_price = $products_discounts_query->fields['discount_price'];
}
break;
// amount offprice
// amount offprice
case '3':
if ($products_query->fields['products_discount_type_from'] == '0') {
$discounted_price = $display_price - $products_discounts_query->fields['discount_price'];
} else {
if (!$display_specials_price) {
$discounted_price = $display_price - $products_discounts_query->fields['discount_price'];
} else {
$discounted_price = $display_specials_price - $products_discounts_query->fields['discount_price'];
}
}
break;
}
return $discounted_price;
}
示例11: 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:
//.........这里部分代码省略.........
示例12: zen_get_products_price_is_priced_by_attributes
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;
break;
// percentage discount
示例13: GetPriceList
/**
* @author chenliujin <liujin.chen@qq.com>
* @since 2016-09-29
* TODO clear $db, $currencies
*/
public static function GetPriceList($products_id)
{
global $db, $currencies;
$price = new \stdClass();
$product_check = $db->Execute("\n\t\t\tselect \n\t\t\t\tproducts_tax_class_id, \n\t\t\t\tproducts_price, \n\t\t\t\tproducts_priced_by_attribute, \n\t\t\t\tproduct_is_free, \n\t\t\t\tproduct_is_call, \n\t\t\t\tproducts_type \n\t\t\tfrom " . TABLE_PRODUCTS . " \n\t\t\twhere products_id = '" . (int) $products_id . "'" . " limit 1");
// no prices on Document General
if ($product_check->fields['products_type'] == 3) {
return '';
}
$price->normal_price = zen_get_products_base_price($products_id);
$price->special_price = zen_get_products_special_price($products_id, true);
$price->sale_price = zen_get_products_special_price($products_id, false);
if ($price->sale_price) {
$price->sale_discount = $currencies->format($price->normal_price - $price->sale_price);
$price->sale_discount .= ' ';
$price->sale_discount .= '(' . number_format(100 - $price->sale_price / $price->normal_price * 100, SHOW_SALE_DISCOUNT_DECIMALS) . '%)';
} else {
$price->sale_discount = $currencies->format($price->normal_price - $price->special_price);
$price->sale_discount .= ' ';
$price->sale_discount .= '(' . number_format(100 - $price->special_price / $price->normal_price * 100, SHOW_SALE_DISCOUNT_DECIMALS) . '%)';
}
return $price;
}
示例14: eo_get_product_attribute_prices
function eo_get_product_attribute_prices($attr_id, $attr_value = '', $qty = 1)
{
global $db;
$retval = array('onetime_charges' => 0, 'price' => 0);
$attribute_price = $db->Execute('SELECT * ' . 'FROM `' . TABLE_PRODUCTS_ATTRIBUTES . '` ' . 'WHERE `products_attributes_id`=\'' . (int) $attr_id . '\'');
$attr_id = (int) $attr_id;
$qty = (int) $qty;
$product_id = (int) $attribute_price->fields['products_id'];
// Only check when attributes is not free or the product is not free
if ($attribute_price->fields['product_attribute_is_free'] != '1' || !zen_get_products_price_is_free($product_id)) {
// Handle based upon discount enabled
if ($attribute_price->fields['attributes_discounted'] == '1') {
// Calculate proper discount for attributes
$added_charge = zen_get_discount_calc($product_id, $attr_id, $attribute_price->fields['options_values_price'], $qty);
} else {
$added_charge = $attribute_price->fields['options_values_price'];
}
// Handle negative price prefix
// Other price prefixes ("+" and "") should add so no special processing
if ($attribute_price->fields['price_prefix'] == '-') {
$added_charge = -1 * $added_charge;
}
$retval['price'] += $added_charge;
//////////////////////////////////////////////////
// calculate additional charges
// products_options_value_text
if (zen_get_attributes_type($attr_id) == PRODUCTS_OPTIONS_TYPE_TEXT) {
$text_words = zen_get_word_count_price($attr_value, $attribute_price->fields['attributes_price_words_free'], $attribute_price->fields['attributes_price_words']);
$text_letters = zen_get_letters_count_price($attr_value, $attribute_price->fields['attributes_price_letters_free'], $attribute_price->fields['attributes_price_letters']);
$retval['price'] += $text_letters;
$retval['price'] += $text_words;
}
// attributes_price_factor
$added_charge = 0;
if ($attribute_price->fields['attributes_price_factor'] > 0) {
$chk_price = zen_get_products_base_price($products_id);
$chk_special = zen_get_products_special_price($products_id, false);
$added_charge = zen_get_attributes_price_factor($chk_price, $chk_special, $attribute_price->fields['attributes_price_factor'], $attribute_price->fields['attributes_price_factor_offset']);
$retval['price'] += $added_charge;
}
// attributes_qty_prices
$added_charge = 0;
if ($attribute_price->fields['attributes_qty_prices'] != '') {
$chk_price = zen_get_products_base_price($products_id);
$chk_special = zen_get_products_special_price($products_id, false);
$added_charge = zen_get_attributes_qty_prices_onetime($attribute_price->fields['attributes_qty_prices'], $qty);
$retval['price'] += $added_charge;
}
// attributes_price_onetime
if ($attribute_price->fields['attributes_price_onetime'] > 0) {
$retval['onetime_charges'] = (double) $attribute_price->fields['attributes_price_onetime'];
}
// attributes_price_factor_onetime
$added_charge = 0;
if ($attribute_price->fields['attributes_price_factor_onetime'] > 0) {
$chk_price = zen_get_products_base_price($products_id);
$chk_special = zen_get_products_special_price($products_id, false);
$added_charge = zen_get_attributes_price_factor($chk_price, $chk_special, $attribute_price->fields['attributes_price_factor_onetime'], $attribute_price->fields['attributes_price_factor_onetime_offset']);
$retval['onetime_charges'] += $added_charge;
}
// attributes_qty_prices_onetime
$added_charge = 0;
if ($attribute_price->fields['attributes_qty_prices_onetime'] != '') {
$chk_price = zen_get_products_base_price($products_id);
$chk_special = zen_get_products_special_price($products_id, false);
$added_charge = zen_get_attributes_qty_prices_onetime($attribute_price->fields['attributes_qty_prices_onetime'], $qty);
$retval['onetime_charges'] += $added_charge;
}
////////////////////////////////////////////////
}
return $retval;
}
示例15: array
$option_value_details[$option_id][$option_value_id] = array ("options_values_price" => $opt_options_values_price);
$option_names[$option_id] = $opt_products_options_name;
$option_values_names[$option_value_id] = $opt_products_options_values_name;
}
} */
// Get Product Info
$InfoQuery = "select p.products_model,p.products_price,pd.products_name,p.products_tax_class_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on pd.products_id=p.products_id where p.products_id='{$add_product_products_id}'";
$result = $db->Execute($InfoQuery);
#$row = zen_db_fetch_array($result);
extract($result->fields, EXTR_PREFIX_ALL, "p");
// Following functions are defined at the bottom of this file
$CountryID = zen_get_country_id($order->delivery["country"]);
$ZoneID = zen_get_zone_id($CountryID, $order->delivery["state"]);
$ProductsTax = zen_get_tax_rate($p_products_tax_class_id, $CountryID, $ZoneID);
if ($_POST[applyspecialstoprice] && zen_get_products_special_price((int) $add_product_products_id)) {
$product_price_woa = zen_get_products_special_price((int) $add_product_products_id);
} else {
$product_price_woa = $p_products_price;
}
$Query = "insert into " . TABLE_ORDERS_PRODUCTS . " set\n\t\t\t\torders_id = {$oID},\n\t\t\t\tproducts_id = {$add_product_products_id},\n\t\t\t\tproducts_model = '{$p_products_model}',\n\t\t\t\tproducts_name = '" . str_replace("'", "'", $p_products_name) . "',\n\t\t\t\tproducts_price = '{$product_price_woa}',\n\t\t\t\tfinal_price = '" . ($product_price_woa + $AddedOptionsPrice) . "',\n\t\t\t\tproducts_tax = '{$ProductsTax}',\n\t\t\t\tproducts_quantity = {$add_product_quantity},\n onetime_charges = {$AddedOptionsPrice_OneTime};";
$db->Execute($Query);
$new_product_id = zen_db_insert_id();
//UPDATE_INVENTORY_QUANTITY_START##############################################################################################################
if (STOCK_LIMITED == "true") {
$db->Execute("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity - " . $add_product_quantity . ", products_ordered = products_ordered + " . $add_product_quantity . " where products_id = '" . $add_product_products_id . "'");
} else {
$db->Execute("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . $add_product_quantity . " where products_id = '" . $add_product_products_id . "'");
}
//UPDATE_INVENTORY_QUANTITY_END##############################################################################################################
if ($_POST[optionstoadd] != NULL) {
for ($i = 1; $i <= $_POST[optionstoadd]; $i++) {