Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Quantity Price Breaks per Customer for SPPC 4.0


aguzman

Recommended Posts

I recently installed Quantity Price Breaks per Customer and got it working fine. The only thing I would love is to remove the quantity price break table that appears on the store web pages. I'm not very good at reading code so I would need to know specifically what pages and what bit of code I need to comment out, if it is possible.

 

thanks,

 

Al :(

Link to comment
Share on other sites

The only thing I would love is to remove the quantity price break table that appears on the store web pages.
I think the simplest way to accomplish this is to copy the function getPriceStringShort (this is the last function in the class catalog/includes/classes/PriceFormatter.php) and past it right after that (the last } is not part of that function so leave that one alone!).

Then rename it to for example getPriceStringRegular and comment out the middle else block:

// was:  function getPriceStringShort() {
 function getPriceStringRegular() {

global $currencies;

if ($this->hasSpecialPrice == true) {
  $lc_text = '?<s>'
. $currencies->display_price($this->thePrice,
				 tep_get_tax_rate($this->taxClass))
. '</s>??<span class="productSpecialPrice">'
. $currencies->display_price($this->specialPrice,
				 tep_get_tax_rate($this->taxClass))
. '</span>?';
}
// comment out, it wil print $ low price-high price
/*	else {
  if($this->hasQuantityPrice == true) {
$lc_text = '?'
  . $currencies->display_price($this->lowPrice,
				   tep_get_tax_rate($this->taxClass))
  . ' - '
  . $currencies->display_price($this->hiPrice,
				   tep_get_tax_rate($this->taxClass))
  . '?';
  } */
  else {
// removed the nobreakspace before and after the price
$lc_text = $currencies->display_price($this->thePrice, tep_get_tax_rate($this->taxClass));
  }
}
return $lc_text;
 }

Then on the product_info.php page where it says (around line 79):

	$products_price=$pf->getPriceString();

you change it to:

	$products_price=$pf->getPriceStringRegular();

Haven't tried it, but I think it should work.

Link to comment
Share on other sites

Jan Z, I gave your suggestin a try but I'm getting errors

 

Parse error: parse error, unexpected '}' in /home/nespapoo/public_html/osCommerce/catalog/includes/classes/PriceFormatter.php on line 436

 

Here is the PriceFormatter.php file starting at line 373

function getPriceStringShort() {
global $currencies;

if ($this->hasSpecialPrice == true) {
  $lc_text = ' <s>'
. $currencies->display_price($this->thePrice,
				 tep_get_tax_rate($this->taxClass))
. '</s>  <span class="productSpecialPrice">'
. $currencies->display_price($this->specialPrice,
				 tep_get_tax_rate($this->taxClass))
. '</span> ';
}
else {
  if($this->hasQuantityPrice == true) {
$lc_text = ' '
  . $currencies->display_price($this->lowPrice,
				   tep_get_tax_rate($this->taxClass))
  . ' - '
  . $currencies->display_price($this->hiPrice,
				   tep_get_tax_rate($this->taxClass))
  . ' ';
  }
  else {
$lc_text = ' '
  . $currencies->display_price($this->thePrice,
				   tep_get_tax_rate($this->taxClass))
  . ' ';
  }
}
return $lc_text;
 }
}  
 //function getPriceStringShort() {
function getPriceStringRegular() {
global $currencies;

if ($this->hasSpecialPrice == true) {
  $lc_text = ' <s>'
. $currencies->display_price($this->thePrice,
				 tep_get_tax_rate($this->taxClass))
. '</s>  <span class="productSpecialPrice">'
. $currencies->display_price($this->specialPrice,
				 tep_get_tax_rate($this->taxClass))
. '</span> ';
}
/*   else {
  if($this->hasQuantityPrice == true) {
$lc_text = ' '
  . $currencies->display_price($this->lowPrice,
				   tep_get_tax_rate($this->taxClass))
  . ' - '
  . $currencies->display_price($this->hiPrice,
				   tep_get_tax_rate($this->taxClass))
  . ' ';
  } */
  else {
$lc_text = ' '
  . $currencies->display_price($this->thePrice,
				   tep_get_tax_rate($this->taxClass))
  . ' ';
  }
}
return $lc_text;
 }



?>

 

What could be the problem. I think it might have someting to do with the closing } but not sure.

Link to comment
Share on other sites

I'm getting errors

Parse error: parse error, unexpected '}' in /home/nespapoo/public_html/osCommerce/catalog/includes/classes/PriceFormatter.php on line 436

What could be the problem. I think it might have someting to do with the closing } but not sure.

Yes, getting the }'s on the right spot is crucial. I think the bottom part should look like this:

/*?? else {
??????if($this->hasQuantityPrice == true) {
????$lc_text = '?'
??????. $currencies->display_price($this->lowPrice,
?????????????????????? tep_get_tax_rate($this->taxClass))
??????. ' - '
??????. $currencies->display_price($this->hiPrice,
?????????????????????? tep_get_tax_rate($this->taxClass))
??????. '?';
??????} */
??????else {
????$lc_text = '?'
??????. $currencies->display_price($this->thePrice,
?????????????????????? tep_get_tax_rate($this->taxClass))
??????. '?';
??????}?
????return $lc_text;
??} // end function
}
?>

Link to comment
Share on other sites

Jan, that is not working either. Here is the file PriceFormatter.php file the way it was before the changes suggested whree I think the table is coded in.

 

The contribution is working but I just do not want the price break table showing on the products page.

 

thanks for all your help, if you can please take another look for me and see how I can hide the price break table on the products page.

 

 

/function getPriceString($style='productPriceInBox') {
global $currencies;

if ($this->hasSpecialPrice == true) {
	$lc_text = '<table align="top" border="1" cellspacing="0" cellpadding="0">';
	$lc_text .= '<tr><td align="center" class=' . $style. ' colspan="2">';
	  $lc_text .= ' <s>'
	. $currencies->display_price($this->thePrice,
				 tep_get_tax_rate($this->taxClass))
	. '</s>  <span class="productSpecialPrice">'
	. $currencies->display_price($this->specialPrice,
				 tep_get_tax_rate($this->taxClass))
	. '</span> '
	.'</td></tr>';
}
else
{
	$lc_text = '<table align="top" border="1" cellspacing="0" cellpadding="0">';
	$lc_text .= '<tr><td align="center" class=' . $style. ' colspan="2">'
	. $currencies->display_price($this->thePrice,
	tep_get_tax_rate($this->taxClass))
	. '</td></tr>';
}
  // If you want to change the format of the price/quantity table
  // displayed on the product information page, here is where you do it.

if($this->hasQuantityPrice == true) {
	for($i=1; $i<=8; $i++) {
		if($this->quantity[$i] > 0) {
			$lc_text .= '<tr><td class='.$style.'>'
			. $this->quantity[$i]
			.'+ </td><td class='.$style.'>'
			. $currencies->display_price($this->price[$i],
			tep_get_tax_rate($this->taxClass))
			.'</td></tr>';
		}
	}

	$lc_text .= '</table>';

  }
  else {
	if ($this->hasSpecialPrice == true) {
		$lc_text = ' <s>'
		  . $currencies->display_price($this->thePrice, tep_get_tax_rate($this->taxClass))
		  . '</s>  <span class="productSpecialPrice">'
		  . $currencies->display_price($this->specialPrice, tep_get_tax_rate($this->taxClass))
		  . '</span> ';
	}
	else {
		$lc_text = ' '
		  . $currencies->display_price($this->thePrice,
				   tep_get_tax_rate($this->taxClass))
		  . ' ';
	}
	  }

return $lc_text;
 }

 function getPriceStringShort() {
global $currencies;

if ($this->hasSpecialPrice == true) {
  $lc_text = ' <s>'
. $currencies->display_price($this->thePrice,
				 tep_get_tax_rate($this->taxClass))
. '</s>  <span class="productSpecialPrice">'
. $currencies->display_price($this->specialPrice,
				 tep_get_tax_rate($this->taxClass))
. '</span> ';
}
else {
  if($this->hasQuantityPrice == true) {
$lc_text = ' '
  . $currencies->display_price($this->lowPrice,
				   tep_get_tax_rate($this->taxClass))
  . ' - '
  . $currencies->display_price($this->hiPrice,
				   tep_get_tax_rate($this->taxClass))
  . ' ';
  }
  else {
$lc_text = ' '
  . $currencies->display_price($this->thePrice,
				   tep_get_tax_rate($this->taxClass))
  . ' ';
  }
}
return $lc_text;
 }
}  



?>

Edited by aguzman
Link to comment
Share on other sites

Jan, with a little trial and error I figured out how to hide the price break table.

 

Here is what I did starting out at the function getPriceString in file PriceFormatter.php. I commented out a chunck of code and now the table is GONE! and it still computes correctly for my price breaks.

 

 

function getPriceString($style='productPriceInBox') {
global $currencies;

/* if ($this->hasSpecialPrice == true) {
	$lc_text = '<table align="top" border="1" cellspacing="0" cellpadding="0">';
	$lc_text .= '<tr><td align="center" class=' . $style. ' colspan="2">';
	  $lc_text .= ' <s>'
	. $currencies->display_price($this->thePrice,
				 tep_get_tax_rate($this->taxClass))
	. '</s>  <span class="productSpecialPrice">'
	. $currencies->display_price($this->specialPrice,
				 tep_get_tax_rate($this->taxClass))
	. '</span> '
	.'</td></tr>'; 
}
else
{
	 $lc_text = '<table align="top" border="1" cellspacing="0" cellpadding="0">';
	$lc_text .= '<tr><td align="center" class=' . $style. ' colspan="2">'
	. $currencies->display_price($this->thePrice,
	tep_get_tax_rate($this->taxClass))
	. '</td></tr>'; 
} 
  // If you want to change the format of the price/quantity table
  // displayed on the product information page, here is where you do it.

if($this->hasQuantityPrice == true) {
	for($i=1; $i<=8; $i++) {
		if($this->quantity[$i] > 0) {
			$lc_text .= '<tr><td class='.$style.'>'
			. $this->quantity[$i]
			.'+ </td><td class='.$style.'>'
			. $currencies->display_price($this->price[$i],
			tep_get_tax_rate($this->taxClass))
			.'</td></tr>';
		}
	}

	$lc_text .= '</table>';

 } */
  //else {
	if ($this->hasSpecialPrice == true) {
		$lc_text = ' <s>'
		  . $currencies->display_price($this->thePrice, tep_get_tax_rate($this->taxClass))
		  . '</s>  <span class="productSpecialPrice">'
		  . $currencies->display_price($this->specialPrice, tep_get_tax_rate($this->taxClass))
		  . '</span> ';
	}
	else {
		$lc_text = ' '
		  . $currencies->display_price($this->thePrice,
				   tep_get_tax_rate($this->taxClass))
		  . ' ';
	}
	  //}

return $lc_text;
 }

 function getPriceStringShort() {
global $currencies;

if ($this->hasSpecialPrice == true) {
  $lc_text = ' <s>'
. $currencies->display_price($this->thePrice,
				 tep_get_tax_rate($this->taxClass))
. '</s>  <span class="productSpecialPrice">'
. $currencies->display_price($this->specialPrice,
				 tep_get_tax_rate($this->taxClass))
. '</span> ';
}
else {
  if($this->hasQuantityPrice == true) {
$lc_text = ' '
  . $currencies->display_price($this->lowPrice,
				   tep_get_tax_rate($this->taxClass))
  . ' - '
  . $currencies->display_price($this->hiPrice,
				   tep_get_tax_rate($this->taxClass))
  . ' ';
  }
  else {
$lc_text = ' '
  . $currencies->display_price($this->thePrice,
				   tep_get_tax_rate($this->taxClass))
  . ' ';
  }
}
return $lc_text;
 }
}  



?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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...