本文整理汇总了PHP中zen_get_word_count_price函数的典型用法代码示例。如果您正苦于以下问题:PHP zen_get_word_count_price函数的具体用法?PHP zen_get_word_count_price怎么用?PHP zen_get_word_count_price使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zen_get_word_count_price函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: stripslashes
// if ((str_replace('txt_', '', $key) == $products_options_names->fields['products_options_id'] and $value == $products_options->fields['products_options_values_id'])) {
$tmp_html = '<input type="text" name ="id[' . TEXT_PREFIX . $products_options_names->fields['products_options_id'] . ']" size="' . $products_options_names->fields['products_options_size'] . '" maxlength="' . $products_options_names->fields['products_options_length'] . '" value="' . stripslashes($value) . '" /> ';
$tmp_html .= $products_options_details;
break;
}
}
} else {
$tmp_value = $gBitCustomer->mCart->contents[$_GET['products_id']]['attributes_values'][$products_options_names->fields['products_options_id']];
$tmp_html = '<input type="text" name ="id[' . TEXT_PREFIX . $products_options_names->fields['products_options_id'] . ']" size="' . $products_options_names->fields['products_options_size'] . '" maxlength="' . $products_options_names->fields['products_options_length'] . '" value="' . htmlspecialchars($tmp_value) . '" /> ';
$tmp_html .= $products_options_details;
$tmp_word_cnt_string = '';
// calculate word charges
$tmp_word_cnt = 0;
$tmp_word_cnt_string = $gBitCustomer->mCart->contents[$_GET['products_id']]['attributes_values'][$products_options_names->fields['products_options_id']];
$tmp_word_cnt = zen_get_word_count($tmp_word_cnt_string, $products_options->fields['attributes_price_words_free']);
$tmp_word_price = zen_get_word_count_price($tmp_word_cnt_string, $products_options->fields['attributes_price_words_free'], $products_options->fields['attributes_price_words']);
if ($products_options->fields['attributes_price_words'] != 0) {
$tmp_html .= TEXT_PER_WORD . $currencies->display_price($products_options->fields['attributes_price_words'], zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . ($products_options->fields['attributes_price_words_free'] != 0 ? TEXT_WORDS_FREE . $products_options->fields['attributes_price_words_free'] : '');
}
if ($tmp_word_cnt != 0 and $tmp_word_price != 0) {
$tmp_word_price = $currencies->display_price($tmp_word_price, zen_get_tax_rate($product_info->fields['products_tax_class_id']));
$tmp_html = $tmp_html . '<br />' . TEXT_CHARGES_WORD . ' ' . $tmp_word_cnt . ' = ' . $tmp_word_price;
}
// calculate letter charges
$tmp_letters_cnt = 0;
$tmp_letters_cnt_string = $gBitCustomer->mCart->contents[$_GET['products_id']]['attributes_values'][$products_options_names->fields['products_options_id']];
$tmp_letters_cnt = zen_get_letters_count($tmp_letters_cnt_string, $products_options->fields['attributes_price_letters_free']);
$tmp_letters_price = zen_get_letters_count_price($tmp_letters_cnt_string, $products_options->fields['attributes_price_letters_free'], $products_options->fields['attributes_price_letters']);
if ($products_options->fields['attributes_price_letters'] != 0) {
$tmp_html .= TEXT_PER_LETTER . $currencies->display_price($products_options->fields['attributes_price_letters'], zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . ($products_options->fields['attributes_price_letters_free'] != 0 ? TEXT_LETTERS_FREE . $products_options->fields['attributes_price_letters_free'] : '');
}
开发者ID:bitweaver,项目名称:commerce,代码行数:31,代码来源:main_template_vars_attributes.php
示例2: attributes_price
/**
* Method to calculate price of attributes for a given item
*
* @param mixed the product ID of the item to check
* @return decimal the pice of the items attributes
* @global object access to the db object
*/
function attributes_price($products_id)
{
global $db, $currencies;
$total_attributes_price = 0;
$qty = $this->contents[$products_id]['qty'];
if (isset($this->contents[$products_id]['attributes'])) {
reset($this->contents[$products_id]['attributes']);
while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
$attributes_price = 0;
$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 {
// + or blank adds
if ($attribute_price->fields['price_prefix'] == '-') {
// calculate proper discount for attributes
if ($attribute_price->fields['attributes_discounted'] == '1') {
$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);
$attributes_price -= $new_attributes_price;
} else {
$attributes_price -= $attribute_price->fields['options_values_price'];
}
} else {
if ($attribute_price->fields['attributes_discounted'] == '1') {
// calculate proper discount for attributes
$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);
// Dual Pricing start
if ($_SESSION['customer_id']) {
if ($customer_check->fields['customers_whole'] != "0") {
$new_attributes_price = zen_get_discount_calc($products_id, $attribute_price->fields['products_attributes_id'], $attribute_price->fields['options_values_price_w'], $qty);
}
}
// Dual Pricing end
$attributes_price += $new_attributes_price;
} else {
$attributes_price += $attribute_price->fields['options_values_price'];
}
}
//////////////////////////////////////////////////
// calculate additional charges
// products_options_value_text
if (zen_get_attributes_type($attribute_price->fields['products_attributes_id']) == PRODUCTS_OPTIONS_TYPE_TEXT) {
$text_words = zen_get_word_count_price($this->contents[$products_id]['attributes_values'][$attribute_price->fields['options_id']], $attribute_price->fields['attributes_price_words_free'], $attribute_price->fields['attributes_price_words']);
$text_letters = zen_get_letters_count_price($this->contents[$products_id]['attributes_values'][$attribute_price->fields['options_id']], $attribute_price->fields['attributes_price_letters_free'], $attribute_price->fields['attributes_price_letters']);
$attributes_price += $text_letters;
$attributes_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']);
$attributes_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'], $this->contents[$products_id]['qty']);
$attributes_price += $added_charge;
}
//////////////////////////////////////////////////
}
// Validate Attributes
if ($attribute_price->fields['attributes_display_only']) {
$_SESSION['valid_to_checkout'] = false;
$_SESSION['cart_errors'] .= zen_get_products_name($attribute_price->fields['products_id'], $_SESSION['languages_id']) . ERROR_PRODUCT_OPTION_SELECTION . '<br />';
//.........这里部分代码省略.........
开发者ID:jeking928,项目名称:Dual-Pricing-2.1.6,代码行数:101,代码来源:shopping_cart.php
示例3: get_attributes_quantity_price_for_editorders
}
$AddedOptionsPrice_OneTime += $row10a[4];
if (ATTRIBUTES_ENABLED_QTY_PRICES == true) {
if ($row10a[9] != '' && $row10a[9] != NULL) {
$AddedOptionsPrice += get_attributes_quantity_price_for_editorders($row10a[9], $add_product_quantity);
}
if ($row10a[10] != '' && $row10a[10] != NULL) {
$AddedOptionsPrice_OneTime += get_attributes_quantity_price_for_editorders($row10a[10], $add_product_quantity);
}
}
if ($_POST[$sendoptionontv] && ATTRIBUTES_ENABLED_TEXT_PRICES == true) {
if ($row10a[11] != 0) {
$AddedOptionsPrice += zen_get_letters_count_price($_POST[$sendoptionontv], $row10a[12], $row10a[11]);
}
if ($row10a[13] != 0) {
$AddedOptionsPrice += zen_get_word_count_price($_POST[$sendoptionontv], $row10a[14], $row10a[13]);
}
}
}
}
}
}
/* if(IsSet($add_product_options))
{
foreach($add_product_options as $option_id => $option_value_id)
{
$result = $db -> Execute("SELECT * FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa LEFT JOIN " . TABLE_PRODUCTS_OPTIONS . " po ON po.products_options_id=pa.options_id LEFT JOIN " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov ON pov.products_options_values_id=pa.options_values_id WHERE products_id='$add_product_products_id' and options_id=$option_id and options_values_id=$option_value_id");
###r.l. $row = zen_db_fetch_array($result);
$row = $result->fields;
extract($row, EXTR_PREFIX_ALL, "opt");
$AddedOptionsPrice += $opt_options_values_price;
开发者ID:homework-bazaar,项目名称:zencart-sugu,代码行数:31,代码来源:edit_orders.php
示例4: attributes_price
/**
* Method to calculate price of attributes for a given item
*
* @param mixed the product ID of the item to check
* @return decimal the pice of the items attributes
*/
public function attributes_price($products_id)
{
$attributes_price = 0;
$qty = $this->contents[$products_id]['qty'];
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 {
// + or blank adds
if ($attribute_price->fields['price_prefix'] == '-') {
// calculate proper discount for attributes
if ($attribute_price->fields['attributes_discounted'] == '1') {
$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);
$attributes_price -= $new_attributes_price;
} else {
$attributes_price -= $attribute_price->fields['options_values_price'];
}
} else {
if ($attribute_price->fields['attributes_discounted'] == '1') {
// calculate proper discount for attributes
$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);
$attributes_price += $new_attributes_price;
} else {
$attributes_price += $attribute_price->fields['options_values_price'];
}
}
//////////////////////////////////////////////////
// calculate additional charges
// products_options_value_text
if (zen_get_attributes_type($attribute_price->fields['products_attributes_id']) == PRODUCTS_OPTIONS_TYPE_TEXT) {
$text_words = zen_get_word_count_price($this->contents[$products_id]['attributes_values'][$attribute_price->fields['options_id']], $attribute_price->fields['attributes_price_words_free'], $attribute_price->fields['attributes_price_words']);
$text_letters = zen_get_letters_count_price($this->contents[$products_id]['attributes_values'][$attribute_price->fields['options_id']], $attribute_price->fields['attributes_price_letters_free'], $attribute_price->fields['attributes_price_letters']);
$attributes_price += $text_letters;
$attributes_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']);
$attributes_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'], $this->contents[$products_id]['qty']);
$attributes_price += $added_charge;
}
//////////////////////////////////////////////////
}
// Validate Attributes
if ($attribute_price->fields['attributes_display_only']) {
$this->setSessionVar('valid_to_checkout', false);
$cart_errors = $this->getSessionVar('cart_errors');
$cart_errors .= zen_get_products_name($attribute_price->fields['products_id'], $this->getSessionVar('languages_id')) . ERROR_PRODUCT_OPTION_SELECTION . '<br />';
$this->setSessionVar('cart_errors', $cart_errors);
}
}
}
return $attributes_price;
}
开发者ID:zenmagick,项目名称:zenmagick,代码行数:81,代码来源:ShoppingCart.php
示例5: attributes_price
/**
* Method to calculate price of attributes for a given item
*
* @param mixed the product ID of the item to check
* @return decimal the pice of the items attributes
* @global object access to the db object
*/
function attributes_price($products_id)
{
global $db;
$attributes_price = 0;
$qty = $this->contents[$products_id]['qty'];
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);
$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 {
// + or blank adds
if ($attribute_price->fields['price_prefix'] == '-') {
// calculate proper discount for attributes
if ($attribute_price->fields['attributes_discounted'] == '1') {
$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);
$attributes_price -= $new_attributes_price;
} else {
$attributes_price -= $attribute_price->fields['options_values_price'];
}
} else {
if ($attribute_price->fields['attributes_discounted'] == '1') {
// calculate proper discount for attributes
$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);
$attributes_price += $new_attributes_price;
} else {
$attributes_price += $attribute_price->fields['options_values_price'];
}
}
//////////////////////////////////////////////////
// calculate additional charges
// products_options_value_text
if (zen_get_attributes_type($attribute_price->fields['products_attributes_id']) == PRODUCTS_OPTIONS_TYPE_TEXT) {
$text_words = zen_get_word_count_price($this->contents[$products_id]['attributes_values'][$attribute_price->fields['options_id']], $attribute_price->fields['attributes_price_words_free'], $attribute_price->fields['attributes_price_words']);
$text_letters = zen_get_letters_count_price($this->contents[$products_id]['attributes_values'][$attribute_price->fields['options_id']], $attribute_price->fields['attributes_price_letters_free'], $attribute_price->fields['attributes_price_letters']);
$attributes_price += $text_letters;
$attributes_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']);
$attributes_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'], $this->contents[$products_id]['qty']);
$attributes_price += $added_charge;
}
//////////////////////////////////////////////////
}
// Validate Attributes
if ($attribute_price->fields['attributes_display_only']) {
$_SESSION['valid_to_checkout'] = false;
$_SESSION['cart_errors'] .= zen_get_products_name($attribute_price->fields['products_id'], $_SESSION['languages_id']) . ERROR_PRODUCT_OPTION_SELECTION . '<br />';
}
/*
//// extra testing not required on text attribute this is done in application_top before it gets to the cart
if ($attribute_price->fields['attributes_required']) {
$_SESSION['valid_to_checkout'] = false;
$_SESSION['cart_errors'] .= zen_get_products_name($attribute_price->fields['products_id'], $_SESSION['languages_id']) . ERROR_PRODUCT_OPTION_SELECTION . '<br />';
}
*/
}
}
foreach ((array) $this->contents[$products_id]['attributes'] as $key => $value) {
if (in_array($key, array('BUST', 'WAIST', 'HIPS', 'HOLLOW_TO_HEM'))) {
$attributes_price += strval(SIZE_SUBSIDIARY_PRICE);
break;
}
}
return $attributes_price;
}
开发者ID:happyxlq,项目名称:lt_svn,代码行数:95,代码来源:shopping_cart.php
示例6: 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;
}
开发者ID:bislewl,项目名称:super_edit_orders_with_ty,代码行数:72,代码来源:edit_orders_functions.php
示例7: getProductOptions
//.........这里部分代码省略.........
} else {
$tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . $vals['products_options_values_name'] . (!empty($products_options_details_noname) ? '<br />' . $products_options_details_noname : '') . '<br />' . zen_draw_checkbox_field('id[' . $this->mOptions[$optionsId]['products_options_id'] . '][' . $products_options_value_id . ']', $products_options_value_id, $selected_attribute, $vals['attributes_html_attrib']) . '</td>';
}
break;
case '5':
$tmp_attributes_image_row++;
if ($tmp_attributes_image_row > $this->mOptions[$optionsId]['products_options_images_per_row']) {
$tmp_attributes_image .= '</tr><tr>';
$tmp_attributes_image_row = 1;
}
if (!empty($vals['attributes_image'])) {
$tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . zen_draw_checkbox_field('id[' . $this->mOptions[$optionsId]['products_options_id'] . '][' . $products_options_value_id . ']', $products_options_value_id, $selected_attribute, $vals['attributes_html_attrib'], zen_image(DIR_WS_IMAGES . $vals['attributes_image']) . (PRODUCT_IMAGES_ATTRIBUTES_NAMES == '1' ? '<br />' . $vals['products_options_values_name'] : '')) . (!empty($products_options_details_noname) ? '<br />' . $products_options_details_noname : '') . '</td>';
} else {
$tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . zen_draw_checkbox_field('id[' . $this->mOptions[$optionsId]['products_options_id'] . '][' . $products_options_value_id . ']', $products_options_value_id, $selected_attribute, $vals['attributes_html_attrib'], $vals['products_options_values_name'] . ($products_options_details_noname != '' ? $products_options_details_noname : '')) . '</td>';
}
break;
case '0':
default:
$tmp_checkbox .= zen_draw_checkbox_field('id[' . $this->mOptions[$optionsId]['products_options_id'] . '][' . $products_options_value_id . ']', $products_options_value_id, $selected_attribute, $vals['attributes_html_attrib'], $products_options_details);
break;
}
}
// =-=-=-=-=-=-=-=-=-=-= text
if ($this->mOptions[$optionsId]['products_options_type'] == PRODUCTS_OPTIONS_TYPE_TEXT) {
if (is_object($pCart)) {
$tmp_value = $pCart->contents[$this->mProductsId]['attributes_values'][$this->mOptions[$optionsId]['products_options_id']];
$tmp_html = '<input type="text" name ="id[' . TEXT_PREFIX . $this->mOptions[$optionsId]['products_options_id'] . ']" size="' . $this->mOptions[$optionsId]['products_options_size'] . '" maxlength="' . $this->mOptions[$optionsId]['products_options_length'] . '" value="' . htmlspecialchars($tmp_value) . '" /> ';
$tmp_html .= $products_options_details;
$tmp_word_cnt_string = '';
// calculate word charges
$tmp_word_cnt = 0;
$tmp_word_cnt_string = $pCart->contents[$this->mProductsId]['attributes_values'][$this->mOptions[$optionsId]['products_options_id']];
$tmp_word_cnt = zen_get_word_count($tmp_word_cnt_string, $vals['attributes_price_words_free']);
$tmp_word_price = zen_get_word_count_price($tmp_word_cnt_string, $vals['attributes_price_words_free'], $vals['attributes_price_words']);
if ($vals['attributes_price_words'] != 0) {
$tmp_html .= TEXT_PER_WORD . $currencies->display_price($vals['attributes_price_words'], zen_get_tax_rate($this->mInfo['products_tax_class_id'])) . ($vals['attributes_price_words_free'] != 0 ? TEXT_WORDS_FREE . $vals['attributes_price_words_free'] : '');
}
if ($tmp_word_cnt != 0 and $tmp_word_price != 0) {
$tmp_word_price = $currencies->display_price($tmp_word_price, zen_get_tax_rate($this->mInfo['products_tax_class_id']));
$tmp_html = $tmp_html . '<br />' . TEXT_CHARGES_WORD . ' ' . $tmp_word_cnt . ' = ' . $tmp_word_price;
}
// calculate letter charges
$tmp_letters_cnt = 0;
$tmp_letters_cnt_string = $pCart->contents[$this->mProductsId]['attributes_values'][$this->mOptions[$optionsId]['products_options_id']];
$tmp_letters_cnt = zen_get_letters_count($tmp_letters_cnt_string, $vals['attributes_price_letters_free']);
$tmp_letters_price = zen_get_letters_count_price($tmp_letters_cnt_string, $vals['attributes_price_letters_free'], $vals['attributes_price_letters']);
if ($vals['attributes_price_letters'] != 0) {
$tmp_html .= TEXT_PER_LETTER . $currencies->display_price($vals['attributes_price_letters'], zen_get_tax_rate($this->mInfo['products_tax_class_id'])) . ($vals['attributes_price_letters_free'] != 0 ? TEXT_LETTERS_FREE . $vals['attributes_price_letters_free'] : '');
}
if ($tmp_letters_cnt != 0 and $tmp_letters_price != 0) {
$tmp_letters_price = $currencies->display_price($tmp_letters_price, zen_get_tax_rate($this->mInfo['products_tax_class_id']));
$tmp_html = $tmp_html . '<br />' . TEXT_CHARGES_LETTERS . ' ' . $tmp_letters_cnt . ' = ' . $tmp_letters_price;
}
} else {
$tmp_html = '<input class="form-control" type="text" name ="id[' . TEXT_PREFIX . $this->mOptions[$optionsId]['products_options_id'] . ']" size="' . $this->mOptions[$optionsId]['products_options_size'] . '" maxlength="' . $this->mOptions[$optionsId]['products_options_length'] . '" />';
$tmp_html .= $products_options_details;
}
}
// =-=-=-=-=-=-=-=-=-=-= file uploads
if (is_object($pCart) && $this->mOptions[$optionsId]['products_options_type'] == PRODUCTS_OPTIONS_TYPE_FILE) {
$number_of_uploads++;
$tmp_html = '<input type="file" name="id[' . TEXT_PREFIX . $this->mOptions[$optionsId]['products_options_id'] . ']" /><br />' . $pCart->contents[$this->mProductsId]['attributes_values'][$this->mOptions[$optionsId]['products_options_id']] . zen_draw_hidden_field(UPLOAD_PREFIX . $number_of_uploads, $this->mOptions[$optionsId]['products_options_id']) . zen_draw_hidden_field(TEXT_PREFIX . UPLOAD_PREFIX . $number_of_uploads, $pCart->contents[$this->mProductsId]['attributes_values'][$this->mOptions[$optionsId]['products_options_id']]);
$tmp_html .= $products_options_details;
}
// collect attribute image if it exists and to draw in table below
if ($this->mOptions[$optionsId]['products_options_images_style'] == '0' or ($this->mOptions[$optionsId]['products_options_type'] == PRODUCTS_OPTIONS_TYPE_FILE or $this->mOptions[$optionsId]['products_options_type'] == PRODUCTS_OPTIONS_TYPE_TEXT or $this->mOptions[$optionsId]['products_options_type'] == '0')) {
开发者ID:bitweaver,项目名称:commerce,代码行数:67,代码来源:CommerceProduct.php
注:本文中的zen_get_word_count_price函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论