Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

thanks Jan, you would appear to be 'The Man' :thumbsup:

 

All working fine now, looking forward to implementing this fantastic contrib!

Share this post


Link to post
Share on other sites

Now that I'm up and running, I've had a couple of ideas that I'm sure others could implement.

 

I have a minimum order mod installed for customers (currently £4.99 for retail).

 

// MINIMUM ORDER MOD
 if ($order->info['subtotal'] < MIN_ORDER_AMOUNT) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'));
 }

 

Could we modify this for different groups? So that retail would remain at £4.99, Trade at say £150, etc...

 

I'm thinking (not written properly:) if customer group=0 { MIN_ORDER_AMOUNT = 4.99 } elseif { if customer group=1 { MIN_ORDER_AMOUNT = 150 } }

 

Where/How would one incorporate this "customer group" into this. I don't know what code I would need.

 

More importantly I'm running a loyalty discount mod that gives customers discount the more they have spent in the past. I dont want to offer this to trade customers!

 

I'm thinking the code would be pretty much the same: if customer group=0 then activate else don't activate...

 

Again if someone can help me with obtaining the if statement for the customer group, that would be great :rolleyes:

Share this post


Link to post
Share on other sites
Where/How would one incorporate this "customer group" into this. I don't know what code I would need.
That was discussed earlier. See this post and a few posts earlier on that page (page 127 in this thread). For the loyalty thing you might be able to use similar code I guess.

Share this post


Link to post
Share on other sites

I have got the most bizzare thing happening :huh:

 

When I view a main category page, the subcategories are showing up double in the product_listing table :( This does not happen in IE7 - but started happening in FireFox once I installed Netscape yesterday for another test browser - it also happens in Netscape. What makes it even more weird is it only happens visually - if I view the source code the subcategories are only in there once :blink:

 

I have been scouring the forums via Google searches and I haven't come accross this issue yet.

 

Since I have both SPPC and Master Products installed I figure it could be a glitch with the code in either contrib - or in the way they combine and work together on the product_listing.php page. For this reason I'm posting this in both contrib's support forums ;)

 

Any thoughts on what's causing this?

 

You can see the issue in Firefox or Netscape here:

http://mmherbs.dreamhosters.com

 

Here's my product_listing.php code:

(I did modify the code some so that the table would only show the name of the subcategory, and I think I left the image there too even though I am not using it)

<?php
/*
 $Id: product_listing.php,v 1.44 2003/06/09 22:49:59 hpdl Exp $
 adapted for Separate Pricing Per Customer v4 2005/02/26

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

 Copyright (c) 2003 osCommerce

 Master Products  - JOHNSON - 05/07/2003 matti@suomedia.com

 Copyright (c) 2003 Suomedia - Dynamic Content Management  

 Released under the GNU General Public License
*/

 $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

 if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
<?php
 }

 $list_box_contents = array();

 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
switch ($column_list[$col]) {
  case 'PRODUCT_LIST_IMAGE':
	$lc_text = TABLE_HEADING_IMAGE;
	$lc_align = 'center';
	break;
  case 'PRODUCT_LIST_NAME':
	$lc_text = TABLE_HEADING_PRODUCTS;
	$lc_align = '';
	break;

}

  // if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {
 // $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);
//}

$list_box_contents[0][] = array('align' => $lc_align,
								'params' => 'class="productListing-heading"',
								'text' => ' ' . $lc_text . ' ');
 }

 if ($listing_split->number_of_rows > 0) {

$rows = 0;
$listing_query = tep_db_query($listing_split->sql_query);
// BOF Separate Pricing per Customer
$no_of_listings = tep_db_num_rows($listing_query);
// global variable (session) $sppc_customer_group_id -> local variable customer_group_id

 if ( !isset($_SESSION['sppc_customer_group_id']) ) {
 $customer_group_id = '0';
 } else {
  $customer_group_id = $_SESSION['sppc_customer_group_id'];
 }


while ($_listing = tep_db_fetch_array($listing_query)) {
  $listing[] = $_listing;
$list_of_prdct_ids[] = $_listing['products_id'];
} 
// next part is a debug feature, when uncommented it will print the info that this module receives
/*
  echo '<pre>';
  print_r($listing);
  echo '</pre>';
*/  
 $select_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' ";
 if ($no_of_listings > 1) {
  for ($n = 1; $n < count($list_of_prdct_ids); $n++) {
  $select_list_of_prdct_ids .= "or products_id = '".$list_of_prdct_ids[$n]."' "; 
  }
}

// get all product prices for products with the particular customer_group_id
// however not necessary for customer_group_id = 0
if ($customer_group_id != '0') {
 $pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where (".$select_list_of_prdct_ids.") and pg.customers_group_id = '".$customer_group_id."' ");
//   $no_of_pg_products = tep_db_num_rows($pg_query);
while ($pg_array = tep_db_fetch_array($pg_query)) {
$new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => '', 'final_price' => $pg_array['price']);
}
  for ($x = 0; $x < $no_of_listings; $x++) {
// replace products prices with those from customers_group table
  if(!empty($new_prices)) {
	 for ($i = 0; $i < count($new_prices); $i++) {
	if( $listing[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
	$listing[$x]['products_price'] = $new_prices[$i]['products_price'];
	$listing[$x]['final_price'] = $new_prices[$i]['final_price'];
	}
	}
} // end if(!empty($new_prices)
$listing[$x]['specials_new_products_price'] = ''; // makes sure that a retail specials price doesn't carry over to another customer group
$listing[$x]['final_price'] = $listing[$x]['products_price']; // final price should not be the retail special price
  } // end for ($x = 0; $x < $no_of_listings; $x++)
} // end if ($customer_group_id != '0')

// an extra query is needed for all the specials

$specials_query = tep_db_query("select products_id, specials_new_products_price from " . TABLE_SPECIALS . " where (".$select_list_of_prdct_ids.") and status = '1' and customers_group_id = '" .$customer_group_id. "'");
while ($specials_array = tep_db_fetch_array($specials_query)) {
$new_s_prices[] = array ('products_id' => $specials_array['products_id'], 'products_price' => '', 'specials_new_products_price' => $specials_array['specials_new_products_price'] , 'final_price' => $specials_array['specials_new_products_price']);
}

// add the correct specials_new_products_price and replace final_price
for ($x = 0; $x < $no_of_listings; $x++) {

	if(!empty($new_s_prices)) {
	for ($i = 0; $i < count($new_s_prices); $i++) {
	 if( $listing[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) {
	   $listing[$x]['specials_new_products_price'] = $new_s_prices[$i]['specials_new_products_price'];
	   $listing[$x]['final_price'] = $new_s_prices[$i]['final_price'];
	 }
	   }
   } // end if(!empty($new_s_prices)
} // end for ($x = 0; $x < $no_of_listings; $x++)

//	while ($listing = tep_db_fetch_array($listing_query)) { (was original code)
for ($x = 0; $x < $no_of_listings; $x++) {

  $rows++;

  if (($rows/2) == floor($rows/2)) {
	$list_box_contents[] = array('params' => 'class="productListing-even"');
  } else {
	$list_box_contents[] = array('params' => 'class="productListing-odd"');
  }

  $cur_row = sizeof($list_box_contents) - 1;

  for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
	$lc_align = '';

	switch ($column_list[$col]) {
	  case 'PRODUCT_LIST_IMAGE':
		$lc_align = 'center';
		if (isset($HTTP_GET_VARS['manufacturers_id'])) {
		  $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
		} else {
		  $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
		}
		break;
	  case 'PRODUCT_LIST_NAME':
		$lc_align = '';
		if (isset($HTTP_GET_VARS['manufacturers_id'])) {
		  $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a>';
		} else {
		  $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a> ';
		}
		break;
	   // EOF Separate Pricing per Customer
//Master Products			
		if ($listing[$x]['products_master_status'] != '1' && $listing[$x]['products_master'] == '0') {
				$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
			} elseif ($listing[$x]['products_master'] != '0') {
	   		 $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_master']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
			} else {
				$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
			}
//Master Products EOF			
		break;
	}

	$list_box_contents[$cur_row][] = array('align' => $lc_align,
										   'params' => 'class="productListing-data"',
										   'text'  => $lc_text);
  }
}

new productListingBox($list_box_contents);
 } else {
$list_box_contents = array();

$list_box_contents[0] = array('params' => 'class="productListing-odd"');
$list_box_contents[0][] = array('params' => 'class="productListing-data"',
							   'text' => TEXT_NO_PRODUCTS);

new productListingBox($list_box_contents);
 }

 if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
<?php
 }
?>


~Tracy
 

Share this post


Link to post
Share on other sites

Hi

I've spend hours getting this contrib to work - I think I'm nearly there, it looks promissing!

 

I updated the "Open Featured Sets" - works fine!

Fixed products_new.php, (using "Control New Products module") - got it to work, but deactivating a new product from admin - it's still visible? What controls that part??

 

These two really need an update:

The "Star Product " and the "Wishlist 2.0" contribution ?? - Has anybody made an update for these two?

 

Is the possible?

When a special customer is logged in - next to those discount products to show a little image icon/ or whatever text telling the customer that this product has a different price. When you're not logged in as a special customer - no image/text show next to the product.

 

Hope for a answer - please

Helle :-)

Share this post


Link to post
Share on other sites

Ohhh, I forgot this question too:

When you're logged on with as al discount customer - and want too see specials.php - it's emty? Logged on as a retail or not logged on - it shows fine?

 

Helle *again*

Share this post


Link to post
Share on other sites

Hi again

Now I'm all cross-eyed - reading and reading to figure out where my specials products are gone to - when you log in as a discount customer - it's simply all emty?

 

I noticed that "garysgal" and "Mookie Jam" had the same problem - but no answers that worked??

 

Please don't tell me that discount customers can't buy products in normal "Specials" ??

 

Can anybody see if I have made any mistakes??

 

Please - Helle :(

 

<?php
/*
 $Id: specials.php,v 1.49 2003/06/09 22:35:33 hpdl Exp $
 adapted for Separate Pricing Per Customer v3.6 2005/03/08

 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_SPECIALS);

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SPECIALS));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<?php
// BOF: Header Tag Controller v2.6.0
if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
 require(DIR_WS_INCLUDES . 'header_tags.php');
} else {
?> 
 <title><?php echo TITLE; ?></title>
<?php
}
// EOF: Header Tag Controller v2.6.0
?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</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="3" cellpadding="3">
 <tr>
<td width="<?php echo BOX_WIDTH_LEFT; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH_LEFT; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_specials.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
// BOF Separate Price Per Customer
//  global variable (session): $sppc_customers_group_id -> local variable $customer_group_id

 if(!tep_session_is_registered('sppc_customer_group_id')) { 
 $customer_group_id = '0';
 } else {
  $customer_group_id = $sppc_customer_group_id;
 }

/*   $specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC"; */

 $specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' and s.customers_group_id = ". (int)$customer_group_id." order by s.specials_date_added DESC";
 $specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);
// EOF Separate Price Per Customer
 $specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);

 if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="smallText"><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>
		<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
	  </tr>
	</table></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="0" cellpadding="2">
	  <tr>
<?php
// BOF Separate Price Per Customer

$row = 0;
$specials_query = tep_db_query($specials_split->sql_query);

$no_of_specials = tep_db_num_rows($specials_query);
// get all product prices from the table products_groups in one query
// traverse specials_query for products_id's, store the query result in a numbered array
  while ($_specials = tep_db_fetch_array($specials_query)) {
$specials[] = $_specials;
$list_of_prdct_ids[] = $_specials['products_id'];
  } // end while ($_specials = tep_db_fetch_array($specials_query))
// a line needed for the selection of the products_id's
 $pg_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' ";
 if ($no_of_specials > 1) {
  for ($n = 1; $n < count($list_of_prdct_ids); $n++) {
  $pg_list_of_prdct_ids .= "or products_id = '".$list_of_prdct_ids[$n]."' ";  
  }
}
// now get all the customers_group_price's
$pg_query = tep_db_query("select products_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where (".$pg_list_of_prdct_ids.") and customers_group_id =  '" . $customer_group_id . "'");
// put all the info in an array called new_prices
while ($pg_array = tep_db_fetch_array($pg_query)) {
$new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['customers_group_price']);
}
// we already got the results from the query and put them into an array, can't use while now
//	while ($specials = tep_db_fetch_array($specials_query)) {
for ($x = 0; $x < $no_of_specials; $x++) {	
  $row++;
// replace products prices with those from customers_group table	  
	if(!empty($new_prices)) {
	for ($i = 0; $i < count($new_prices); $i++) {
		if( $specials[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
		$specials[$x]['products_price'] = $new_prices[$i]['products_price'];
		}
	}
} // end if(!empty($new_prices)

  echo '			<td align="center" width="33%" class="smallText"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $specials[$x]['products_image'], $specials[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials[$x]['products_id']) . '">' . $specials[$x]['products_name'] . '</a><br><s>' . $currencies->display_price($specials[$x]['products_price'], tep_get_tax_rate($specials[$x]['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($specials[$x]['specials_new_products_price'], tep_get_tax_rate($specials[$x]['products_tax_class_id'])) . '</span></td>' . "\n";
// EOF Separate Price per Customer, specials code
  if ((($row / 3) == floor($row / 3))) {
?>
	  </tr>
	  <tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	  </tr>
	  <tr>
<?php
  }
}
?>
	  </tr>
	</table></td>
  </tr>
<?php
 if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
  <tr>
	<td><br><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="smallText"><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>
		<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
	  </tr>
	</table></td>
  </tr>
<?php
 }
?>
</table></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH_RIGHT; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH_RIGHT; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</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'); ?>

Share this post


Link to post
Share on other sites
Hi again

Now I'm all cross-eyed - reading and reading to figure out where my specials products are gone to - when you log in as a discount customer - it's simply all emty?

 

I noticed that "garysgal" and "Mookie Jam" had the same problem - but no answers that worked??

 

Please don't tell me that discount customers can't buy products in normal "Specials" ??

 

Can anybody see if I have made any mistakes??

 

Please - Helle :(

 

The “special products” is not modified for CPPC

Share this post


Link to post
Share on other sites
When you're logged on with as al discount customer - and want too see specials.php - it's emty? Logged on as a retail or not logged on - it shows fine?
Then you haven't defined those specials for that discount group. Specials for retail do not carry over to other groups.

 

Regarding showing an icon or something for another group, that is simple to do with if ($customer_group_id != 0) { do whatever you like for a customer group other than retail ; } else { do something for retail or leave the else out completely; }.

 

Or perhaps you want to something like Jeep Ice' contribution to show the list price: Show Price list for SPPC 4.1 v1.0.

Share this post


Link to post
Share on other sites

Hi JanZ and medved

 

You really mean to tell me - a discount customer CANNOT benefit from a "public" special offer - like any retail customer?

 

As it shows right now - a logged in discount customer can see the special offer prices (the show with red typing) in the "specials box"etc., but when clicking on the product - the price is the normal one - higher?

 

Please don't tell me that's how it is? I mean where is the logic for that? I've worked liked a little horse most of yesterday (I'm not a PHP shark) and I'm going to be really sad if that's the way it is.....

 

Helle ....

Share this post


Link to post
Share on other sites
You really mean to tell me - a discount customer CANNOT benefit from a "public" special offer - like any retail customer?
That is right. If you want them to also have the special price you also have to make the product a special for that group too in the admin section.
As it shows right now - a logged in discount customer can see the special offer prices (the show with red typing) in the "specials box"etc., but when clicking on the product - the price is the normal one - higher?
Then something is wrong on that page. When logged-in it should not show the specials price because it is not a special for them. When they add it to the cart then they should get their normal - customer group - price.
I mean where is the logic for that?
The logic is that you have different customer groups, all specials and prices are separate. Where is the logic that a customer group should have the same special products at the same specials price as retail? Remember: Separate Pricing Per Customer (customer group really).

Share this post


Link to post
Share on other sites

Okay JanZ

My little shop sell "one of a kind products" mostly and my idea was to give a few people discount.

 

I must say the contrib looked really good with lots of great functions. I liked the idea of controlling who can buy using which payment/shipping methods - great.

If you ever change it, so "everybody" can benefit from special prices - then I'll certainly reinstall it. But as it is now, it limits me...

 

Hope you'll update it once upon a time

Best regards

Helle

Share this post


Link to post
Share on other sites
Okay JanZ

My little shop sell "one of a kind products" mostly and my idea was to give a few people discount.

 

I must say the contrib looked really good with lots of great functions. I liked the idea of controlling who can buy using which payment/shipping methods - great.

If you ever change it, so "everybody" can benefit from special prices - then I'll certainly reinstall it. But as it is now, it limits me...

 

Hope you'll update it once upon a time

Best regards

Helle

Do we have a "Best of osCommerce Community WTF Were They Thinking?" section?

Share this post


Link to post
Share on other sites

Take it easy HallMarc

....english is NOT my main language - so I missed that part - yes!!

 

This is what it says from the contrib download page:

"This mod allows the site owner to assign customers to seperate groups and then give different pricing per product for each group."

 

.....IT DID not say - that ordinary "special offers" are GONE and for selected customers if you install this!

 

Helle :-)

 

Sorry if I'm not so smart/clever and fantastic like you

Share this post


Link to post
Share on other sites
This is what it says from the contrib download page:

"This mod allows the site owner to assign customers to seperate groups and then give different pricing per product for each group."

 

.....IT DID not say - that ordinary "special offers" are GONE and for selected customers if you install this!

What is the problem? The specials you had before installing SPPC are now for retail customers. If you want them for other groups too you just add them for those groups. Is that too much work for you or are we not talking the same language?

 

There is even a contribution adapted for SPPC that makes it easy to set specials for the different groups: Admin Specials by Categories for SPPC so the extra work is not an argument really.

Share this post


Link to post
Share on other sites
Take it easy HallMarc

....english is NOT my main language - so I missed that part - yes!!

 

This is what it says from the contrib download page:

"This mod allows the site owner to assign customers to seperate groups and then give different pricing per product for each group."

 

.....IT DID not say - that ordinary "special offers" are GONE and for selected customers if you install this!

 

Helle :-)

 

Sorry if I'm not so smart/clever and fantastic like you

 

Helle,

 

You just need to go into your admin and create your specials for your other group. Each group has it's own list of specials - so that you can offer different specials to different groups if you want to. If you go into your Admin and go to Catalog -> Specials and choose "New Product" you will see that you then choose which customer group that special is for.


~Tracy
 

Share this post


Link to post
Share on other sites
Take it easy HallMarc

....english is NOT my main language - so I missed that part - yes!!

 

This is what it says from the contrib download page:

"This mod allows the site owner to assign customers to seperate groups and then give different pricing per product for each group."

 

.....IT DID not say - that ordinary "special offers" are GONE and for selected customers if you install this!

 

Helle :-)

 

Sorry if I'm not so smart/clever and fantastic like you

Thanks for the support TracyS and JanZ, I wasn't being harsh. HelleM you should realize you are in one of the best support systems I know of. There are people from all over the world here. I'm sure you can find someone that speaks your language and help answer some of your questions and then when you finally understand how to use this contribution, maybe you could write up an addition in your native tongue so the next person who speaks your language and maybe no English at all won't have such a hard time. B)

Share this post


Link to post
Share on other sites

Sorry HallMarc, JanZ and TracyS

I lost my temper there for a second - I had worked for so long on installing the contrib - and didn't really understand the retail/grups price differencies

 

My apology to all

 

Helle

Share this post


Link to post
Share on other sites
Sorry HallMarc, JanZ and TracyS

I lost my temper there for a second - I had worked for so long on installing the contrib - and didn't really understand the retail/grups price differencies

 

My apology to all

 

Helle

 

No problem Helle, I understand what it is like to be using osC for the first time and trying to get it working the way you want - I can't imagine doing all of that while also receiving help in a language that isn't your first - I have a hard enough time just figuring out the PHP/MySQL stuff with help in my native language! - :)


~Tracy
 

Share this post


Link to post
Share on other sites

Hi guys,

 

I've got a advanced_search_result.php question as I am now totally stuck :(

 

If I try to search my site using the search infobox or the advanced search I get MySQL errors. The fix I found for the first set of errors was to remove this line of code from the file:

$from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

 

This makes sense as the first errors were that pd, c and p2c had already been setup. So - I went ahead and removed this - but then I get this error:

1054 - Unknown column 'p.products_id' in 'on clause'

 

select count(distinct p.products_id) as total from products p left join manufacturers m using(manufacturers_id), products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%raspberry%' or p.products_model like '%raspberry%' or m.manufacturers_name like '%raspberry%') )

 

So - back to searching the forums and the only answer I've found is the updates for running MySQL 5, which tell me to put the $from_str line of code in.

 

Well - of course, if I put that back in I'm back to the original errors which tell me I've already declared those tables >_<

 

Does anybody here know how to setup advanced_search_result.php so that it functions correctly with SPPC and MySQL 5.0 ?

 

If you need to see my code just let me know and I'll be happy to post it - figured since I've seen so many posts regarding these types of issues somebody here might know off the top of their head ;)

 

Back to searching for any other possible fixes :thumbsup:


~Tracy
 

Share this post


Link to post
Share on other sites
Hi guys,

 

I've got a advanced_search_result.php question as I am now totally stuck :(

 

If I try to search my site using the search infobox or the advanced search I get MySQL errors. The fix I found for the first set of errors was to remove this line of code from the file:

$from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

 

This makes sense as the first errors were that pd, c and p2c had already been setup. So - I went ahead and removed this - but then I get this error:

1054 - Unknown column 'p.products_id' in 'on clause'

 

select count(distinct p.products_id) as total from products p left join manufacturers m using(manufacturers_id), products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%raspberry%' or p.products_model like '%raspberry%' or m.manufacturers_name like '%raspberry%') )

 

So - back to searching the forums and the only answer I've found is the updates for running MySQL 5, which tell me to put the $from_str line of code in.

 

Well - of course, if I put that back in I'm back to the original errors which tell me I've already declared those tables >_<

 

Does anybody here know how to setup advanced_search_result.php so that it functions correctly with SPPC and MySQL 5.0 ?

 

If you need to see my code just let me know and I'll be happy to post it - figured since I've seen so many posts regarding these types of issues somebody here might know off the top of their head ;)

 

Back to searching for any other possible fixes :thumbsup:

 

PS - I had checked through the entire update-20051113 file way back when I was first installing osC and found that the updates for MySQL 5.0 had already been done, including the database changes. And products_id is a valid field in my products table.


~Tracy
 

Share this post


Link to post
Share on other sites
PS - I had checked through the entire update-20051113 file way back when I was first installing osC and found that the updates for MySQL 5.0 had already been done, including the database changes. And products_id is a valid field in my products table.

 

Another PS (from another post I found) - I'm running PHP 4.4.4 and Register Globals is turned ON - is this a problem? I can't find anywhere in admin to turn it off to test and see :(


~Tracy
 

Share this post


Link to post
Share on other sites
PS - I had checked through the entire update-20051113 file way back when I was first installing osC and found that the updates for MySQL 5.0 had already been done, including the database changes. And products_id is a valid field in my products table.
The correct queries are somewhere in the thread, but I'm too lazy now to search for them.

 

These will be the new install instructions for that page:

catalog/advanced_search_result.php (version November 13, 2005 update !)

Line 4

**AFTER**
 $Id: advanced_search_result.php,v 1.72 2003/06/23 06:50:11 project3000 Exp $

**ADD**
 adapted for Separate Pricing Per Customer 2006/06/01



Line 185

**AFTER**
while (list($key, $value) = each($define_list)) {
if ($value > 0) $column_list[] = $key;
 }

**ADD**
// BOF Separate Pricing Per Customer
 if(!tep_session_is_registered('sppc_customer_group_id')) {
 $customer_group_id = '0';
 } else {
  $customer_group_id = $sppc_customer_group_id;
 }
  // EOF Separate Pricing Per Customer


Lines 214-220

**REPLACE**
 $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price ";

 if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
$select_str .= ", SUM(tr.tax_rate) as tax_rate ";
 }

 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id";


**WITH**
  // BOF Separate Pricing Per Customer
  $status_tmp_product_prices_table = false;
  $status_need_to_get_prices = false;
  // find out if sorting by price has been requested
  if ( (isset($HTTP_GET_VARS['sort'])) && (ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) && (substr($HTTP_GET_VARS['sort'], 0, 1) <= sizeof($column_list)) ){
$_sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
if ($column_list[$_sort_col-1] == 'PRODUCT_LIST_PRICE') {
  $status_need_to_get_prices = true;
  }
  }

  if ((tep_not_null($pfrom) || tep_not_null($pto) || $status_need_to_get_prices == true) && $customer_group_id != '0') { 
  $product_prices_table = TABLE_PRODUCTS_GROUP_PRICES.$customer_group_id;
  // the table with product prices for a particular customer group is re-built only a number of times per hour
  // (setting in /includes/database_tables.php called MAXIMUM_DELAY_UPDATE_PG_PRICES_TABLE, in minutes)
  // to trigger the update the next function is called (new function that should have been
  // added to includes/functions/database.php)
  tep_db_check_age_products_group_prices_cg_table($customer_group_id);
  $status_tmp_product_prices_table = true;   
  } elseif ((tep_not_null($pfrom) || tep_not_null($pto) || $status_need_to_get_prices == true) && $customer_group_id == '0') {
  // to be able to sort on retail prices we *need* to get the special prices instead of leaving them
  // NULL and do product_listing the job of getting the special price
  // first make sure that table exists and needs no updating
  tep_db_check_age_specials_retail_table();
  $status_tmp_special_prices_table = true;
  } // end elseif ((tep_not_null($pfrom) || (tep_not_null($pfrom)) && .... 

  if ($status_tmp_product_prices_table == true) {
  $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, tmp_pp.products_price, p.products_tax_class_id, if(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price ";
  } elseif ($status_tmp_special_prices_table == true) {
 $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, if(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, if(s.status, s.specials_new_products_price, p.products_price) as final_price ";	
  } else {
 $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, NULL as specials_new_products_price, NULL as final_price ";	
  }
  // next line original select query
  // $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price ";


 if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
$select_str .= ", SUM(tr.tax_rate) as tax_rate ";
 }

  if ($status_tmp_product_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . $product_prices_table . " as tmp_pp using(products_id)";
  } elseif ($status_tmp_special_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id ";
  } else {
$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) ";
  }
 // EOF Separate Pricing Per Customer


Lines 341-347

**REPLACE**
if (DISPLAY_PRICE_WITH_TAX == 'true') {
if ($pfrom > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) >= " . (double)$pfrom . ")";
if ($pto > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) <= " . (double)$pto . ")";
 } else {
if ($pfrom > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) >= " . (double)$pfrom . ")";
if ($pto > 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) <= " . (double)$pto . ")";
 }





**WITH**
// BOF Separate Pricing Per Customer
  if ($status_tmp_product_prices_table == true) {
 if (DISPLAY_PRICE_WITH_TAX == 'true') {
if ($pfrom > 0) $where_str .= " and (IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) >= " . (double)$pfrom . ")";
if ($pto > 0) $where_str .= " and (IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) <= " . (double)$pto . ")";
 } else {
if ($pfrom > 0) $where_str .= " and (IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) >= " . (double)$pfrom . ")";
if ($pto > 0) $where_str .= " and (IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) <= " . (double)$pto . ")";
 }
  } else { // $status_tmp_product_prices_table is not true: uses p.products_price instead of cg_products_price
   // because in the where clause for the case $status_tmp_special_prices is true, the table
   // specials_retail_prices is abbreviated with "s" also we can use the same code for "true" and for "false"
	 if (DISPLAY_PRICE_WITH_TAX == 'true') {
if ($pfrom > 0) $where_str .= " and (IF(s.status AND s.customers_group_id = '" . $customer_group_id . "', s.specials_new_products_price, p.products_price) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) >= " . (double)$pfrom . ")";
if ($pto > 0) $where_str .= " and (IF(s.status AND s.customers_group_id = '" . $customer_group_id . "', s.specials_new_products_price, p.products_price) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) <= " . (double)$pto . ")";
 } else {
if ($pfrom > 0) $where_str .= " and (IF(s.status AND s.customers_group_id = '" . $customer_group_id . "', s.specials_new_products_price, p.products_price) >= " . (double)$pfrom . ")";
if ($pto > 0) $where_str .= " and (IF(s.status AND s.customers_group_id = '" . $customer_group_id . "', s.specials_new_products_price, p.products_price) <= " . (double)$pto . ")";
  }
  }
// EOF Separate Pricing Per Customer

I hope this helps :)

Share this post


Link to post
Share on other sites
The correct queries are somewhere in the thread, but I'm too lazy now to search for them.

 

These will be the new install instructions for that page:

 

Thanks JanZ - I will try this next. I had found a contrib called Error Message - 1054 - Unknown column 'p.products_id' in 'on clause'

 

After making the changes recommended in this contrib I have a functioning search again (both the infobox and the advanced search page) - however; I now have a 3x5 table with 15 links to one product :huh:

 

http://mmherbs.dreamhosters.com

 

Gonna try your new install instructions and see if that fixes both problems :)


~Tracy
 

Share this post


Link to post
Share on other sites
The correct queries are somewhere in the thread, but I'm too lazy now to search for them.

 

These will be the new install instructions for that page:

 

Hi JanZ,

 

Thanks again for the new instructions - but they unfortunately bring me right back to the 1054 error:

1054 - Unknown column 'pd.products_id' in 'where clause'

 

select count(distinct p.products_id) as total from products p left join manufacturers m using(manufacturers_id) where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%cohosh%' or p.products_model like '%cohosh%' or m.manufacturers_name like '%cohosh%') )

 

I'm guessing that means the contrib I mentioned in my last post is needed in my case since after installing that contrib my searches work without MySQL errors.

 

Now I just have to figure out why it's listing the same product 15 times! :huh:


~Tracy
 

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

×