Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

Can you post a copy of your code for this page? Mine is also modified for other contributions, so I don't want to add confusion by posting that for you to compare with :blush:

 

This is the code: /includes/modules/new_products.php

<?php
/*
 $Id: new_products.php 1806 2008-01-11 22:48:15Z hpdl $
 adapted for Separate Pricing Per Customer v4.2 2008/07/13

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

 Copyright (c) 2008 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- new_products //-->
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));

 new contentBoxHeading($info_box_contents);

 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
   // BOF Separate Pricing Per Customer
   $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } else {
   $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on pd.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c using(categories_id) where c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

// global variable (session) $sppc_customer_group_id -> local variable customer_group_id

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

 if (($no_of_new_products = tep_db_num_rows($new_products_query)) > 0) {
  while ($_new_products = tep_db_fetch_array($new_products_query)) {
$new_products[] = $_new_products;
$list_of_prdct_ids[] = $_new_products['products_id'];
}

$select_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' ";
 if ($no_of_new_products > 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 customers_group_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."' and customers_group_price != null");
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' => '');
}

  for ($x = 0; $x < $no_of_new_products; $x++) {
// replace products prices with those from customers_group table
    if(!empty($new_prices)) {
     for ($i = 0; $i < count($new_prices); $i++) {
	     if( $new_products[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
		     $new_products[$x]['products_price'] = $new_prices[$i]['products_price'];
	     }
     }
   } // end if(!empty($new_prices)
  } // end for ($x = 0; $x < $no_of_products_new; $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'], 'specials_new_products_price' => $specials_array['specials_new_products_price']);
}

// replace products_price with the correct specials_new_products_price
if(!empty($new_s_prices)) {
for ($x = 0; $x < $no_of_new_products; $x++) {
   for ($i = 0; $i < count($new_s_prices); $i++) {
     if( $new_products[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) {
       $new_products[$x]['products_price'] = $new_s_prices[$i]['specials_new_products_price'];
     }
   }
 }
} // // end if(!empty($new_s_prices)

 $row = 0;
 $col = 0;

 $info_box_contents = array();

//  while ($new_products = tep_db_fetch_array($new_products_query)) {
for ($x = 0; $x < $no_of_new_products; $x++) {
   $info_box_contents[$row][$col] = array('align' => 'center',
                                          'params' => 'class="smallText" width="33%" valign="top"',
                                          'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products[$x]['products_image'], $new_products[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products[$x]['products_id']) . '">' . $new_products[$x]['products_name'] . '</a><br>' . $currencies->display_price($new_products[$x]['products_price'], tep_get_tax_rate($new_products[$x]['products_tax_class_id'])));

   $col ++;
   if ($col > 2) {
     $col = 0;
     $row ++;
   }
  } // end for ($x = 0; $x < $no_of_new_products; $x++)
} //  end if (($no_of_new_products = tep_db_num_rows($new_products_query)) > 0)
// EOF Separate Pricing Per Customer
new contentBox($info_box_contents);
?>
<!-- new_products_eof //-->

Link to comment
Share on other sites

Well, I the only thing I see as out of place is your call to check the customer ID is after your new products query, rather than before. Move this block of code:

if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
// BOF Separate Pricing Per Customer
$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
} else {
$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on pd.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c using(categories_id) where c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
}

 

After this block:

// global variable (session) $sppc_customer_group_id -> local variable customer_group_id

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

 

I did notice that my $pg_query ends a little bit differently from yours. Mine has this at the end:

pg.customers_group_id = '".$customer_group_id."' and customers_group_price != null");

 

I don't know if that would make a difference or not - but maybe if you haven't entered a price for that specific customer group it would make a difference since it makes sure the price isn't null :huh:

 

Let me know if moving that new products query helps any ;)

 

 

This is the code: /includes/modules/new_products.php

~Tracy
 

Link to comment
Share on other sites

I have check the code and it's correct. :(

Are you sure your shop actually uses this particular module? If you use a template it might be a featured products module. I agree the code looks fine so it is hard to imagine why this suddenly would fail.

Link to comment
Share on other sites

Are you sure your shop actually uses this particular module? If you use a template it might be a featured products module. I agree the code looks fine so it is hard to imagine why this suddenly would fail.

 

Hi Jan,

yes, may shop actually uses this module. I don't use any template. I have modified the CSS files only.

 

This the code in catalog/products_new.php

 

<?php
/*
 $Id: products_new.php 1739 2007-12-20 00:52:16Z hpdl $
 adapted for Separate Pricing Per Customer v4.2 2007/06/23, adapted for QPBPP for SPPC v2.0 2008/11/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_PRODUCTS_NEW);

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRODUCTS_NEW));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<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; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" 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_products_new.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
 $products_new_array = array();

 $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";
 $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW);

 if (($products_new_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 $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td>
           <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $products_new_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">
<?php
 if ($products_new_split->number_of_rows > 0) {
// BOF Separate Pricing Per Customer
//  global variable (session): $sppc_customers_group_id -> local variable $customer_group_id
 if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
   $customer_group_id = $_SESSION['sppc_customer_group_id'];
 } else {
   $customer_group_id = '0';
 }

   $products_new_query = tep_db_query($products_new_split->sql_query);
   $no_of_products_new = tep_db_num_rows($products_new_query);
   while ($_products_new = tep_db_fetch_array($products_new_query)) {
 	  $products_new[] = $_products_new;
    $list_of_prdct_ids[] = $_products_new['products_id'];
   }

 $select_list_of_prdct_ids = "products_id = '" . $list_of_prdct_ids[0] . "' ";
  if ($no_of_products_new > 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 customers_group_prices for products with the particular customer_group_id
// however not necessary for customer_group_id zero
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 . "' and customers_group_price != null");
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' => '');
}

  for ($x = 0; $x < $no_of_products_new; $x++) {
// replace products prices with those from customers_group table
// originally they would be obtained with an extra query for every new product:
//   if ($new_price = tep_get_products_special_price($products_new['products_id'])) {

    if (!empty($new_prices)) {
      for ($i = 0; $i < count($new_prices); $i++) {
        if ($products_new[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
          $products_new[$x]['products_price'] = $new_prices[$i]['products_price'];
        }
      }
   } // end if (!empty($new_prices)
  } // end for ($x = 0; $x < $no_of_products_new; $x++)
} // end if ($customer_group_id != '0')

// an extra query is needed for all the specials

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

// replace specials_new_products_price with those those for the customers_group_id
for ($x = 0; $x < $no_of_products_new; $x++) {

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

if (tep_not_null($products_new[$x]['specials_new_products_price'])) {
        $products_price = '<s>' . $currencies->display_price($products_new[$x]['products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($products_new[$x]['specials_new_products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id'])) . '</span>';
     } else {
	$products_price = $currencies->display_price($products_new[$x]['products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id']));
     }
?>
         <tr>
           <td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $products_new[$x]['products_image'], $products_new[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td>
           <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new[$x]['products_id']) . '"><b><u>' . $products_new[$x]['products_name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . tep_date_long($products_new[$x]['products_date_added']) . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new[$x]['manufacturers_name'] . '<br><br>' . TEXT_PRICE . ' ' . $products_price; ?></td>
           <td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new[$x]['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>
         </tr>
         <tr>
           <td colspan="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
<?php // EOF Separate Pricing Per Customer
  } // end for ($x = 0; $x < $no_of_products_new; $x++)
 } else {

?>
         <tr>
           <td class="main"><?php echo TEXT_NO_NEW_PRODUCTS; ?></td>
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
<?php
 }
?>
       </table></td>
     </tr>
<?php
 if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="smallText"><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td>
           <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $products_new_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; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" 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'); ?>

 

This is the code in catalog/includes/modules/new_products.php

 

<?php
/*
 $Id: new_products.php 1806 2008-01-11 22:48:15Z hpdl $
 adapted for Separate Pricing Per Customer v4.2 2008/07/13

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

 Copyright (c) 2008 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- new_products //-->
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));

 new contentBoxHeading($info_box_contents);

 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
   // BOF Separate Pricing Per Customer
   $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } else {
   $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on pd.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c using(categories_id) where c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

// global variable (session) $sppc_customer_group_id -> local variable customer_group_id

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

 if (($no_of_new_products = tep_db_num_rows($new_products_query)) > 0) {
  while ($_new_products = tep_db_fetch_array($new_products_query)) {
$new_products[] = $_new_products;
$list_of_prdct_ids[] = $_new_products['products_id'];
}

$select_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' ";
 if ($no_of_new_products > 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 customers_group_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."' and customers_group_price != null");
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' => '');
}

  for ($x = 0; $x < $no_of_new_products; $x++) {
// replace products prices with those from customers_group table
    if(!empty($new_prices)) {
     for ($i = 0; $i < count($new_prices); $i++) {
	     if( $new_products[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
		     $new_products[$x]['products_price'] = $new_prices[$i]['products_price'];
	     }
     }
   } // end if(!empty($new_prices)
  } // end for ($x = 0; $x < $no_of_products_new; $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'], 'specials_new_products_price' => $specials_array['specials_new_products_price']);
}

// replace products_price with the correct specials_new_products_price
if(!empty($new_s_prices)) {
for ($x = 0; $x < $no_of_new_products; $x++) {
   for ($i = 0; $i < count($new_s_prices); $i++) {
     if( $new_products[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) {
       $new_products[$x]['products_price'] = $new_s_prices[$i]['specials_new_products_price'];
     }
   }
 }
} // // end if(!empty($new_s_prices)

 $row = 0;
 $col = 0;

 $info_box_contents = array();

//  while ($new_products = tep_db_fetch_array($new_products_query)) {
for ($x = 0; $x < $no_of_new_products; $x++) {
   $info_box_contents[$row][$col] = array('align' => 'center',
                                          'params' => 'class="smallText" width="33%" valign="top"',
                                          'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products[$x]['products_image'], $new_products[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products[$x]['products_id']) . '">' . $new_products[$x]['products_name'] . '</a><br>' . $currencies->display_price($new_products[$x]['products_price'], tep_get_tax_rate($new_products[$x]['products_tax_class_id'])));

   $col ++;
   if ($col > 2) {
     $col = 0;
     $row ++;
   }
  } // end for ($x = 0; $x < $no_of_new_products; $x++)
} //  end if (($no_of_new_products = tep_db_num_rows($new_products_query)) > 0)
// EOF Separate Pricing Per Customer
new contentBox($info_box_contents);
?>
<!-- new_products_eof //-->

Link to comment
Share on other sites

  • 3 weeks later...

All, I uploaded a new version of Seperate Pricing Per Customer.

Some bug fixes I found when installing on my new copy of 2.2MS2 and a MAJOR OPTIONAL improvement -- I needed the functionality of having special prices for each group.

 

I think all the code is good -- I have spent the day testing. If you find something doesn't work on your install, or perhaps I missed something, let me know. (email: scott AT everson D0T ws)

 

Here are the notes:

 

Updated by Scott Everson (scott AT everson DOT ws), 08/02/2003

 

Bug fixes:

 

-Added in mod to products_new.php (so correct price displayed in new products list)

-Adjusted location of mod in modules/product_listing.php

-Changed $product_info_values[] to $product_info[] in product_info.php mod. My 2.2MS2 used the $product_info[] array.

 

Improvements:

 

-Added option mod to support special prices per group. This means that you can create a special price for your 'Retail' group and only customers in that group will see the special price. Create a special price for your 'Wholesale' group and only customers in that group will see the special price. Special prices will not default.. meaning if there is no special price for 'Wholesale' but there is one for 'Retail' your wholesale customer will NOT BE SHOWN the retail special price.

 

More info: When you add special prices, you will see the prices for each group next to the product title. It a price/group is missing, it is because a special price for that prodcut/group already exists. If the product is missing, it is because there is already a special price for all groups.

 

I am willing to offer support for this MOD and version 2.2MS2.

Hello: I have recently installed SPPC to my osCommerce version 2.2MS2 and I am having a problem or two. First of all, I have the USPS module installed as well as the QBI module. The main problem that I am having is when I try to access "MY Account" on the shopping cart. I receive the error message:

 

1054 - Unknown column 's.public_flag' in 'where clause'

select count(*) as total from orders o, orders_status s where o.customers_id = '2' and o.orders_status = s.orders_status_id and s.language_id = '1' and s.public_flag = '1'

 

[TEP STOP]

 

Can someone help me with this. Thanks in advance.

Link to comment
Share on other sites

Luis. Best regards from Spain.

 

Sorry for the quuestion if is not for you.

 

Your have you a module to be able to have different prices for different customer groups?

 

If it is like that and you can indicate me like I can obtain it I will be grateful for it to you enormously.

 

Thank you.

Link to comment
Share on other sites

I installed Quantity Price Breaks V2.0. Everything works, but I would like to change the visual placement of the price break table from the top of the product page down to above the add to cart button. The table interferes too much with the product title where is currently is located. Where do I find the file that defines where the price break table is placed on the products page??? Thanks much!

Link to comment
Share on other sites

The Separate Pricing Per Customer contribution does just that and is downloadable from here:

http://addons.oscommerce.com/info/716

 

Luis. Best regards from Spain.

 

Sorry for the quuestion if is not for you.

 

Your have you a module to be able to have different prices for different customer groups?

 

If it is like that and you can indicate me like I can obtain it I will be grateful for it to you enormously.

 

Thank you.

~Tracy
 

Link to comment
Share on other sites

You can change where it is included on the catalog/product_info.php page (depending on what other contributions you may have installed). My add to cart button is located on this page - but with my other contributions I sometimes need to also modify pages in the catalog/includes/modules folder.

 

I installed Quantity Price Breaks V2.0. Everything works, but I would like to change the visual placement of the price break table from the top of the product page down to above the add to cart button. The table interferes too much with the product title where is currently is located. Where do I find the file that defines where the price break table is placed on the products page??? Thanks much!

~Tracy
 

Link to comment
Share on other sites

You can change where it is included on the catalog/product_info.php page (depending on what other contributions you may have installed). My add to cart button is located on this page - but with my other contributions I sometimes need to also modify pages in the catalog/includes/modules folder.

 

Thanks! I finally figured it out and was able to change the placement of the table. Perfect!

Link to comment
Share on other sites

  • 2 weeks later...

hi jan,

 

i have a problem with this contribution. i've set a minimum order-quatity of 30 to a product. in product_info.php there is already 30 typed in. if i change this, i.e. to 10, the cart doesnt update the quantity automaticly. the shopping_cart.php shows the message, that the cart is update to the minimum quantity of 30, but still on 10... only if the customer updates the cart (usually nobody do this) the quantity increase.

 

i've a local copy of my store, where it works perfectly. when i uplad the files, the problem is not fixed.

 

i know, that are few informations, but maybe i've heard of this problem already a can give me a hint :)

Edited by eFFeKt
Link to comment
Share on other sites

i have a problem with this contribution. i've set a minimum order-quatity of 30 to a product. in product_info.php there is already 30 typed in. if i change this, i.e. to 10, the cart doesnt update the quantity automaticly. the shopping_cart.php shows the message, that the cart is update to the minimum quantity of 30, but still on 10... only if the customer updates the cart (usually nobody do this) the quantity increase.

 

i've a local copy of my store, where it works perfectly. when i uplad the files, the problem is not fixed.

That's indeed a problem. The fact that you get the message that the cart is updated to the minimum quantity indicates that the class shopping_cart (function add_cart), and the class PriceFormatter (function adjustQty) seem to do their job.

 

Unfortunately, I can't reproduce the error either.

Link to comment
Share on other sites

That's indeed a problem. The fact that you get the message that the cart is updated to the minimum quantity indicates that the class shopping_cart (function add_cart), and the class PriceFormatter (function adjustQty) seem to do their job.

 

Unfortunately, I can't reproduce the error either.

 

hi jan, thanks for your reply. i figured out what the problem was. i've imported some new products with easypopulate and changed one pricebreak with phpmyadmin. everything was set correctly (i've double-checked all necessary fields), but, dont ask me why, as soon as i change/add any pricebreak in phpmyadmin the failure appears. now everything works fine. i flew off the handle checking the files of my shop till i totally frustrated cleared all databasefileds with phpmyadmin.

 

nevertheless, thank you very much for your commitment!

Link to comment
Share on other sites

I am looking for a modification for sppc or a contribution if it exists to automatically add a new customer (once they register) to my store that will automatically assign them to one of my customer groups (sppc) based on their ship-to state.

 

Is there anyway to customize your customer groups to be applied if the customer falls in a particular state?

 

Example:

Customer group #1 = for customers located in NY, NJ, NH, MA, CT

Customer group #2 = for customers located in IN, IL, OH, PA, WV, VA, NC, SC

etc....

Link to comment
Share on other sites

Is there anyway to customize your customer groups to be applied if the customer falls in a particular state?

On the basis of the $zone_id you can make a decison in which customer group they should fall in create_account.php. Similar code on this topic is somewhere in this thread.

Link to comment
Share on other sites

Hi,

 

Have installed this contribution and its working great. But have also decided that I needed to display an RRP or MSRP for my store, and the savings the customer gets.

 

Is there any easy way of doing this?

 

I have found another contribution called Display MSRP & Savings but had trouble getting it to work with SPPC.

Link to comment
Share on other sites

Help

I get with "Separate Pricing Per Customer 4.2.2" by using sp-auto installer error in admin in:

TEXT_DISPLAY_NUMBER_OF_CUSTOMERS_GROUPS like this:

gerenal.php ... array in line 112

 

this is only for clean install? there is no autoinstall for modifed shops ?

Link to comment
Share on other sites

this is only for clean install? there is no autoinstall for modifed shops ?

No. There is no automation possible for that. Semi-autormatic software like diff and merge programs can show you where it can't do a merge in a file and do those where it could, but the problematic merges have to be done by hand.

Link to comment
Share on other sites

No. There is no automation possible for that. Semi-autormatic software like diff and merge programs can show you where it can't do a merge in a file and do those where it could, but the problematic merges have to be done by hand.

 

thanks,

but how can apart article of the normal shop in other/easer way?

Link to comment
Share on other sites

Luis. Best regards.

 

I have modified the clients table and that of special prices (specials) in order that every client has a tariff of prices and the special price is applied according to this tariff to every client.

 

The clients who do not register have the recommended retail price.

 

If some people send me her email I can send.

 

Bye.

 

Luis Llaberia

Slave Computer

[email protected]

Link to comment
Share on other sites

On the basis of the $zone_id you can make a decison in which customer group they should fall in create_account.php. Similar code on this topic is somewhere in this thread.

 

 

Thanks, so I would be able to have the new registered customer automatically be applied to one of my customer groups based on their zone/state location? How can I do this? I am sorry I just need a little direction as to what to edit and with what. Thanks so much for your reply and any help with this.

Link to comment
Share on other sites

Thanks, so I would be able to have the new registered customer automatically be applied to one of my customer groups based on their zone/state location? How can I do this? I am sorry I just need a little direction as to what to edit and with what. Thanks so much for your reply and any help with this.

Here a couple of post where this was discussed: post 1 and post 2.

Link to comment
Share on other sites

Hey,

 

I've mixed the contibutions 'separate_price_per_customers_4.2.2' and 'products_aec_with_attributes V0.31'

After editing (or without edit anything) a product

I recieve this at site: ../admin/categories.php?cPath=21&pID=28&action=new_product_preview

 

Warning: stripslashes() expects parameter 1 to be string, array given in ..\admin\categories.php on line 937

 

Here is the code

933        while (list($key, $value) = each($HTTP_POST_VARS)) {
934  // BOF Separate Pricing per Customer
935          if (is_array($value)) {
936            while (list($k, $v) = each($value)) {
937            echo tep_draw_hidden_field($key . '[' . $k . ']', htmlspecialchars(stripslashes($v)));
938            }
939          } else {
940  // EOF Separate Pricing per Customer
941             echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));

 

Has anyone else had this problem, if so please let me know what I need to change.

 

thanks

Link to comment
Share on other sites

Hey,

 

I've mixed the contibutions 'separate_price_per_customers_4.2.2' and 'products_aec_with_attributes V0.31'

After editing (or without edit anything) a product

I recieve this at site: ../admin/categories.php?cPath=21&pID=28&action=new_product_preview

 

Warning: stripslashes() expects parameter 1 to be string, array given in ..\admin\categories.php on line 937

I'm not familiar with the other contribution but this code (which shouldn't give a problem in any shop if used like this) was used in Quantity Price Breaks for SPPC where arrays in arrays are used:

     while (list($key, $value) = each($HTTP_POST_VARS)) {
// BOF Separate Pricing per Customer adapted for QPBPP for SPPC
       if (is_array($value)) {
         while (list($k, $v) = each($value)) {
           if (is_array($v)) {
             foreach ($v as $subkey => $subvalue) {
               echo tep_draw_hidden_field($key . '[' . $k . '][' . $subkey . ']', htmlspecialchars(stripslashes($subvalue)));
             }
           } else {
             echo tep_draw_hidden_field($key . '[' . $k . ']', htmlspecialchars(stripslashes($v)));
           }
         }
       } else {
// EOF Separate Pricing per Customer
         echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
       }
     }

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.
Note: Your post will require moderator approval before it will be visible.

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

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...