Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

I don't know if anyone else wanted to remove the prices in the dropdown menus on "build.php" that have displayed strangely for me ( I.e. the price difference "+ 1.243000000" that shows next to some of the dropdown choices). I didn't want the price differences to display at all, preferring the total to reflect the price changes.

 

After much searching and testing here's the mod (I've not found any errors in my tests):

 

Step 1:

 

At about line 99 in includes/functions/custom_computer.php, find and comment out the following:

 

		/*
	if ($values[$i]['price_diff'] == '0.00' || $values[$i]['price'] == '0.00'){
		$new_price = '';
	}else{
	$price_fix = explode('-', $values[$i]['price_diff']); 
	if ($price_fix[0] != '' || $price_fix[0] == '-'){
		$new_price = '+' . $values[$i]['price_diff'];
	}else{
		$new_price = '-' . $price_fix[1];
	}			
	} 
	*/

 

Step 2:

 

At about line 54 in catalog/java.php, find and comment out the following:

 

// The following is commented out to remove the price difference that would display after a product name in the dropdown.  I.e.: "Product Name" + 2.8000085550
/*
echo "if (document.getElementById(box_name).options[count].getAttribute('price') > 0){\n";
echo "var keep = document.getElementById(box_name).options[count].innerHTML\n";
echo "var keep_change = new String(keep)\n";
echo "var keep_array = keep_change.replace('undefined', '')\n";
echo "var keep_array = keep_array.split(' +')\n";
echo "var keep_array_fix = keep_array[0].split(' -')\n";
echo "var price_check = get_price(box_name, document.getElementById(box_name).options[document.getElementById(box_name).options.selectedIndex].getAttribute('price'), count)\n";
echo "if (price_check > 0){\n";
echo "var price_diff = ' + '\n";
echo "var price_check = price_check\n"; 
if (DISPLAY_PRICE_WITH_TAX == 'true'){
echo "var product_tax = eval(price_check * ".$tax_rate." / 100)\n";
echo "var newprice = (price_check + product_tax)\n";
echo "var price_check = custRound(newprice)\n";
}
echo "}\n"; 
echo "if (price_check == 0){\n";
echo "var price_diff = ''\n";
echo "var price_check = ''\n";
echo "}\n";
echo "if (price_check < 0){\n";
echo "var price_diff = ' - '\n";
echo "var price_check = new String(price_check)\n";
echo "var price_check_fix = price_check.replace('-', '')\n";
echo "var price_check = custRound(price_check_fix)\n";
if (DISPLAY_PRICE_WITH_TAX == 'true'){
echo "var product_tax = eval(price_check_fix * ".$tax_rate." / 100)\n";
echo "var newprice = (parseFloat(price_check_fix) + product_tax)\n";
echo "var price_check = custRound(newprice)\n";
} 
echo "}\n"; 
echo "document.getElementById(box_name).options[count].innerHTML = ''\n";
echo "document.getElementById(box_name).options[count].innerHTML = keep_array_fix[0] + price_diff + ' ' + price_check\n";
echo "}\n"; 
*/

 

I haven't spent the time to find a way to round the long price differences. I.e. "- 1.3560000" to "- 1.35".

Perhaps there is someone who has done this?

 

Comments on any of this are welcomed.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...