Jump to content
Sign in to follow this  
homewetbar

Simple Price Break Contribution

Recommended Posts

Ok, now we've been using this contribution on our site for quite some time, without any problems. Great tool!

But now a question raises...

We would like to exclude one specific customer from the pricebreaks.

We use this particular account for cash orders, placed outside the webshop.

 

Is this possible, without much alteration?

 

Marcel

 

I would suggest you don't do it, you're going to piss off that customer if he finds out....


Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Share this post


Link to post
Share on other sites
I would suggest you don't do it, you're going to piss off that customer if he finds out....

 

Now this would be the case when that specific customer would be a live person.

It's just that we created a virtual customer for certain purposes. We want to exclude this specific virtual customer from the pricebreaks.

Share this post


Link to post
Share on other sites
Now this would be the case when that specific customer would be a live person.

It's just that we created a virtual customer for certain purposes. We want to exclude this specific virtual customer from the pricebreaks.

 

I'm not quite sure how you would do it.

 

But you might try using some if statements everywhere the contrib is installed. For instance

if (customer_id == 123) {

} else{

run simple price break

}

 

However if they are on the site as a guest and logged in this will not work...


Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Share this post


Link to post
Share on other sites
awesome contrib, works perfectly.

 

However, I'd like to have the information for the price breaks show up at the very top of my product listing. Any idea on how to do that?

 

See it in action here http://www.electronicsandmore.ca/catalog/c...eiver-p-78.html

 

 

Play around with the placement of the code for this contrib in your product_info.php until you find a place you like.


Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Share this post


Link to post
Share on other sites

ok, so I've added a second bit of code to put the quantity discounts at the top of the products page... however, if a product does not have quantity discounts specified, the entire product description disappears...

 

any ideas?

 

here's my code. First the specific section which I added it, and then the entire page...

 

I added this part directly beneath the $products_name echo statement...

 

<?php 
}
// Simple Price Break ABOVE DESCRIPTION
if (tep_not_null($product_info['products_discount'])) {
  if( isset($product_info['products_discount']) && strlen($product_info['products_discount'])>2 ) {
	$first = true;
	$last = false;
	$tab_aff = array();
	echo '<tr><td><table><tr><td>';
	$info_box_contents = array();
	$info_box_contents[] = array('text' => '<span class="productSpecialPrice"><font color="#FF0000">' . TEXT_HEAD_REDUC_QTY . '</span>' );
	if( $tranche = explode( ',', $product_info['products_discount'] ) ) {
	  $index = 0;
	  foreach( $tranche as $cle => $trn )
		if( $qty_px = explode( ':', $trn ) ) {
		  $tab_aff[$index][0] = $qty_px[0];
		  $tab_aff[$index][1] = $qty_px[1];
		  $index++;
		}
	  $new_price = tep_get_products_special_price($product_info['products_id']);
	  for( $i=0; $i<$index; $i++) {
		if( $new_price > $tab_aff[$i][1] || $new_price==0 ) $products_price = $currencies->display_price($tab_aff[$i][1], tep_get_tax_rate($product_info['products_tax_class_id']));
		else $products_price = '<s>' . $currencies->display_price($tab_aff[$i][1], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

		if( $i==0 ) {
		  if ( $new_price )	$products_price_1 = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
		  else $products_price_1 = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
		  $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX_FIRST, $tab_aff[$i][0]-1 ) . '</td><td class="boxText">' . $products_price_1  );
		  if( isset($tab_aff[$i+1][0]) ) $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX, $tab_aff[$i][0], $tab_aff[$i+1][0]-1 ) . '</td><td class="boxText">' . $products_price );
		  else $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX_LAST, $tab_aff[$i][0] ) . '</td><td class="boxText">' . $products_price );
		}  
		elseif ( $i == ($index-1) ) $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX_LAST, $tab_aff[$i][0] ) . '</td><td class="boxText">' . $products_price );
		else $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX, $tab_aff[$i][0], $tab_aff[$i+1][0]-1 ) . '</td><td class="boxText">' . $products_price  );
	  }	
	}
	new infoBox($info_box_contents);
	echo '</td></tr></table></td></tr>';
  }
?>
   </td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>

<!-- Simple Price Break -->

 

 

<?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 (c) 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 XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<?php 
# cDynamic Meta Tags
/*<title><?php echo TITLE; ?>*/
require(DIR_WS_INCLUDES . 'meta_tags.php');
#
?>
<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="701" cellspacing="0" cellpadding="0">
 <tr>
<td rowspan="2" width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="0">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top" style="padding:0px 2px; "><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><div class="header"><?php echo HEADING_TITLE; ?></div></td>
	 </tr>
	</table></td>
  </tr>
<tr>
	<td height="362" valign="top" bgcolor="#FFFFFF"><table border="0" width="100%" cellspacing="3" cellpadding="0" >
<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 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 ($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 {
// Simple Price Break edited below
$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, p.products_discount 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 . "'");

if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
  $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
} else {
  $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
}

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'];
}
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading" valign="top"><?php echo $products_name; ?></td>
		<td>
<?php 
}
// Simple Price Break ABOVE DESCRIPTION
if (tep_not_null($product_info['products_discount'])) {
  if( isset($product_info['products_discount']) && strlen($product_info['products_discount'])>2 ) {
	$first = true;
	$last = false;
	$tab_aff = array();
	echo '<tr><td><table><tr><td>';
	$info_box_contents = array();
	$info_box_contents[] = array('text' => '<span class="productSpecialPrice"><font color="#FF0000">' . TEXT_HEAD_REDUC_QTY . '</span>' );
	if( $tranche = explode( ',', $product_info['products_discount'] ) ) {
	  $index = 0;
	  foreach( $tranche as $cle => $trn )
		if( $qty_px = explode( ':', $trn ) ) {
		  $tab_aff[$index][0] = $qty_px[0];
		  $tab_aff[$index][1] = $qty_px[1];
		  $index++;
		}
	  $new_price = tep_get_products_special_price($product_info['products_id']);
	  for( $i=0; $i<$index; $i++) {
		if( $new_price > $tab_aff[$i][1] || $new_price==0 ) $products_price = $currencies->display_price($tab_aff[$i][1], tep_get_tax_rate($product_info['products_tax_class_id']));
		else $products_price = '<s>' . $currencies->display_price($tab_aff[$i][1], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

		if( $i==0 ) {
		  if ( $new_price )	$products_price_1 = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
		  else $products_price_1 = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
		  $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX_FIRST, $tab_aff[$i][0]-1 ) . '</td><td class="boxText">' . $products_price_1  );
		  if( isset($tab_aff[$i+1][0]) ) $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX, $tab_aff[$i][0], $tab_aff[$i+1][0]-1 ) . '</td><td class="boxText">' . $products_price );
		  else $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX_LAST, $tab_aff[$i][0] ) . '</td><td class="boxText">' . $products_price );
		}  
		elseif ( $i == ($index-1) ) $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX_LAST, $tab_aff[$i][0] ) . '</td><td class="boxText">' . $products_price );
		else $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX, $tab_aff[$i][0], $tab_aff[$i+1][0]-1 ) . '</td><td class="boxText">' . $products_price  );
	  }	
	}
	new infoBox($info_box_contents);
	echo '</td></tr></table></td></tr>';
  }
?>
   </td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>

<!-- Simple Price Break -->
		<td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td class="main">
<?php
if (tep_not_null($product_info['products_image'])) {
?>
	  <table border="0" cellspacing="0" cellpadding="2" align="right">
		<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']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, '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
}
?>
	  <p><?php echo stripslashes($product_info['products_description']); ?></p>
<?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
}

// Simple Price Break BELOW DESCRIPTION
if (tep_not_null($product_info['products_discount'])) {
  if( isset($product_info['products_discount']) && strlen($product_info['products_discount'])>2 ) {
	$first = true;
	$last = false;
	$tab_aff = array();
	echo '<tr><td><table><tr><td>';
	$info_box_contents = array();
	$info_box_contents[] = array('text' => '<span class="productSpecialPrice"><font color="#FF0000">' . TEXT_HEAD_REDUC_QTY . '</span>' );
	if( $tranche = explode( ',', $product_info['products_discount'] ) ) {
	  $index = 0;
	  foreach( $tranche as $cle => $trn )
		if( $qty_px = explode( ':', $trn ) ) {
		  $tab_aff[$index][0] = $qty_px[0];
		  $tab_aff[$index][1] = $qty_px[1];
		  $index++;
		}
	  $new_price = tep_get_products_special_price($product_info['products_id']);
	  for( $i=0; $i<$index; $i++) {
		if( $new_price > $tab_aff[$i][1] || $new_price==0 ) $products_price = $currencies->display_price($tab_aff[$i][1], tep_get_tax_rate($product_info['products_tax_class_id']));
		else $products_price = '<s>' . $currencies->display_price($tab_aff[$i][1], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

		if( $i==0 ) {
		  if ( $new_price )	$products_price_1 = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
		  else $products_price_1 = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
		  $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX_FIRST, $tab_aff[$i][0]-1 ) . '</td><td class="boxText">' . $products_price_1  );
		  if( isset($tab_aff[$i+1][0]) ) $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX, $tab_aff[$i][0], $tab_aff[$i+1][0]-1 ) . '</td><td class="boxText">' . $products_price );
		  else $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX_LAST, $tab_aff[$i][0] ) . '</td><td class="boxText">' . $products_price );
		}  
		elseif ( $i == ($index-1) ) $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX_LAST, $tab_aff[$i][0] ) . '</td><td class="boxText">' . $products_price );
		else $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX, $tab_aff[$i][0], $tab_aff[$i+1][0]-1 ) . '</td><td class="boxText">' . $products_price  );
	  }	
	}
	new infoBox($info_box_contents);
	echo '</td></tr></table></td></tr>';
  }
?>
   </td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
}
// Simple Price Break
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
}

if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
  <tr>
	<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>
  </tr>
<?php
} else {
?>
  <tr>
	<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>
  </tr>
<?php
}
?>
  <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 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></td></tr>
</table></form></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="0">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
 </tr>
 <tr>
	  <td colspan="2" height="68" width="100%" align="center" style="padding:2px 0px 0px 2px; ">
		<table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#FFFFFF" height="68">
			<tr>
				<td width="20%"><a href="http://www.electronicsandmore.ca/catalog/extremeviewinc-m-24.html"><img src="images/eview.jpg" width="110" height="29" border="0" alt="" /></a></td>
				<td width="1" valign="middle"><img src="images/points.gif" width="1" height="52" alt="" /></td>
				<td width="20%"><a href=""><img src="images/cwlogo.jpg" width="95" height="19" border="0" alt="" /></a></td>
				<td width="1" valign="middle"><img src="images/points.gif" width="1" height="52" alt="" /></td>
				<td width="20%"><a href="http://www.electronicsandmore.ca/catalog/advanced_search_result.php?keywords=viewsat&x=0&y=0"><img src="images/viewsat.jpg" width="90" height="21" border="0" alt=""  /></a></td>
				<td width="1" valign="middle"><img src="images/points.gif" width="1" height="52" alt="" /></td>
				<td width="20%"><a href="http://www.electronicsandmore.ca/catalog/sonicview-m-26.html"><img src="images/Sonic.jpg" width="90" height="20" border="0" alt=""  /></a></td>
				<td width="1" valign="middle"><img src="images/points.gif" width="1" height="52" alt="" /></td>
				<td width="20%"><a href="http://www.electronicsandmore.ca/catalog/coolsat-m-10.html"><img src="images/coolsat.jpg" width="96" height="22" border="0" alt=""  /></a></td>

			</tr>
		</table>
	</td>
  </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Edited by kr0me

Share this post


Link to post
Share on other sites

I am also having this issue. If this issue has been resolved please post the solution. I am now going to double check through everything to see if I can find the problem. If I find the problem and the solution I will galdly post it. But there seems to be alot of people that are using this contrib and I can't believe that no one else is running into this issue or ran into this issue and solved it and did not post a solution for it.......

 

Shawn

 

I have just installed this contribution on osCMax 2.0.0-RC3-0-1 and everything appears to be working fine except when I click on Cart Contents and proceed through the checkout process, the individual prices all show $0.00 to the right of the product but the Sub-Total shows the correct amount.

 

Remove Product(s) Qty. Total

2.5'x4' Banner Flag 1 $0.00

2'x3' Navy 1 $0.00

 

Sub-Total: $62.80

 

Anyone have any ideas as to what could be causing this problem? Any help would be greatly appreciated. I'm willing to pay if necessary.

 

Thanks!

Share this post


Link to post
Share on other sites

As promissed I solved this issue as you can see very very quickly. You have to look out for the uses of the following 2 pieces of code and I will explain where they go:

 

$product['products_discount']

$products['products_discount']

 

These 2 pieces look very similiar but one has an 'S' and the other one does not.

 

In shopping_cart.php you need to find the following function. (I would post line numbers but everyones is different just do a search on the file with a file editor and there is only one function called calculate.

 

function Caclculate

 

This function does the overall shopping cart total / sub total. make sure that all references to products_discount uses:

$product['products_discount']

 

There should be 2 places the first on in the inital if statement. if (isset( etc.

The second one will be like the next line down and that is the

if( $tranche = explode( ',', $product['products_discount'] ) ) {

 

Now for the people that are getting $0.00 for individual products in the shopping cart your problem is in the next section of code that got added. With oscommerce it does the individual items seperately from the total. So you will need to open shopping_cart.php in a file editor and search for the following function:

 

function get_products() {

 

In this function will be where you added the next set of code for the Simple Price break Contribution. This function calculates the total for each individual product. You are going to pretty much do the same as above with one exception. Instead of using:

$product['products_discount']

 

You will be using $products['products_discount'] (the S added to product.

 

The first line to change to check will be the if statement again

if( isset($products['products_discount']) && strlen($products['products_discount'])>2 ) {

 

Make sure there is an S on $product if not you will get a nothing or $0.00 for a price.

and then you will do the same thing on the next line right after it:

if( $tranche = explode( ',', $products['products_discount'] ) ) { (the S added to product).

 

 

What most likely happened is somewhere along the lines because of line numbers not matching up and because the instructions are not 100% clear these to addition the one to function calculate and function get_products got reversed. when I first installed this mod I got $0.00 on everything. I reinstalled and reinstalled about 5 times and double checked everything. Then I jsut went through the query statements to compare to make sure everythign was being referenced properly and sure enough it wasn't.

 

I hope this helps you out and or anyone else that may have ran into this issue.

If you have any questions please reply ro PM me and I will gladly give you a hand.

Shawn

 

 

I am also having this issue. If this issue has been resolved please post the solution. I am now going to double check through everything to see if I can find the problem. If I find the problem and the solution I will galdly post it. But there seems to be alot of people that are using this contrib and I can't believe that no one else is running into this issue or ran into this issue and solved it and did not post a solution for it.......

 

Shawn

Share this post


Link to post
Share on other sites

Does any one still read this thread? If so does anyone know how to add this to the product_listing.php page?

 

I ma getting close with it but it keeps messing up.

 

thanks for any replies...

 

Shawn Mulligan

Share this post


Link to post
Share on other sites

Does anyone know how to adjust the layout of the table so that the quantities are on top and the price breaks are on the bottom? I've been trying to figure it out for quite some time now.

 

EXAMPLE:

 

QTY | QTY | QTY

$$$ | $$$ | $$$

Share this post


Link to post
Share on other sites

I need some help guys!

 

I'm getting the right (discounted) subtotal, but the line total shows the regular price. When you checkout, the line totals are used, so right now the customer is not getting any discount.

 

What's the solution to this problem?

Share this post


Link to post
Share on other sites
I need some help guys!

 

I'm getting the right (discounted) subtotal, but the line total shows the regular price. When you checkout, the line totals are used, so right now the customer is not getting any discount.

 

What's the solution to this problem?

I find the bug:

into classes/shopping_cart.php - into function get_products

 

after the

	  while (list($products_id, ) = each($this->contents)) {

 

there isn't the declaration

		$qty = $this->contents[$products_id]['qty'];

which is used above in the function to perform price calculation...

 

In fact, the same declaration is in the "calculate" function, which correctly works.

 

Now my line total of each products shows the discounted price

 

Bye

Fabio

Share this post


Link to post
Share on other sites

Hi all.

 

I'm having problem with the discount calculation. It is not showing up in the shopping cart. It charges the same basic price regardless of quantity.

 

In the product information page, it works great, showing the right quantity/price break info. But once in shopping cart, the price is the same regardless of quantity.

 

For example:

1-24 €54.50

25-99 €49.00

 

In shopping cart, if the quantity is 30, it will take €54.50 x 30.

 

I used Fabio's suggestion but didn't work.

 

Please could someone help me out? Many thanks.

Share this post


Link to post
Share on other sites

Never mind. Got it working. Taking the clue from previous post #18, I restored all my original files. I then installed version 1.1b. Works like magic. Version 2 seems to have problems in calculating the total.

 

Cheers.

Share this post


Link to post
Share on other sites

Thanks all the super programmers out there that ironed out the bugs!

 

All working perfectly! - Thanks!!! :)

Share this post


Link to post
Share on other sites

Hello, I've installed this Simple Price Break Module. http://addons.oscommerce.com/info/4658 Everything seems work fine except the shopping_cart.php page.

 

The price break is:

1-19 => Reqular Price

20 and up => 5%Off

 

The discount price is correct on the product_info.php page but is NOT correct on the shopping_cart.php page (the page after you click "Add to Cart" and update the qty more than 21. The unit price and the total price does not reflect the discount price. I'm not sure if you can see this page: http://estore.bcmcom.com/catalog/product_i...?products_id=37 Can you help me please?

 

Thank you.

 

As promissed I solved this issue as you can see very very quickly. You have to look out for the uses of the following 2 pieces of code and I will explain where they go:

 

$product['products_discount']

$products['products_discount']

 

These 2 pieces look very similiar but one has an 'S' and the other one does not.

 

In shopping_cart.php you need to find the following function. (I would post line numbers but everyones is different just do a search on the file with a file editor and there is only one function called calculate.

 

function Caclculate

 

This function does the overall shopping cart total / sub total. make sure that all references to products_discount uses:

$product['products_discount']

 

There should be 2 places the first on in the inital if statement. if (isset( etc.

The second one will be like the next line down and that is the

if( $tranche = explode( ',', $product['products_discount'] ) ) {

 

Now for the people that are getting $0.00 for individual products in the shopping cart your problem is in the next section of code that got added. With oscommerce it does the individual items seperately from the total. So you will need to open shopping_cart.php in a file editor and search for the following function:

 

function get_products() {

 

In this function will be where you added the next set of code for the Simple Price break Contribution. This function calculates the total for each individual product. You are going to pretty much do the same as above with one exception. Instead of using:

$product['products_discount']

 

You will be using $products['products_discount'] (the S added to product.

 

The first line to change to check will be the if statement again

if( isset($products['products_discount']) && strlen($products['products_discount'])>2 ) {

 

Make sure there is an S on $product if not you will get a nothing or $0.00 for a price.

and then you will do the same thing on the next line right after it:

if( $tranche = explode( ',', $products['products_discount'] ) ) { (the S added to product).

 

 

What most likely happened is somewhere along the lines because of line numbers not matching up and because the instructions are not 100% clear these to addition the one to function calculate and function get_products got reversed. when I first installed this mod I got $0.00 on everything. I reinstalled and reinstalled about 5 times and double checked everything. Then I jsut went through the query statements to compare to make sure everythign was being referenced properly and sure enough it wasn't.

 

I hope this helps you out and or anyone else that may have ran into this issue.

If you have any questions please reply ro PM me and I will gladly give you a hand.

Shawn

Share this post


Link to post
Share on other sites

Version 2 seems have problem doing the calculation so I took post#18 and #41's suggestion - install Version 1.1b and it works. Thanks.

 

Hello, I've installed this Simple Price Break Module. http://addons.oscommerce.com/info/4658 Everything seems work fine except the shopping_cart.php page.

 

The price break is:

1-19 => Reqular Price

20 and up => 5%Off

 

The discount price is correct on the product_info.php page but is NOT correct on the shopping_cart.php page (the page after you click "Add to Cart" and update the qty more than 21. The unit price and the total price does not reflect the discount price. I'm not sure if you can see this page: http://estore.bcmcom.com/catalog/product_i...?products_id=37 Can you help me please?

 

Thank you.

Share this post


Link to post
Share on other sites

I found the bug I think:

 

in includes/classes/shopping_cart.php

 

inside the function get_products()

make sure the Simple Price Break block that parses the discount entry looks exactly like this:

if( isset($products['products_discount']) && strlen($products['products_discount'])>2 ) {
           if( $tranche = explode( ',', $products['products_discount'] ) ) {
           $products_price_tmp = $products_price;
           foreach( $tranche as $cle => $trn )
             if( $qty_px = explode( ':', $trn ) ) {
               if( $this->contents[$products_id]['qty'] >= $qty_px[0] ) {
                 if( strstr($qty_px[1],'%') )
                   $products_price_tmp = $products_price * (1-($qty_px[1]/100));
                 else
                   $products_price_tmp = $qty_px[1];
               }
             }
           $products_price = $products_price_tmp;
           }
         }

 

 

Sorry I don't have line numbers, my install is modified too much. I'll add this as an update to the contribution.

Edited by jmbesolutions

Share this post


Link to post
Share on other sites

Finally!

It has been solved - a very big thanks to my super patient husband for checking this out for me.

 

Do you use a price break contribution and want the cheapest price break to appear in your results page?

(ie Search Pages, Product Listings, etc.)

 

View an example on the site I am working on right here

 

Heres How! I use the Simple Price Break contribution,

so thats all we have figured out how to change, anyway here 'tis...

 

I have posted it here: http://forums.oscommerce.com/index.php?showtopic=311856

 

 

Hope it helps someone!

Cheers, Kristy

Share this post


Link to post
Share on other sites
Hi people,

 

How to get the price per product installed in the shopping cart like this example:

PRICE PER PRODUCT IN SHOPPING CART

 

 

Hi,

I need help. I don't know what I'm doing, I've followed all the instructions and it seems to be working, but the total does not reflect the qty. discount.

I read the posts, and tried the solutions, but it still isn't working. :<{.

 

http://www.sensoray.com/catalog/product_in...oducts_id=22556

 

Can anybody help?

Thank you,

Melissa

Share this post


Link to post
Share on other sites

Hello,

 

I install the contribution and the discount appear in the product info but I get the following error when I go to my shopping cart.

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in underdevelopment.com/includes/functions/database.php on line 99

 

I write over the shopping_cart.php class with my original and the error goes away (but of course I no longer have the discount functionality)...

 

Any ideas what could be going wrong. The database.php file has not been modified.

 

but here is the line that is has the problem.

 

function tep_db_fetch_array($db_query) {

return mysql_fetch_array($db_query, MYSQL_ASSOC); [LINE 99]

}

 

 

any ideas?

 

HD

 

P.S. I posted this in the wrong area a few moments ago.

Share this post


Link to post
Share on other sites
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in underdevelopment.com/includes/functions/database.php on line 99

Without having seen the code of this contribution I can almost guarantee you you made a mistake in adding the code. The error points to osC retrieving the results of the query where a query hasn't been done (not added, or in the wrong place, something like that).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×