本文整理汇总了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函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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());
}
}
开发者ID:zenmagick,项目名称:zenmagick,代码行数:11,代码来源:ProductPricingTest.php
示例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 {
//.........这里部分代码省略.........
开发者ID:dalinhuang,项目名称:kakayaga,代码行数:101,代码来源:pure_green.php
示例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);
}
}
//.........这里部分代码省略.........
开发者ID:zenmagick,项目名称:zenmagick,代码行数:101,代码来源:ShoppingCart.php
示例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();
}
开发者ID:wwxgitcat,项目名称:zencart_v1.0,代码行数:31,代码来源:export.php
示例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>
开发者ID:dalinhuang,项目名称:kakayaga,代码行数:31,代码来源:preview_info.php
示例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;
}
开发者ID:homework-bazaar,项目名称:zencart-sugu,代码行数:101,代码来源:ProductCSV.php
示例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') {
//.........这里部分代码省略.........
开发者ID:jeking928,项目名称:Dual-Pricing-2.1.6,代码行数:101,代码来源:shopping_cart.php
示例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;
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:72,代码来源:functions_prices.php
示例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';
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:31,代码来源:tpl_product_info_display.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;
}
开发者ID:happyxlq,项目名称:lt_svn,代码行数:82,代码来源:functions_prices.php
示例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($ch
|
请发表评论