Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

Thanks for answering :)

 

is it possible to fix it for sql 4?

 

but i already used the contribution for my wholesale. i don want to loose my wholesale prices :(

 

what can i do? :huh:

Link to comment
Share on other sites

Thanks for answering :)

 

is it possible to fix it for sql 4?

 

but i already used the contribution for my wholesale. i don want to loose my wholesale prices :(

 

what can i do? :huh:

 

You do not have to use the new database. I had the same problem when my webhost went to MySQL 5. You should be able to backup your db and after you load up the new db, just drop in you backup and everything should be back. Hope that works for you!

Link to comment
Share on other sites

thanks for your help but it was not the sql-database.

i found the mistake.

 

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

have to be deleted.

Link to comment
Share on other sites

I just installed version 4.1 and it seems to be running fine after I worked a few problems. One thing I noticed though, is that my "New Products" section is now empty. Anybody know why the items would disappear from that box after the install? Thanks

Link to comment
Share on other sites

Uh oh. I have an even bigger problem than my last (although I still need a solution for it).

 

When I go into the customers section in admin to assign a customer to a group, the group switches back to "retail" after I hit update. The special pricing isn't coming up because of this of course.

 

Thanks

Link to comment
Share on other sites

Hi Guys,

 

After beating myself about the head for a while, I finally decided to ask for help (again, I here you say!)

 

I am trying to get my right column to only display certain boxes to certain customer groups. Now the way I have my groups is

 

Retail id = 0

Trade id = 1

 

So surely this code below should work (in my flawed theory anyway lol)

 

if ($customers_group_id = '0') {

 include(DIR_WS_BOXES . 'best_sellers.php');
 require(DIR_WS_BOXES . 'whats_new.php');
 include(DIR_WS_BOXES . 'specials.php');

 }else if ($customers_group_id = '1') {

 include(DIR_WS_BOXES . 'specials.php');

 }

 

Any ideas?

 

Thanks

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

So surely this code below should work (in my flawed theory anyway lol)
Two flaws: use == (is equal to) instead of = (assign) and it is not certain that the variable $customers_group_id is set (might be because of the rest of the code, but you never know). Simplest is to use the session variables straight away:

 

if ($_SESSION['sppc_customer_group_id'] == '0') {

 include(DIR_WS_BOXES . 'best_sellers.php');
 require(DIR_WS_BOXES . 'whats_new.php');
 include(DIR_WS_BOXES . 'specials.php');

 } else if ($_SESSION['sppc_customer_group_id'] == '1') {

 include(DIR_WS_BOXES . 'specials.php');

 }

Link to comment
Share on other sites

Hi Jan,

 

Thanks for replying.

 

Unfortunately that code completely wipes out the right colum for the retail customers.

 

Any other thoughts on what could be causing the problem.

 

Thanks

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

Unfortunately that code completely wipes out the right colum for the retail customers.
True, because when the retail customer is not logged-in that session is not set. So the first line of code should have been:

if ($_SESSION['sppc_customer_group_id'] == '0' || !isset($_SESSION['sppc_customer_group_id'])) {

Link to comment
Share on other sites

But, I just had one problem.

I were also install the "featured_products_v1.5.2".The file named catalog\featured_products.php can't show the right price.

catalog\featured_products.php code just as below:

I haven't tested this, so I can't assure there are no small mistakes in it, but I did my best. The file is adapted from featured products 1.5.5 but looks very similar to your 1.5.2.

<?php
/*
 $Id: featured_products.php,v 1.27 2003/06/09 22:35:33 hpdl Exp $
 adapted for Separate Pricing Pricing Per Customer 2006/02/25

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

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_FEATURED_PRODUCTS));
?>
<!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
///// To random featured products
//  list($usec, $sec) = explode(' ', microtime());
//  srand( (float) $sec + ((float) $usec * 100000) );
//  $mtm= rand();
//////  
  $featured_products_array = array();
  // query changed for SPPC: NULL as specials_new_products_price, joining with table specials removed
			$featured_products_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, NULL as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by p.products_date_added DESC, pd.products_name";
// to random//  $featured_products_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, NULL as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by rand($mtm)";
  $featured_products_split = new splitPageResults($featured_products_query_raw, MAX_DISPLAY_FEATURED_PRODUCTS);

 if (($featured_products_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 $featured_products_split->display_count(TEXT_DISPLAY_NUMBER_OF_FEATURED_PRODUCTS); ?> </td>
		<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $featured_products_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> <!-- Featured Products Main Page Box -->
	 <table bgcolor="ffffff" border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
 if ($featured_products_split->number_of_rows > 0) {
$featured_products_query = tep_db_query($featured_products_split->sql_query);
// 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;
 }

 if (($no_of_products = tep_db_num_rows($featured_products_query)) > 0) {
  while ($_featured_products = tep_db_fetch_array($featured_products_query)) {
$featured_products[] = $_featured_products;
$list_of_prdct_ids[] = $_featured_products['products_id'];
} 

  $select_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' ";
  if ($no_of_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."'");
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; $x++) {
// replace products prices with those from customers_group table
	if(!empty($new_prices)) {
	for ($i = 0; $i < count($new_prices); $i++) {
		if( $featured_products[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
		$featured_products[$x]['products_price'] = $new_prices[$i]['products_price'];
		}
	}
} // end if(!empty($new_prices)
  } // end for ($x = 0; $x < $no_of_products; $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 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_products; $x++) { 
	for ($i = 0; $i < count($new_s_prices); $i++) {
		if( $featured_products[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) {
		$featured_products[$x]['specials_new_products_price'] = $new_s_prices[$i]['specials_new_products_price'];
		}
	   }
   } 
} // // end if(!empty($new_s_prices)

//	while ($featured_products = tep_db_fetch_array($featured_products_query)) {
for ($x = 0; $x < $no_of_products; $x++) {
  if ( !tep_not_null($featured_products[$x]['specials_new_products_price']) ) {
	$products_price = '<s>' . $currencies->display_price($featured_products[$x]['products_price'], tep_get_tax_rate($featured_products[$x]['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($featured_products[$x]['specials_new_products_price'], tep_get_tax_rate($featured_products[$x]['products_tax_class_id'])) . '</span>';
  } else {
	$products_price = $currencies->display_price($featured_products[$x]['products_price'], tep_get_tax_rate($featured_products[$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=' . $featured_products[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products[$x]['products_image'], $featured_products[$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=' . $featured_products[$x]['products_id']) . '"><b><u>' . $featured_products[$x]['products_name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . tep_date_long($featured_products[$x]['products_date_added']) . '<br>' . TEXT_MANUFACTURER . ' ' . $featured_products[$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_FEATURED_PRODUCTS, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products[$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
}
 } 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 (($featured_products_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 $featured_products_split->display_count(TEXT_DISPLAY_NUMBER_OF_FEATURED_PRODUCTS); ?></td>
		<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $featured_products_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'); ?>

Link to comment
Share on other sites

I haven't tested this, so I can't assure there are no small mistakes in it, but I did my best. The file is adapted from featured products 1.5.5 but looks very similar to your 1.5.2.

 

Dear JanZ:

Thanks for your reply. With the help of your reply, I finally solved the problem.

thank you very very much.

 

Sophina

Link to comment
Share on other sites

OK, I've tried and tried, but for the life of me I can't get this to work

 

My retail page shows

 

Wholesale : $8.00

 

 

My wholepage shows

 

 

Retail : $8.00

Wholesale : $12.00

 

I also use rewards points, they are now adding up in regards to these -intermix figures.

 

 

I've gone into the code and changed the setting, enough that one side will display properly, but then the other side doesn't.

 

I'd really appreciate it if someone could help me with this, I've been up all night with the sotre in maint mode until I can get this fixed.

 

Here is my code

 

<?php

/*

$Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $

adapted for Separate Pricing Per Customer v4 and Price Break 1.11.3 2005/03/12

 

adapted for Separate Pricing Per Customer v4.1, Hide products from groups mod 2005/03/28

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);

 

// 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;

}

 

$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 . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 ");

$product_check = tep_db_fetch_array($product_check_query);

// EOF Separate Pricing Per Customer

 

?>

<!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 href="http://www.memorylaneprimitives.com/favicon.ico" rel="shortcut icon">

<link type="text/css" rel="stylesheet" href="http://www.memorylaneprimitives.com/css/memorylaneprimitives.css">

<link type="text/css" rel="stylesheet" href="http://www.memorylaneprimitives.com/css/MLPnavcontainer.css">

<link type="text/css" rel="stylesheet" href="http://www.memorylaneprimitives.com/catalog/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">

 

 

<!-- body //-->

<center>

<table style="background-color: rgb(249, 250, 245); text-align: left; margin-left: auto; margin-right: auto; width: 750px;" class="solid" border="0" cellpadding="0" cellspacing="0">

<tbody>

<tr>

<td style="background-image: url(http://www.memorylaneprimitives.com/images/MLPlogo.jpg); height: 188px; text-align: center; vertical-align: middle; width: 750px;"></td>

</tr>

<tr>

<td style="background-image: url(http://www.memorylaneprimitives.com/images/MLP_2.jpg); height: 20px; padding-left: 15px; padding-right: 15px; padding-top: 2px; width: 750px;"><div align="center">

 

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

</div></td>

</tr>

<tr>

<td style="background-image: url(http://www.memorylaneprimitives.com/images/MLP_3.jpg); height: 28px; padding-left: 15px; padding-right: 15px; padding-top: 2px; width: 750px;"></td>

</tr>

<tr>

<td style="background-image: url(http://www.memorylaneprimitives.com/images/MLP_4.jpg); width: 750px;">

<table align="center" border="0" cellpadding="0" cellspacing="0" width="750">

<tbody>

<tr>

<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"><?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">

<?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 {

 

 

 

 

 

// BOF Show price list for SPPC 4.1

/* Original SPPC 4.1 code

 

$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 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'])) {

 

// BOF Separate Price per Customer

$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id = '" . $customer_group_id . "'");

if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {

$product_info['products_price']= $scustomer_group_price['customers_group_price'];

}

// EOF Separate Price per Customer

 

$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 {

 

// BOF Separate Price per Customer

$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id = '" . $customer_group_id . "'");

if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {

$product_info['products_price']= $scustomer_group_price['customers_group_price'];

}

// EOF Separate Price per Customer

 

$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

}

 

*/

 

$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_price as list_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id 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'])) {

// BOF Separate Price per Customer

 

$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id = '" . $customer_group_id . "'");

if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {

$product_info['products_price']= $scustomer_group_price['customers_group_price'];

}

 

$products_price = '';

if ($customer_group_id != '0') {

$products_price = '<span class="header">' . SHOW_PRICE_LIST;

$products_price .= $currencies->display_price($product_info['list_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

$products_price .= '</span><br>'; // customer group prices on the next line end of small text for retail prices

}

$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>';

// EOF Separate Price per Customer

} else {

// BOF Separate Price per Customer

$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id = '" . $customer_group_id . "'");

if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {

$product_info['products_price']= $scustomer_group_price['customers_group_price'];

}

$products_price = '';

if ($customer_group_id != '0') {

$products_price = '<span class="header">' . SHOW_PRICE_LIST;

$products_price .= $currencies->display_price($product_info['list_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

$products_price .= '</span><br>'; // customer group prices on the next line end of small text for retail prices

}

$products_price .= SHOW_YOUR_PRICE ;

$products_price .= $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

// EOF Separate Price per Customer

}

 

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>

 

</tr><tr>

 

<td class="pageHeading" valign="top"><h2><BR><?php echo $products_price; ?></h2></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '1'); ?></td>

</tr>

<tr>

<td class="main">

<?php

if (tep_not_null($product_info['products_image'])) {

?>

<table border="0" cellspacing="0" cellpadding="3" 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

}

?>

<!-- Points/Rewards Module V1.60 show_points_info bof -->

<?php

if ((USE_POINTS_SYSTEM == 'true') && (DISPLAY_POINTS_INFO == 'true')) { // check that the points system is enabled

if ($new_price = tep_get_products_special_price($product_info['products_id'])) {

$products_price_points = tep_display_points($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

} else {

$products_price_points = tep_display_points($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

}

$products_points = tep_calc_products_price_points($products_price_points);

$products_points_value = tep_calc_price_pvalue($products_points);

if (USE_POINTS_FOR_SPECIALS == 'true' || $new_price == false){

?>

<p><?php echo sprintf(TEXT_PRODUCT_POINTS , $products_points) .TEXT_PRODUCT_POINTS_VALUE . $currencies->format($products_points_value); ?></p>

<?php

} else {

?>

<p><?php echo TEXT_PRODUCT_NO_POINTS; ?></p>

<?php

}

}// else do not show points_value

?>

<!-- Points/Rewards Module V1.60 show_points_info eof -->

<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

}

 

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 tep_draw_separator('pixel_trans.gif', '10', '45'); ?><?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>

<!-- BOF price-break-1.11.3 <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 class="main" align="right">

<table border="0" align="right">

<tr><td align="center">

<?php echo TEXT_ENTER_QUANTITY . ":" . tep_draw_input_field('cart_quantity', $pf->adjustQty(1), 'size="6"'); ?>

</td></tr>

<tr><td align="center">

<?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?>

</td></tr>

</table>

</td> <!-- EOF price-break-1.11.3 -->

<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></form></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>

 

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

</tr>

</tbody>

</td>

</tr>

<tr>

<td style="background-image: url(http://www.memorylaneprimitives.com/images/MLP_5.jpg); height: 28px; width: 750px; text-align: center;"> </td>

</tr>

<tr>

<td style="padding: 2px 15px 13px; background-image: url(http://www.memorylaneprimitives.com/images/MLP_6.jpg); height: 37px; width: 750px;"> </td>

</tr>

</tbody>

</table>

</center>

</body>

</html>

 

 

Thank you

Henry

My Contributions

 

Henry Smith

Link to comment
Share on other sites

As a test I have cut and paste the code directtly from the the install readme file and still zilch!
The code looks fine to me. You don't happen to have the wholesale customers as "0" and your retail as "1"? That would explain it.

 

Retail should always be zero. Just rename the groups in admin (customer_groups.php) in that case.

Link to comment
Share on other sites

Hello,

 

I'm having a problem with this contributions when I try to add the contribution "Account create in admin" (http://www.oscommerce.com/community/contributions,1644/category,all/search,Account+create+in+admin)....

 

It's showing this error when I click insert:

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /mnt/sites/all4bar.com/web/admin/includes/classes/object_info.php on line 17

 

Warning: Variable passed to each() is not an array or object in /mnt/sites/all4bar.com/web/admin/includes/classes/object_info.php on line 18

 

I tried to debug it, and figure it out the problem occurs in this line, because it's not getting the 'cID' and it's having the error on the $cInfo = new objectInfo($customers);:

 

//#CHAVEIRO6# Step order/customer begin

if ($action != 'new') {

 

//#CHAVEIRO6# Step order/customer end

// BOF Separate Pricing Per Customer

$customers_query = tep_db_query("select c.customers_id, c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, a.entry_company, a.entry_company_tax_id, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, c.customers_telephone, c.customers_fax, c.customers_newsletter, c.customers_group_id, c.customers_group_ra, c.customers_payment_allowed, c.customers_shipment_allowed, c.customers_default_address_id from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_default_address_id = a.address_book_id where a.customers_id = c.customers_id and c.customers_id = '" . (int)$HTTP_GET_VARS['cID'] . "'");

 

$module_directory = DIR_FS_CATALOG_MODULES . 'payment/';

$ship_module_directory = DIR_FS_CATALOG_MODULES . 'shipping/';

 

$file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));

$directory_array = array();

if ($dir = @dir($module_directory)) {

while ($file = $dir->read()) {

if (!is_dir($module_directory . $file)) {

if (substr($file, strrpos($file, '.')) == $file_extension) {

$directory_array[] = $file; // array of all the payment modules present in includes/modules/payment

}

}

}

sort($directory_array);

$dir->close();

}

 

$ship_directory_array = array();

if ($dir = @dir($ship_module_directory)) {

while ($file = $dir->read()) {

if (!is_dir($ship_module_directory . $file)) {

if (substr($file, strrpos($file, '.')) == $file_extension) {

$ship_directory_array[] = $file; // array of all shipping modules present in includes/modules/shipping

}

}

}

sort($ship_directory_array);

$dir->close();

}

 

$existing_customers_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id ");

 

// EOF Separate Pricing Per Customer

 

$customers = tep_db_fetch_array($customers_query);

$cInfo = new objectInfo($customers);

 

 

// BOF Separate Pricing Per Customer

// $shipment_allowed = explode (";",$cInfo->customers_shipment_allowed);

// EOF Separate Pricing Per Customer

 

//#CHAVEIRO6# Step order/customer begin

}

//#CHAVEIRO6# Step order/customer end

 

 

I really appreciate some light!

 

Thanks a lot

 

Elisa Alexandra

Link to comment
Share on other sites

The code looks fine to me. You don't happen to have the wholesale customers as "0" and your retail as "1"? That would explain it.

 

Retail should always be zero. Just rename the groups in admin (customer_groups.php) in that case.

 

Wow, what a nightmare. Going on 36 hours of awake time.. java script:emoticon(":'(",

smilie

 

Anyway, it's fixed. It wasn't me or the code. Both drove me crazy as I consdier myself quite proficient in this area. Turns out, while I assume this happened during the testing phase of OC, that Whole in the group_id got set to 3 and not 1, additionally. Which I also assume is why I needed to 'play' with the code the first time I installed, but evidently it was only a bandaid and not the cure.

 

I tried removing the Wholesale Group and readding... which only fixed the price issuce, all products also had the code group price related to the original group_id 3.

 

In the end my fix was - group the group ID wholesale. I didn't want to lose the customers supplied TAX ID # so I ran part of the uninstall

 

ALTER TABLE customers

DROP customers_group_id,

DROP customers_group_ra,

DROP customers_payment_allowed,

DROP customers_shipment_allowed;

 

DROP TABLE IF EXISTS customers_groups;

 

ALTER TABLE specials

DROP customers_group_id;

 

and then part of the reinstall

 

ALTER TABLE customers

ADD customers_group_id smallint UNSIGNED NOT NULL default '0',

ADD customers_group_ra enum('0','1') NOT NULL,

ADD customers_payment_allowed varchar(255) NOT NULL default '',

ADD customers_shipment_allowed varchar(255) NOT NULL default '';

 

ALTER TABLE specials

ADD customers_group_id smallint UNSIGNED NOT NULL default '0';

 

DROP TABLE IF EXISTS customers_groups;

CREATE TABLE customers_groups (

customers_group_id smallint UNSIGNED NOT NULL,

customers_group_name varchar(32) NOT NULL default '',

customers_group_show_tax enum('1','0') NOT NULL,

customers_group_tax_exempt enum('0','1') NOT NULL,

group_payment_allowed varchar(255) NOT NULL default '',

group_shipment_allowed varchar(255) NOT NULL default '',

PRIMARY KEY (customers_group_id)

);

 

INSERT INTO customers_groups VALUES('0','Retail','1','0','','');

 

 

So that I could preserver the TAX ID.

 

Bad News - I'm so tried that I wasn't thinking about the products themselves, only having it displayed properly.... so I lost all my wholesale price values, qnty discount rates.. etc...

 

Thanks for the quick replay Janz, at least the confirmed my belief that it wasn't in my modification with installing contrib.

 

Henry

My Contributions

 

Henry Smith

Link to comment
Share on other sites

Bad News - I'm so tired that I wasn't thinking about the products themselves, only having it displayed properly.... so I lost all my wholesale price values, qnty discount rates.. etc...
Wouldn't that be a matter of running something like update product_groups set customers_group_id = '1' where customers_group_id = '3'; (after having made sure there are no products with customers_group_id = 1 in that table: delete from products_group where customers_group_id = '1';)?

 

Still, I don't understand why it was a problem that wholesale had id = 3, should work anyway if you ask me. I guess I'm overlooking something.

Link to comment
Share on other sites

Wouldn't that be a matter of running something like update product_groups set customers_group_id = '1' where customers_group_id = '3'; (after having made sure there are no products with customers_group_id = 1 in that table: delete from products_group where customers_group_id = '1';)?

 

Still, I don't understand why it was a problem that wholesale had id = 3, should work anyway if you ask me. I guess I'm overlooking something.

 

JanZ - MySQL is my downfall, I am an old school shell scripting, perl/cgi, *nix guy. Never touch MySQL until 30 days ago. I've always used flat text datafiles due to low to medium volume use, went with OS, PPH and MySQL due to recent increases in traffic and sales. I needed something that could handle the traffic.

 

It's to late to look back on hwat I could have done, though I do have the export I did from MyphpAdmin pior to dropping and reinstalling the tables. I'm going to see if I can come up with a way to JUST update the wholesale fields in relation to

Price, Quantity Blocks, All Price break level's, and Select Groups To Hide This Product From field.

 

I better make another backup :)

My Contributions

 

Henry Smith

Link to comment
Share on other sites

Jan-

 

I have made a big mistake in the Best Sellers Content Box for SPPC with Hide Products (http://www.oscommerce.com/community/contributions,3687).

 

When viewing the best sellers box when a wholesale customer is logged in, the correct products are displayed but with the wrong prices.

 

The code in question should be

 

// BOF Hide products from groups

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

 if (isset($current_category_id) && ($current_category_id > 0)) {

$best_sellers_query = tep_db_query("select distinct p.products_id, pd.products_name, p.products_image, pd.products_description, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and '" . (int)$current_category_id . "' in (c.categories_id, c.parent_id) and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS); 

} else {

$best_sellers_query = tep_db_query("select distinct p.products_id, pd.products_name, p.products_image, pd.products_description, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);

}

// EOF Hide products from groups

 

Even I can see that the prices it's pulling aren't by customer groups!

 

But I've already boggled myself. I can't just dump "customers_group_price as price" in there, it isn't recognized. Gak.

 

Any ideas on this one?

Edited by djmonkey1

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Hi,

 

** Quick Note for JanZ ** - Thank you the whats_new file you sorted for me works sweetly!

 

And now onto the main feature!

 

I have added most of the quantity price breaks contrib which is so far outstanding. I am am testing every little change along the way and the first issue I have come across is that when I go to edit a product the retail price breaks are retrieved from the dbase and inserted for editing but the other two groups I have do not get filled with the blocks or prices...

 

I have checked the dbase and the fields are getting filled when inserting but for some reason they do not get pulled out.

 

I have checked my code (which is a seriously heavily modded file) and all seems ok (to me that is).

 

Can anyone just point in the right direction as to which line(s) in the install text retrieve the prices for my wholesale group.

 

Thanks

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

Mark,

 

Does your catagories.php have this in it?

 

   // BOF Separate Pricing Per Customer, Price Break 1.11.3 mod
$customers_group_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id != '0' order by customers_group_id");
while ($customers_group = tep_db_fetch_array($customers_group_query)) // Gets all of the customers groups
 {
 $attributes_query = tep_db_query("select customers_group_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where ((products_id = '" . $products_id . "') && (customers_group_id = " . $customers_group['customers_group_id'] . ")) order by customers_group_id");
 $attributes = tep_db_fetch_array($attributes_query);
 if (tep_db_num_rows($attributes_query) > 0) {
if ($HTTP_POST_VARS['sppcoption'][$customers_group['customers_group_id']]) { // this is checking if the check box is checked
  if ($attributes['customers_group_id'] == $customers_group['customers_group_id'] ) {
	  $sppc_update_query = "set ";
if (isset($HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']])) {
   $sppc_update_query .= "customers_group_price = '" . $HTTP_POST_VARS['sppcprice'][$customers_group['customers_group_id']] . "', ";
} if (isset($HTTP_POST_VARS['sppcproducts_qty_blocks'][$customers_group['customers_group_id']])) {
   $sppc_update_query .= " products_qty_blocks = '" . $HTTP_POST_VARS['sppcproducts_qty_blocks'][$customers_group['customers_group_id']] . "', ";
} if (isset($HTTP_POST_VARS['sppcproducts_price1'][$customers_group['customers_group_id']])) {
   $sppc_update_query .= " products_price1 = '" . $HTTP_POST_VARS['sppcproducts_price1'][$customers_group['customers_group_id']] . "', ";
} if (isset($HTTP_POST_VARS['sppcproducts_price1_qty'][$customers_group['customers_group_id']])) {
   $sppc_update_query .= " products_price1_qty = '" . $HTTP_POST_VARS['sppcproducts_price1_qty'][$customers_group['customers_group_id']] . "', ";
} if (isset($HTTP_POST_VARS['sppcproducts_price2'][$customers_group['customers_group_id']])) {
   $sppc_update_query .= " products_price2 = '" . $HTTP_POST_VARS['sppcproducts_price2'][$customers_group['customers_group_id']] . "', ";
} if (isset($HTTP_POST_VARS['sppcproducts_price2_qty'][$customers_group['customers_group_id']])) {
   $sppc_update_query .= " products_price2_qty = '" . $HTTP_POST_VARS['sppcproducts_price2_qty'][$customers_group['customers_group_id']] . "', ";
} if (isset($HTTP_POST_VARS['sppcproducts_price3'][$customers_group['customers_group_id']])) {
   $sppc_update_query .= " products_price3 = '" . $HTTP_POST_VARS['sppcproducts_price3'][$customers_group['customers_group_id']] . "', ";
} if (isset($HTTP_POST_VARS['sppcproducts_price3_qty'][$customers_group['customers_group_id']])) {
   $sppc_update_query .= " products_price3_qty = '" . $HTTP_POST_VARS['sppcproducts_price3_qty'][$customers_group['customers_group_id']] . "', ";
} if (isset($HTTP_POST_VARS['sppcproducts_price4'][$customers_group['customers_group_id']])) {
   $sppc_update_query .= " products_price4 = '" . $HTTP_POST_VARS['sppcproducts_price4'][$customers_group['customers_group_id']] . "', ";
} if (isset($HTTP_POST_VARS['sppcproducts_price4_qty'][$customers_group['customers_group_id']])) {
   $sppc_update_query .= " products_price4_qty = '" . $HTTP_POST_VARS['sppcproducts_price4_qty'][$customers_group['customers_group_id']] . "', ";
} if (isset($HTTP_POST_VARS['sppcproducts_price5'][$customers_group['customers_group_id']])) {
   $sppc_update_query .= " products_price5 = '" . $HTTP_POST_VARS['sppcproducts_price5'][$customers_group['customers_group_id']] . "', ";
} if (isset($HTTP_POST_VARS['sppcproducts_price5_qty'][$customers_group['customers_group_id']])) {
   $sppc_update_query .= " products_price5_qty = '" . $HTTP_POST_VARS['sppcproducts_price5_qty'][$customers_group['customers_group_id']] . "', ";
} if (isset($HTTP_POST_VARS['sppcproducts_price6'][$customers_group['customers_group_id']])) {
   $sppc_update_query .= " products_price6 = '" . $HTTP_POST_VARS['sppcproducts_price6'][$customers_group['customers_group_id']] . "', ";
} if (isset($HTTP_POST_VARS['sppcproducts_price6_qty'][$customers_group['customers_group_id']])) {
   $sppc_update_query .= " products_price6_qty = '" . $HTTP_POST_VARS['sppcproducts_price6_qty'][$customers_group['customers_group_id']] . "', ";
} if (isset($HTTP_POST_VARS['sppcproducts_price7'][$customers_group['customers_group_id']])) {
   $sppc_update_query .= " products_price7 = '" . $HTTP_POST_VARS['sppcproducts_price7'][$customers_group['customers_group_id']] . "', ";
} if (isset($HTTP_POST_VARS['sppcproducts_price7_qty'][$customers_group['customers_group_id']])) {
   $sppc_update_query .= " products_price7_qty = '" . $HTTP_POST_VARS['sppcproducts_price7_qty'][$customers_group['customers_group_id']] . "', ";
} if (isset($HTTP_POST_VARS['sppcproducts_price8'][$customers_group['customers_group_id']])) {
   $sppc_update_query .= " products_price8 = '" . $HTTP_POST_VARS['sppcproducts_price8'][$customers_group['customers_group_id']] . "', ";
} if (isset($HTTP_POST_VARS['sppcproducts_price8_qty'][$customers_group['customers_group_id']])) {
   $sppc_update_query .= " products_price8_qty = '" . $HTTP_POST_VARS['sppcproducts_price8_qty'][$customers_group['customers_group_id']] . "' ";
} // now we need to get rid of the last comma in the query string

 

I'm not even 100% sure that is what pulls the values back from the database, but you can start there.

 

After that, I would suggest that you check and re-check (and check again once more) the SPPC step-by-step install instructions on what needs to be changed for the catagories.php. If at that point you don't find anything, I would try to upload the catagories.php what comes w/ the SPPC package (backup your catagories.php first) and see if you can get the values with that file. If you can... its time to go back once again and check your catagories.php again.

 

Good Luck.

 

Nate

Link to comment
Share on other sites

Hi Nate,

 

Thanks for looking but it was nothing to do with that code, after I went through it again for the umpteenth time I noticed that part of the query was missing from just above the actual input fields DOH!

 

I told you my file was really heavy lol

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

Does anyone have an example of the way the price breaks for sppc should look in the product_listing as I am finding it a bit hard to integrate without knowing what the outcome should be.

 

 

 

Thanks

 

Mark

Edited by mark27uk3

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

Hmm I seem to be doing ok on the product listing, everything seems to work as it should. My only problem now is wot the heck do I do with this little beauty

 

		  case 'PRODUCT_LIST_PRICE':
		$lc_align = 'right';

/*  removed for price break modification
		  if (tep_not_null($listing[$x]['specials_new_products_price'])) {
		  $lc_text = ' <s>' .  $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing[$x]['specials_new_products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</span> ';
		} else {
		  $lc_text = ' ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' ';
		} end removed for price break modification, see next two lines for replacement code */

	   $pf->parse($listing[$x]);
		$lc_text = $pf->getPriceStringShort();
		break;

 

because I dont use the standard column thing and again my product_listing.php is hacked to hell.

 

This is my code

 

switch ($column_list[$col]) {
	  case 'PRODUCT_LIST_NAME':
		$lc_align = '';
		if (isset($HTTP_GET_VARS['manufacturers_id'])) {
		  $lc_text = '<br><b>' . $listing[$x]['products_name'] . '</b><br>';
		} else {
		  $lc_text = '<br><b>' . $listing[$x]['products_name'] . '</b><br>';
		}

		if (tep_not_null($listing[$x]['specials_new_products_price'])) {
		  $lc_text .= '<br><span class="stockStatus">Regular Price ' .  $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '<br><font color="#ff0000"><b>Special Offer Price <span class="productSpecialPrice">' . $currencies->display_price($listing[$x]['specials_new_products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</span> </b></font> <br>';
		} else {
		  $lc_text .= '<br><span class="stockStatus">Our Price ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' </b></span> <br>';
		}


	   if ($product_info_values['products_quantity'] > '0') {

	   $lc_text .= '<span class="stockStatus">' . $text_stock_header . ' </span><span class="markProductOutOfStock">' . $text_stock . '</span><br>';

	   } else {

	   $lc_text .= '<span class="stockStatus">' . $text_stock_header . ' </span><span class="markProductOutOfStock">' . $text_stock . '</span><br>';
	   }
	   //free shipping
	  if ($listing[$x]['products_free_shipping'] && FREE_SHIPPING_TO_ALL_COUNTRIES == "true") {
		 $lc_text .= '<br><b>' . FREE_SHIPPING_FOR_THIS_PRODUCT . '</b><br>';
	} elseif ($listing[$x]['products_free_shipping'] && FREE_SHIPPING_TO_ALL_COUNTRIES == "false") {
	   $lc_text .= '<br><b>' . FREE_SHIPPING_FOR_THIS_PRODUCT_FOR_SHOP_COUNTRY . '</b><br> ';
	}

		if( isset($HTTP_GET_VARS['manufacturers_id'])) {
		$lc_text .= '<br><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td class="productDesc">' . tep_flatten_product_description($listing[$x]['products_description'], '<br><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_buttonb('read_more.gif', IMAGE_BUTTON_READ_MORE) . '</a>  <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_buttonb('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>') . '</td></tr></table>';
		} else {
		$lc_text .= '<br><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td class="productDesc">' . tep_flatten_product_description($listing[$x]['products_description'], '<br><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing[$x]['products_id']) . '">' . tep_image_buttona('read_more.gif', IMAGE_BUTTON_READ_MORE) . '</a>  <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_buttonb('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>') . '</td></tr></table>';
		}
		break;

		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 = '
			<script language="javascript"><!--
			document.write(\'<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $listing[$x]['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], addslashes($listing[$x]['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>\');
			//--></script>
			<noscript>
			<a href="' . tep_href_link(DIR_WS_IMAGES . $listing[$x]['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>
			</noscript>';
		}


		break;

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

Elisa,

I'm having a problem with this contributions when I try to add the contribution "Account create in admin" (http://www.oscommerce.com/community/contributions,1644/category,all/search,Account+create+in+admin)....

 

It's showing this error when I click insert:

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /mnt/sites/all4bar.com/web/admin/includes/classes/object_info.php on line 17

 

Warning: Variable passed to each() is not an array or object in /mnt/sites/all4bar.com/web/admin/includes/classes/object_info.php on line 18

 

I really appreciate some light!

You must have made a mistake when merging these two files. I was rather sceptical about this contribution at first, but the default file worked like a charm. That encouraged me to merged the customer add file with the customers.php from sppc myself and it does not really work flawlessly (when inserting a new customer the shipping and payment options cannot be set) but I don't get that kind of errors at all. Everything gets inserted fine in the database.
Link to comment
Share on other sites

Join the conversation

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

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

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...