本文整理汇总了PHP中zen_get_attributes_qty_prices_onetime函数的典型用法代码示例。如果您正苦于以下问题:PHP zen_get_attributes_qty_prices_onetime函数的具体用法?PHP zen_get_attributes_qty_prices_onetime怎么用?PHP zen_get_attributes_qty_prices_onetime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zen_get_attributes_qty_prices_onetime函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: attributes_price_onetime_charges
/**
* Method to calculate one time price of attributes for a given item
*
* @param mixed the product ID of the item to check
* @param decimal item quantity
* @return decimal the pice of the items attributes
* @global object access to the db object
*/
function attributes_price_onetime_charges($products_id, $qty)
{
global $db;
$attributes_price_onetime = 0;
if (isset($this->contents[$products_id]['attributes'])) {
reset($this->contents[$products_id]['attributes']);
while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
$attribute_price_query = "select *\n from " . TABLE_PRODUCTS_ATTRIBUTES . "\n where products_id = '" . (int) $products_id . "'\n and options_id = '" . (int) $option . "'\n and options_values_id = '" . (int) $value . "'";
$attribute_price = $db->Execute($attribute_price_query);
// Dual Pricing start
if ($_SESSION['customer_id']) {
$customers_id = $_SESSION['customer_id'];
$customer_check = $db->Execute("select * from " . TABLE_CUSTOMERS . " where customers_id = '{$customers_id}'");
if ($customer_check->fields['customers_whole'] != "0") {
$i = $customer_check->fields['customers_whole'];
$i--;
$options_value_price = (double) $attribute_price->fields['options_values_price_w'];
} else {
$options_value_price = $attribute_price->fields['options_values_price'];
}
} else {
$options_value_price = $attribute_price->fields['options_values_price'];
}
// Dual Pricing end
$new_attributes_price = 0;
$discount_type_id = '';
$sale_maker_discount = '';
// if ($attribute_price->fields['product_attribute_is_free']) {
if ($attribute_price->fields['product_attribute_is_free'] == '1' and zen_get_products_price_is_free((int) $products_id)) {
// no charge
} else {
$discount_type_id = '';
$sale_maker_discount = '';
$new_attributes_price = zen_get_discount_calc($products_id, $attribute_price->fields['products_attributes_id'], $attribute_price->fields['options_values_price'], $qty);
//////////////////////////////////////////////////
// calculate additional one time charges
//// one time charges
// attributes_price_onetime
if ($attribute_price->fields['attributes_price_onetime'] > 0) {
if ((int) $products_id != $products_id) {
die('I DO NOT MATCH ' . $products_id);
}
$attributes_price_onetime += $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']);
$attributes_price_onetime += $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);
$attributes_price_onetime += $added_charge;
}
//////////////////////////////////////////////////
}
}
}
return $attributes_price_onetime;
}
示例2: zen_get_attributes_price_final_onetime
function zen_get_attributes_price_final_onetime($attribute, $qty = 1, $pre_selected_onetime)
{
global $db;
global $cart;
if ($pre_selected_onetime == '' or $attribute != $pre_selected_onetime->fields["products_attributes_id"]) {
$pre_selected_onetime = $db->Execute("select pa.* from " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_attributes_id= '" . $attribute . "'");
} else {
// use existing select
}
// one time charges
// onetime charge
$attributes_price_final_onetime += $pre_selected_onetime->fields["attributes_price_onetime"];
// price factor
$display_normal_price = zen_get_products_actual_price($pre_selected_onetime->fields["products_id"]);
$display_special_price = zen_get_products_special_price($pre_selected_onetime->fields["products_id"]);
// price factor one time
$attributes_price_final_onetime += zen_get_attributes_price_factor($display_normal_price, $display_special_price, $pre_selected_onetime->fields["attributes_price_factor_onetime"], $pre_selected_onetime->fields["attributes_price_factor_onetime_offset"]);
// onetime charge qty price
$attributes_price_final_onetime += zen_get_attributes_qty_prices_onetime($pre_selected_onetime->fields["attributes_qty_prices_onetime"], 1);
return $attributes_price_final_onetime;
}
示例3: attributes_price_onetime_charges
/**
* Method to calculate one time price of attributes for a given item
*
* @param mixed the product ID of the item to check
* @param decimal item quantity
* @return decimal the pice of the items attributes
*/
public function attributes_price_onetime_charges($products_id, $qty)
{
$attributes_price_onetime = 0;
if (isset($this->contents[$products_id]['attributes'])) {
reset($this->contents[$products_id]['attributes']);
while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
$attribute_price_query = "select *\n from %table.products_attributes%\n where products_id = '" . (int) $products_id . "'\n and options_id = '" . (int) $option . "'\n and options_values_id = '" . (int) $value . "'";
$attribute_price = $this->getDb()->Execute($attribute_price_query);
$new_attributes_price = 0;
$discount_type_id = '';
$sale_maker_discount = '';
if ($attribute_price->fields['product_attribute_is_free'] == '1' and zen_get_products_price_is_free((int) $products_id)) {
// no charge
} else {
$discount_type_id = '';
$sale_maker_discount = '';
$new_attributes_price = zen_get_discount_calc($products_id, $attribute_price->fields['products_attributes_id'], $attribute_price->fields['options_values_price'], $qty);
//////////////////////////////////////////////////
// calculate additional one time charges
//// one time charges
// attributes_price_onetime
if ($attribute_price->fields['attributes_price_onetime'] > 0) {
if ((int) $products_id != $products_id) {
die('I DO NOT MATCH ' . $products_id);
}
$attributes_price_onetime += $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']);
$attributes_price_onetime += $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);
$attributes_price_onetime += $added_charge;
}
}
}
}
return $attributes_price_onetime;
}
示例4: 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;
}
示例5: getOrderAttributePrice
function getOrderAttributePrice($pAttributeHash, $pProductHash)
{
$ret = 0;
// normal attributes price
if ($pAttributeHash["price_prefix"] == '-') {
$ret -= $pAttributeHash["options_values_price"];
} else {
$ret += $pAttributeHash["options_values_price"];
}
// qty discounts
$ret += zen_get_attributes_qty_prices_onetime($pAttributeHash["attributes_qty_prices"], $pProductHash['products_quantity']);
// price factor
$display_normal_price = $pProductHash['price'];
$ret += zen_get_attributes_price_factor($pProductHash['price'], $pProductHash['price'], $pAttributeHash["attributes_price_factor"], $pAttributeHash["attributes_pf_offset"]);
// per word and letter charges
if (zen_get_attributes_type($pAttributeHash['products_attributes_id']) == PRODUCTS_OPTIONS_TYPE_TEXT) {
// calc per word or per letter
}
return $ret;
}
示例6: getAttributesPriceFinalOnetime
function getAttributesPriceFinalOnetime($pOptionsValuesId, $pQuantity = 1)
{
global $gBitDb;
$attributes_price_final_onetime = 0;
if ($optionValue = $this->getOptionValue(NULL, $pOptionsValuesId)) {
// one time charges
// onetime charge
$attributes_price_final_onetime = $optionValue["attributes_price_onetime"];
// price factor
$display_normal_price = $this->getBasePrice();
$display_special_price = $this->getSpecialPrice();
// price factor one time
$attributes_price_final_onetime += zen_get_attributes_price_factor($display_normal_price, $display_special_price, $optionValue["attributes_pf_onetime"], $optionValue["attributes_pf_onetime_offset"]);
// onetime charge qty price
$attributes_price_final_onetime += zen_get_attributes_qty_prices_onetime($optionValue["attributes_qty_prices_onetime"], 1);
}
return $attributes_price_final_onetime;
}