Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

error in "Available Options" in product attributes


Face

Recommended Posts

Posted

I'm getting the following error when I try to set attributes that require a dollar amount:

 

capture9tp.jpg

 

Attributes that do not affect the price are ok, just the specific ones in the example. Does anyone know what is causing this?

 

This is from my product_info.php file, starting at line 76:

 

<?php

} else {

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

$product_info = tep_db_fetch_array($product_info_query);

 

tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

count_store_products_viewed((int)$HTTP_GET_VARS['products_id']);

 

if ($new_price = tep_get_products_special_price($product_info['products_id'])) {

$products_price = '<s class=ch3 style="color:#777777; font-size:10px">' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s>?<span class=ch4 style="color:#889C48" >' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

} else {

$products_price = '<span class=ch3>'. $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .'</span>';

}

 

if (tep_not_null($product_info['products_model'])) {

$products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';

} else {

$products_name = $product_info['products_name'];

}

?>

<table cellspacing=0 cellpadding=0><tr><td>

<table cellspacing=0 cellpadding=0>

 

<tr><td class=bg3>

<table cellspacing=0 cellpadding=0>

<tr><td height=20 colspan=2></td></tr>

<tr><td width=265 align=center valign=middle>

 

Help! :'(

Posted
I'm getting the following error when I try to set attributes that require a dollar amount:

 

capture9tp.jpg

 

Attributes that do not affect the price are ok, just the specific ones in the example. Does anyone know what is causing this?

 

This is from my product_info.php file, starting at line 76:

Help! :'(

 

Entire file - someone help!

 

 

<?php

/*

$Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);

 

$product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

$product_check = tep_db_fetch_array($product_check_query);

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title>european auto source - 714.369.8524 | how fast can we make your dream go,

stop and corner?</title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

<script language="javascript"><!--

function popupWindow(url) {

window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res

izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le

ft=150')

}

//--></script>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<!-- body_text //-->

<td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?>

 

<table cellspacing=0 cellpadding=0>

<tr><td width=533 height=35 bgcolor=#3F3F3F class=ch4>     PRODUCT NAME</td></tr>

</table>

 

 

 

 

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<?php

if ($product_check['total'] < 1) {

?>

 

<tr>

<td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<?php

} else {

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

$product_info = tep_db_fetch_array($product_info_query);

 

tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

count_store_products_viewed((int)$HTTP_GET_VARS['products_id']);

 

if ($new_price = tep_get_products_special_price($product_info['products_id'])) {

$products_price = '<s class=ch3 style="color:#777777; font-size:10px">' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class=ch4 style="color:#889C48" >' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

} else {

$products_price = '<span class=ch3>'.$currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])).'</span>';

}

 

if (tep_not_null($product_info['products_model'])) {

$products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';

} else {

$products_name = $product_info['products_name'];

}

?>

<table cellspacing=0 cellpadding=0><tr><td>

<table cellspacing=0 cellpadding=0>

 

<tr><td class=bg3>

<table cellspacing=0 cellpadding=0>

<tr><td height=20 colspan=2></td></tr>

<tr><td width=265 align=center valign=middle>

 

 

 

 

 

 

 

<!-- display image -->

<?php

if (tep_not_null($product_info['products_image'])) {

?>

<table cellspacing="0" cellpadding="2" align="center">

<tr>

<td align="center" class="smallText">

<script language="javascript"><!--

document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), '220', '', ' hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

//--></script>

<noscript>

<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, ' hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>

</noscript>

</td>

</tr>

</table>

<?php

}

?>

<!--end display image -->

 

</td>

 

 

 

 

<td width=266 valign=top>

<table cellspacing=0 cellpadding=0>

<tr><td class=ml2 colspan=2><?=$products_name?></td></tr>

<tr><td height=20 colspan=2></td></tr>

<tr><td class=tx colspan=2><b>Item # :</b> <?= $products_id; ?></td></tr>

<tr><td class=tx height=1 colspan=2></td></tr>

<tr><td height=11 colspan=2></td></tr>

<tr><td class=tx width=232>

 

<?

if ($product_info['products_date_available'] > date('Y-m-d H:i:s'))

echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available']));

else

echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added']));

?>

 

</td><td width=34></td></tr>

<tr><td height=7 colspan=2></td></tr>

<tr><td><span class=ml2>Item Price:</span>  <span class=ch3><?php echo $products_price; ?></span></td></tr>

<tr><td height=10 colspan=2></td></tr>

<tr><td colspan=2><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_BUY_NOW); ?></td></tr>

<tr><td height=20 colspan=2></td></tr>

</table>

</td></tr>

<tr><td colspan=2 align=center><img src=images/m27.gif width=528 height=1></td></tr>

</table>

<table cellspacing=0 cellpadding=0 width=500 align=center>

<tr><td height=15></td></tr>

<tr><td class=ml2>Item Description</td></tr>

<tr><td height=20></td></tr>

<tr><td class=tx><?php echo stripslashes($product_info['products_description']); ?><br><br>

</td></tr>

<tr><td height=20></td></tr>

</table>

</td></tr>

<tr><td><img src=images/m39.gif width=533 height=10></td></tr>

</td></tr>

</table>

 

 

 

 

 

 

<!----------------------- Not editable part -------------------------------->

 

<tr><td>

 

<?php

$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");

$products_attributes = tep_db_fetch_array($products_attributes_query);

if ($products_attributes['total'] > 0) {

?>

<table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>

</tr>

<?php

$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");

while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {

$products_options_array = array();

$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");

while ($products_options = tep_db_fetch_array($products_options_query)) {

$products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);

if ($products_options['options_values_price'] != '0') {

$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';

}

}

 

if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {

$selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];

} else {

$selected_attribute = false;

}

?>

<tr>

<td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>

<td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>

</tr>

<?php

}

?>

</table>

<?php

}

?>

</td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");

$reviews = tep_db_fetch_array($reviews_query);

if ($reviews['count'] > 0) {

?>

<tr>

<td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

}

 

if (tep_not_null($product_info['products_url'])) {

?>

<tr>

<td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

}

 

?>

<!--

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>

<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

-->

<tr>

<td>

<?php

/*

if ((USE_CACHE == 'true') && empty($SID)) {

echo tep_cache_also_purchased(3600);

} else {

include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);

}

*/

}

?>

 

 

</td></tr>

 

</table>

</form></td>

<!-- body_text_eof //-->

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Posted

you should check the attributes in your osc admin panel. catalog->Products Attributes. Check if the html is included with the price or something like that.

Posted
you should check the attributes in your osc admin panel. catalog->Products Attributes. Check if the html is included with the price or something like that.

 

The weird part is that everything functions as normal and the attribute is added to the cart and modifies the price correctly. Just the drop down list has the HTML code in it.

 

No HTML is in the pricing, I get this behavior only when a dollar amount is added to the attribute, colors (referring to product) or other factors do not matter.

 

Here's an example of the shopping cart with the attribute added:

 

capture2hy.jpg

Posted

why are you looking at the catalog end. The html is probably in the database if it is inserted from the attributes. Look with your osc Admin the attributes.

Posted
why are you looking at the catalog end. The html is probably in the database if it is inserted from the attributes. Look with your osc Admin the attributes.

 

here is a snapshot of the attribute from the Admin side, no HTML is entered:

 

 

capture7xc.jpg

Posted

well this is the code that sets the pull down menu

 

<td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>

 

there is nothing special about it because the $products_options_array is built from the database. The fact that you do not see it on the attribute listing does not mean it's not in the database. So to be sure use the phpmyadmin go to products_options_values table and click browse. Check the products_options_values_name column. If the html is not there you should see simply black.

Posted
well this is the code that sets the pull down menu

 

<td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>

 

there is nothing special about it because the $products_options_array is built from the database. The fact that you do not see it on the attribute listing does not mean it's not in the database. So to be sure use the phpmyadmin go to products_options_values table and click browse. Check the products_options_values_name column. If the html is not there you should see simply black.

 

First off - thank you for taking the time to help, it's greatly appreciated! Here are a couple of screenshots of what you requested:

 

capture0up.jpg

 

 

capture0yw.jpg

 

If you can figure this one out, let me know what I can do to make it up to you! :thumbsup:

Posted

then it must come from a function from the catalog somewhere.

 

comment out this line of the file you posted

 

$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';

 

I think it should come up without the html. Then find this display_price routine and should be in the catalog\includes\classes\currencies.php see if the html is inserted there.

Posted

Commented out (using the // command) in product_info.php like you said, nothing changed.

 

Here is a copy of my includes/classes/currencies.php file:

 

<?php
/*
 $Id: currencies.php,v 1.16 2003/06/05 23:16:46 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

////
// Class to handle currencies
// TABLES: currencies
 class currencies {
var $currencies;

// class constructor
function currencies() {
  $this->currencies = array();
  $currencies_query = tep_db_query("select code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from " . TABLE_CURRENCIES);
  while ($currencies = tep_db_fetch_array($currencies_query)) {
	$this->currencies[$currencies['code']] = array('title' => $currencies['title'],
												   'symbol_left' => $currencies['symbol_left'],
												   'symbol_right' => $currencies['symbol_right'],
												   'decimal_point' => $currencies['decimal_point'],
												   'thousands_point' => $currencies['thousands_point'],
												   'decimal_places' => $currencies['decimal_places'],
												   'value' => $currencies['value']);
  }
}

// class methods
function format($number, $calculate_currency_value = true, $currency_type = '', $currency_value = '') {
  global $currency;

  if (empty($currency_type)) $currency_type = $currency;

  if ($calculate_currency_value == true) {
	$rate = (tep_not_null($currency_value)) ? $currency_value : $this->currencies[$currency_type]['value'];
	$format_string = '<span class=currency_symbol>'.$this->currencies[$currency_type]['symbol_left'] .'</span>'. number_format(tep_round($number * $rate, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . '<span class=currency_symbol>'.$this->currencies[$currency_type]['symbol_right'].'</span>';
// if the selected currency is in the european euro-conversion and the default currency is euro,
// the currency will displayed in the national currency and euro currency
	if ( (DEFAULT_CURRENCY == 'EUR') && ($currency_type == 'DEM' || $currency_type == 'BEF' || $currency_type == 'LUF' || $currency_type == 'ESP' || $currency_type == 'FRF' || $currency_type == 'IEP' || $currency_type == 'ITL' || $currency_type == 'NLG' || $currency_type == 'ATS' || $currency_type == 'PTE' || $currency_type == 'FIM' || $currency_type == 'GRD') ) {
	  $format_string .= ' <small>[' . $this->format($number, true, 'EUR') . ']</small>';
	}
  } else {
	$format_string = '<span class=currency_symbol>'.$this->currencies[$currency_type]['symbol_left'].'</span>' . number_format(tep_round($number, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . '<span class=currency_symbol>'.$this->currencies[$currency_type]['symbol_right'].'</span>';
  }

  return $format_string;
}

function is_set($code) {
  if (isset($this->currencies[$code]) && tep_not_null($this->currencies[$code])) {
	return true;
  } else {
	return false;
  }
}

function get_value($code) {
  return $this->currencies[$code]['value'];
}

function get_decimal_places($code) {
  return $this->currencies[$code]['decimal_places'];
}

function display_price($products_price, $products_tax, $quantity = 1) {
  return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
}
 }
?>

Posted

must be called indirectly The currencies.php has that code with the span class

 

$format_string = '<span class=currency_symbol>'.$this->currencies[$currency_type]['symbol_left'] .'</span>'. number_format(tep_round($number * $rate, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . '<span class=currency_symbol>'.$this->currencies[$currency_type]['symbol_right'].'</span>';

 

The problem is if you change this will change the price format on other places.

Posted
must be called indirectly The currencies.php has that code with the span class

 

$format_string = '<span class=currency_symbol>'.$this->currencies[$currency_type]['symbol_left'] .'</span>'. number_format(tep_round($number * $rate, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . '<span class=currency_symbol>'.$this->currencies[$currency_type]['symbol_right'].'</span>';

 

The problem is if you change this will change the price format on other places.

 

Are you recommending I replace the text that was commented out in post #9 with this text (seems to be from the currencies.php file), if so - I tried this and it removes the attribute pricing completely, but the option value attribute "black" is still present:

 

capture8qn.jpg

Posted

Post-9 was to see if the problem was coming from the currency class and it did. You put back the code there because you need to show the attribute price right? (if not you're done).

 

And then somehow I believe you need to create a couple of extra functions in the currency class to use the original code of the osc.

 

So lets say you have display_price2 and format2 member functions in the class which are basically the original ones. (from the original osc currencies.php) Then instead of calling the display_price you call display_price2 specifically for the attributes. That should do it at least on the products info page.

Posted

The standard code for line 49 of currencies.php is:

 

		$format_string = $this->currencies[$currency_type]['symbol_left'] . 
number_format(tep_round($number, $this->currencies[$currency_type]['decimal_places']),
$this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], 
$this->currencies[$currency_type]['thousands_point']) . 
$this->currencies[$currency_type]['symbol_right'];

 

The problem is that code in tep_draw_pulldown_menu replaces characters such as < and > in the menu text with the HTML special character equivalent. That means that any HTML in a pulldown list value is output verbatim.

 

I note that the standard OSC has a bug for European currencies where it adds <small> around the currency, which will have the same problem. This code in currencies.php is ok for most of the places it is used, but not this one. I'd expect this to have been noticed years ago.

 

Now, how to solve this? I suppose you could create a second version of tep_draw_pulldown_menu, specifically for this use, that doesn't do the character substitution, and then change the call in product_info.php to call the new routine. That's probably how I'd handle it.

Posted

Just to follow up - it seems enigma1 got into there and had the problem solved right away! :thumbsup:

  • 8 months later...
Posted
Yes, that's a good solution too.

 

Don't people with European currencies see this problem?

 

For anyone else's information.... I too was having the <span> html code issue where the html is displayed in any attribute field that had anything to do with currency. I'm using the GBP pound sign '£'.

 

My fix was simple.

 

in catalog/includes/classes/currencies.php

 

I found the 2 identical lines that start like this (around about lines 42 and 49 for me);

$format_string = '<span class=currency_symbol>'.$this->currencies......

 

Commented them out with the usual // and inserted the following script after each line;

$format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(tep_round($number, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];

 

THAT'S IT! This worked for me but please remember to BACKUP YOUR FILES before making any changes.

 

Cheers. :lol:

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...