Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product Attributes - Remove Price


Guest

Recommended Posts

Hello!

 

If this question has already been answered, I'm sorry in advance for lacking the patience in finding an answer.

 

I'm looking to stop the product attributes from adding the price of the individual attribute to the price of the product it's under.

 

It is confusing to have each attribute show a total for the attribute plus the product when there are multiple attributes.

 

e.g.

 

Product: T-Shirt $10

 

Color: White ($12.00) <-- $2 additional cost + $10 product

Size: L ($15.00) <-- $5 additional cost + $10 product

 

I'm sure it's posibble (and presumably easy) to have the following:

 

Product: T-Shirt $10

 

Color: White ($2)

Size: L ($5)

 

Any help with this will be very appreciated.

 

Thanks!

Link to comment
Share on other sites

I thought I would add the part of the products_info.php code that appears to be what I need to modify. Considering I'm not a PHP coder I'm not really sure what variables to change here, I've done some trial and error but so far have been unable to get the results I need.

 

<?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 ($products_options['price_prefix'] == '+')
		$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $currencies->display_price((float)($new_price?$new_price:$product_info['products_price']) + (float)$products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
	  elseif ($products_options['price_prefix'] == '-')
		$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $currencies->display_price((float)($new_price?$new_price:$product_info['products_price']) - (float)$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;
	}
?>

Link to comment
Share on other sites

Trial and error paid off.

 

Not sure if the code changes I made meet any standards or anything, but the results are what I was looking for.

 

In case anyone has a similar issue I've copied the code changes below

 

Original

			  if ($products_options['price_prefix'] == '+')
		$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $currencies->display_price((float)($new_price?$new_price:$product_info['products_price']) + (float)$products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';

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

 

Modified to

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

 

Gives me the result I was looking for. The prices for the product attributes now show the attribute price only without adding the products price together.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...