RE: Separate pricing per user

ocularmagic <[email protected]>
Newsgroups gmane.comp.web.oscommerce.features
Message-ID <4ff11fe63d34e7631c98fa746584c6a5@osCommerce-Forums>
This message was sent from: Features
http://forums.oscommerce.com/viewtopic.php?p=162404#162404
----------------------------------------------------------------

Paul, I have'nt heard of this problem popping up before but I'll tell you some things that have changed since that release.  In catalog/includes/modules/product_listing.php the instructions say this:
[code]catalog/includes/modules/product_listing.php

Around line 97

After:

if ($listing_numrows > 0) {
  $number_of_products = '0';
  $listing = tep_db_query($listing_sql);
  while ($listing_values = tep_db_fetch_array($listing)) {

Add:

$customer_group_query = tep_db_query("select customers_group_id from " . TABLE_CUSTOMERS . " where customers_id =  '" . $customer_id . "'");
$customer_group = tep_db_fetch_array($customer_group_query);
$customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $listing_values['products_id'] . "' and customers_group_id =  '" . $customer_group['customers_group_id'] . "'");
if ( $customer_group['customers_group_id'] != 0) {
  if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
    $listing_values['products_price'] = $customer_group_price['customers_group_price'];
  }
}[/code]

Somewhere along the way $listing_values changed to just $listing so the updated version should read:
[code]catalog/includes/modules/product_listing.php

Around line 97

After:

if ($listing_numrows > 0) {
  $number_of_products = '0';
  $listing = tep_db_query($listing_sql);
  while ($listing = tep_db_fetch_array($listing)) {

Add:

$customer_group_query = tep_db_query("select customers_group_id from " . TABLE_CUSTOMERS . " where customers_id =  '" . $customer_id . "'");
$customer_group = tep_db_fetch_array($customer_group_query);
$customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $listing['products_id'] . "' and customers_group_id =  '" . $customer_group['customers_group_id'] . "'");
if ( $customer_group['customers_group_id'] != 0) {
  if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
    $listing['products_price'] = $customer_group_price['customers_group_price'];
  }
}
[/code]

Also two lines of code in the instructions are missing ending semicolons.  Specifically in catalog/includes/modules/products_new.php.  You'll see it when you look at it.  The other thing that has been pointed out to me is that  catalog/includes/modules/new_products.php is shown twice in the install file.  You only need to modify it once.  As I've told a few people the company I work for is not doing so well so my support of the mod is limited.  I'll try to help if I can though.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.