Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

Also, I am wondering - do I need to make the changes in this file? price_break_per_category_instr.txt I am installing Quantity Price Breaks for Separate Pricing Per Customer v1.02 for the first time (no prior version has been installed).

 

I have been able to get the rest of it to work - but not the part for "catalog/includes/modules/product_listing.php" as I am using the "Add Multiple Products to Cart in columns for SPPC" and the file uses product_listing_multi_col.php instead - any help would be great.

 

Thanks,

Philip

Share this post


Link to post
Share on other sites

ok - I solved the code for using it in columns in: catalog/includes/modules/product_listing_multi_col.php.

 

So the code it says to replace in catalog/includes/modules/product_listing.php - use this instead:

 

// BOF Separate Pricing per Customer, Price Break 1.11.3 modification
$no_of_listings = tep_db_num_rows($listing_query);
// global variable (session) $sppc_customer_group_id -> local variable customer_group_id

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

 $default_settings = array('products_price1' => '0.0000', 'products_price2' => '0.0000', 'products_price3' => '0.0000',
'products_price4' => '0.0000', 'products_price5' => '0.0000', 'products_price6' => '0.0000', 'products_price7' => '0.0000', 'products_price8' => '0.0000', 'products_price1_qty' => '0', 'products_price2_qty' => '0', 'products_price3_qty' => '0', 'products_price4_qty' => '0', 'products_price5_qty' => '0', 'products_price6_qty' => '0', 'products_price7_qty' => '0', 'products_price8_qty' => '0', 'products_qty_blocks' => '1');

while ($_listing = tep_db_fetch_array($listing_query)) {
// let's start with default settings, you never know
$_new_listing =	array_merge($_listing , $default_settings);
$listing[] = $_new_listing;
$list_of_prdct_ids[] = $_listing['products_id'];
} 
// next part is a debug feature, when uncommented it will print the info that this module receives

/*   echo '<pre>';
  print_r($listing);
  echo '</pre>'; */

 $select_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' ";
 if ($no_of_listings > 1) {
  for ($n = 1; $n < count($list_of_prdct_ids); $n++) {
  $select_list_of_prdct_ids .= "or products_id = '".$list_of_prdct_ids[$n]."' "; 
  }
}



// to avoid messing with index.php, which is complicated of itself already
// we add another query here to get the price break variables for retail customers
// for other groups we change the $pg_query from the one in SPPC4

  if ($customer_group_id == '0') {
$retail_price_break_query = tep_db_query("select p.products_id, p.products_price1, p.products_price2, p.products_price3, p.products_price4, p.products_price5, p.products_price6, p.products_price7, p.products_price8, p.products_price1_qty, p.products_price2_qty, p.products_price3_qty, p.products_price4_qty, p.products_price5_qty, p.products_price6_qty, p.products_price7_qty, p.products_price8_qty, p.products_qty_blocks from " . TABLE_PRODUCTS . " p where " . $select_list_of_prdct_ids . "");
while ($rp_break = tep_db_fetch_array($retail_price_break_query)) {
	for ($u = 0; $u < $no_of_listings; $u++) {
		if ($rp_break['products_id'] == $listing[$u]['products_id']) {
			$listing[$u]['products_price1'] = $rp_break['products_price1'];
			$listing[$u]['products_price2'] = $rp_break['products_price2'];
			$listing[$u]['products_price3'] = $rp_break['products_price3'];
			$listing[$u]['products_price4'] = $rp_break['products_price4'];
			$listing[$u]['products_price5'] = $rp_break['products_price5'];
			$listing[$u]['products_price6'] = $rp_break['products_price6'];
			$listing[$u]['products_price7'] = $rp_break['products_price7'];
			$listing[$u]['products_price8'] = $rp_break['products_price8'];
			$listing[$u]['products_price1_qty'] = $rp_break['products_price1_qty'];
			$listing[$u]['products_price2_qty'] = $rp_break['products_price2_qty'];
			$listing[$u]['products_price3_qty'] = $rp_break['products_price3_qty'];
			$listing[$u]['products_price4_qty'] = $rp_break['products_price4_qty'];
			$listing[$u]['products_price5_qty'] = $rp_break['products_price5_qty'];
			$listing[$u]['products_price6_qty'] = $rp_break['products_price6_qty'];
			$listing[$u]['products_price7_qty'] = $rp_break['products_price7_qty'];
			$listing[$u]['products_price8_qty'] = $rp_break['products_price8_qty'];
			$listing[$u]['products_qty_blocks'] = $rp_break['products_qty_blocks'];
		} // end if ($rp_break['products_id'] == $listing[$u]['products_id'])
} // end for ($u = 0; $u < $no_of_listings; $u++)
} // end while ($rp_break = tep_db_fetch_array($retail_price_break_query)
  } // end if ($customer_group_id == '0')

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

// an extra query is needed for all the specials

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

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

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

//	while ($listing = tep_db_fetch_array($listing_query)) { (was original code)



// WARNING the code assumes there are three products per row. To use a different number change the number

// at line 195: if ($column >= 3) and the code to fill up the table row below that accordingly

 $counter = $row;

 $class_for_buy_now = 'class="productListing-odd"';

 $list_box_contents[$row] = array('params' => 'class="productListing-odd"');

for ($x = 0; $x < $no_of_listings; $x++) {



  $rows++;



if (($rows/2) == floor($rows/2) && ($row > $counter)) {

  $list_box_contents[$row] = array('params' => 'class="productListing-even"');

  $class_for_buy_now = 'class="productListing-even"';

  $counter = $row;

} else {

 if ($row > $counter) {

  $list_box_contents[$row] = array('params' => 'class="productListing-odd"');

  $class_for_buy_now = 'class="productListing-odd"';

  $counter = $row;

 }

}



$product_contents = array();



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

  $lc_align = '';



  switch ($column_list[$col]) {

	case 'PRODUCT_LIST_MODEL':

	  $lc_align = '';

	  $lc_text = ' ' . $listing[$x]['products_model'] . ' ';

	  break;

	case 'PRODUCT_LIST_NAME':

	  $lc_align = '';

	  if (isset($HTTP_GET_VARS['manufacturers_id'])) {

		$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a>';

	  } else {

		$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a> ';

	  }

	  break;

	case 'PRODUCT_LIST_MANUFACTURER':

	  $lc_align = '';

	  $lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing[$x]['manufacturers_id']) . '">' . $listing[$x]['manufacturers_name'] . '</a> ';

	  break;


	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;

	case 'PRODUCT_LIST_QUANTITY':

	  $lc_align = 'right';

	  $lc_text = ' ' . $listing[$x]['products_quantity'] . ' ';

	  break;

	case 'PRODUCT_LIST_WEIGHT':

	  $lc_align = 'right';

	  $lc_text = ' ' . $listing[$x]['products_weight'] . ' ';

	  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 = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';

	  }

	  break; // EOF Separate Pricing per Customer
	//bof product listing with attributes

	 case 'PRODUCT_LIST_BUY_NOW':
		  $show_buy_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");

		$show_buy = tep_db_fetch_array($show_buy_query);

		if ($show_buy['total'] > 0) {

	  $lc_align = 'center';

	  $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

	  break;
		} else {

			$lc_align = 'center';

			$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

			break;

		}
// EOF Separate Pricing per Customer, Price Break 1.11.3 modification

 

Make sure you add any other code for any contrib that you have - ie: I have short descriptions so I added this in there:

 

		  case 'PRODUCT_LIST_INFO':

		$lc_align = 'left';
		$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_info'] . '</a> ';

//			$lc_text = $listing['products_info'] . ' ';

		break;

 

Philip

Share this post


Link to post
Share on other sites

Hi All

 

Aside from anything else, its about time these 128 pages of info were put into their own forum which would make it a whole heap easier to review.

 

On to my question, I am trying to install the latest SPPC, with QtyPriceBreak and Hide 0 Price add-on. As a foundation I am using 2.2 nov 05 release with Register_Globals patch.

 

From reviewing the three, installing SPPC with Register Globals already done is easy, but after that there is some confusion for me.

 

When comparing product_info.php across the three add-ons I find some subtractive variations as well as additive variations in the code. With SPPC its ok, but with the QtyPriceBreak it appears that some of the SPPC code is moved or changed, i.e. both files have additional code but in different places as if the QPB add-on is based in a different version of SPPC.

 

So my question is "is the current file for QPB (and Hide 0 prices add-on) based in SPPC 4.1.5 or earlier ?" i.e Can I safely copy the preconfigured files for these two add-ons over the top of SPPC or do I need to manually insert changes ?

 

TIA


cheers
Tony
******************************
My oscMax Store RecoverToy :: Antique Toy Car Parts
Tony's Tech Blog
WrenMaxwell WebManagement
******************************

Share this post


Link to post
Share on other sites
So my question is "is the current file for QPB (and Hide 0 prices add-on) based in SPPC 4.1.5 or earlier ?" i.e Can I safely copy the preconfigured files for these two add-ons over the top of SPPC or do I need to manually insert changes ?
Those are based on 4.1.1 and do not contain the changes made to osC in the November 13, 2005 update. So check that and if the files were not changed in the Nov. 13 update you should be fine otherwise do things manual using the 4.1.5 files (although the MySQL5 changes might not be all OK, haven't checked that). Some code parts in QPB had to be moved because the customer group id had to available earlier.

Share this post


Link to post
Share on other sites

i have a question about seperate pricing per customer v. 4.1.5.

is this hard to install if i have ccgv(trad) and osaffiliates set up? or does it make no difference.

cause id like to know what im getting into before i start because my shop is live and i can risk downtime to retore database stuff.. i dont usally have problems with contribs but this 'could' get pretty intense


Check out my fully customized oscommerce site by viewing my profile.

Share this post


Link to post
Share on other sites

Hi all...

 

I'm kinda new to OSCommerce, and to the board, so please be gentle... :)

 

I have read through a large portion of this thread and have not seen the same issue anywhere else, but sorry if this has been covered...

 

Ok, I have setup a shopping cart at: http://www.arizonatraders.net/shop/catalog

 

I have used the SPPC 4.1.1(the latest)contribute, and the show list price for SPPC 4.1.

 

The product catalog is working wonderfully, it shows the correct prices, and lists the retail price.

 

The problem I am having is that when a customer goes to buy an item, it shows up in the shopping cart as the retail(list) price, and not the customer ID(products) price that I have set.

 

I have looked through the shopping_cart.php, the product_info.php, and the product_listing.php.

 

I am not able to find my issue... it pulls correctly on the products page... why would the shopping cart pull the wrong price?

 

Also I have noticed that in the shopping cart page itself, the subtotal shows the retail price, but the actual price on the right of the item is showing $0.00...

 

Any help with this would be very appreciated, and please let me know what snippets you need to see in order to help me out.

 

Thanks

Share this post


Link to post
Share on other sites
The problem I am having is that when a customer goes to buy an item, it shows up in the shopping cart as the retail(list) price, and not the customer ID(products) price that I have set.
Check the class shopping_cart.php first (catalog/includes/classes/shopping_cart.php). Do you have a "register globals problem"? Perhaps $sppc_customer_group_id is not recognized there (you could change it to $_SESSION['sppc_customer_group_id']).

Share this post


Link to post
Share on other sites
Check the class shopping_cart.php first (catalog/includes/classes/shopping_cart.php). Do you have a "register globals problem"? Perhaps $sppc_customer_group_id is not recognized there (you could change it to $_SESSION['sppc_customer_group_id']).

 

 

Thank you for your reply Jan...

 

This is what I changed in the class shopping_cart.php.

 

From

 

// BOF Separate Pricing Per Customer

// global variable (session) $sppc_customer_group_id -> class variable cg_id

global $sppc_customer_group_id;

if(!tep_session_is_registered('sppc_customer_group_id')) {

$this->cg_id = '0';

} else {

$this->cg_id = $sppc_customer_group_id;

}

// EOF Separate Pricing Per Customer

 

to

 

// BOF Separate Pricing Per Customer

// global variable (session) $sppc_customer_group_id -> class variable cg_id

global $_SESSION['sppc_customer_group_id'];

 

if(!tep_session_is_registered('sppc_customer_group_id')) {

$this->cg_id = '0';

} else {

$this->cg_id = $sppc_customer_group_id;

}

// EOF Separate Pricing Per Customer

 

but this gives me an error when I try to run the cart now...

 

obviously I'm missing something...

 

I do apologies, I am still a bit of a novice to PHP, but that is the only global call I see in this code.

 

Please let me know what I'm doing wrong...

Share this post


Link to post
Share on other sites

OK, I reloaded the SPPC contribute, and now I'm getting the price to the right of the item in the cart, but I still get the "regular" price instead of the group's price when I add to the cart. :(

Share this post


Link to post
Share on other sites
This is what I changed in the class shopping_cart.php.

 

to

 

// BOF Separate Pricing Per Customer

// global variable (session) $sppc_customer_group_id -> class variable cg_id

global $_SESSION['sppc_customer_group_id'];

 

if(!tep_session_is_registered('sppc_customer_group_id')) {

$this->cg_id = '0';

} else {

$this->cg_id = $sppc_customer_group_id;

}

// EOF Separate Pricing Per Customer

 

but this gives me an error when I try to run the cart now...

So this might be a register globals problem...

 

The $_SESSION variables are so called super globals, they are always available. I meant this:

  // BOF Separate Pricing Per Customer
// global variable (session) $sppc_customer_group_id -> class variable cg_id
 global sppc_customer_group_id; // this might not be available due to register globals problem

 if(!tep_session_is_registered('sppc_customer_group_id')) {
 $this->cg_id = '0';
 } else {
  $this->cg_id = $_SESSION['sppc_customer_group_id'];
 }
// EOF Separate Pricing Per Customer

This needs to be done twice in that file: once in the function calculate and once in the function get_products. Hopefully, this will take care of the problem.

Share this post


Link to post
Share on other sites
(JanZ @ Jul 10 2006, 05:55 PM) *

 

SPPC doesn't do anything with that page (orders.php) and in general when the order is finished, SPPC's job is done. I don't know what you normally should see though (never dealt with credit cards in osC although this seems to be standard: line 179-201 in that page) but it doesn't look to me it has something to do with SPPC. Can you find the info back in the table orders using phpMyAdmin?

 

 

ok, i found that the credit card information is NOT getting stored in the sql table... the order.php is trying to display the info correctly but there is no info to "grab"... i am not sure which file takes the data from the page and places it into the database... so the problem is occurs before the order is finished apparently.

 

is there a certain file/files i can post in order to make it easier for you to tell if this is a SPPC problem or not?

Edited by herot

Did you get rid of the voices in your head? Do you now miss them and the things that they said?

-David Gilmour

Share this post


Link to post
Share on other sites
ok, i found that the credit card information is NOT getting stored in the sql table... the order.php is trying to display the info correctly but there is no info to "grab"... i am not sure which file takes the data from the page and places it into the database...
The page checkout_process.php processes the final order information. The credit card info is received from the class order.php where SPPC has some code, but only regarding prices. I can't think of any way SPPC is involved in this. Does the info appear on checkout_confirmation.php? From a recent thread I know it is not inconceivable to lose cc info going from that page to checkout_process (cc info etc. should be found as hidden fields in the form with the checkout confirmation button).

Share this post


Link to post
Share on other sites
The page checkout_process.php processes the final order information. The credit card info is received from the class order.php where SPPC has some code, but only regarding prices. I can't think of any way SPPC is involved in this. Does the info appear on checkout_confirmation.php? From a recent thread I know it is not inconceivable to lose cc info going from that page to checkout_process (cc info etc. should be found as hidden fields in the form with the checkout confirmation button).

 

yes, it does display on the order confirmation page and as hidden text... it just doesn't display when im looking at the customers order... (which is where i really need it to be displayed). After all if i cant ever see the customers CC# and info, why have them put it in?

 

but alas, you know your stuff so i will take this issue to another thread to avoid going further off topic. ;)


Did you get rid of the voices in your head? Do you now miss them and the things that they said?

-David Gilmour

Share this post


Link to post
Share on other sites

I need to let wholesale customers see a different main page than retail after they login. How can i do this? i want to add links to calendars/specials that only wholesale customers should be able to see.

Edited by herot

Did you get rid of the voices in your head? Do you now miss them and the things that they said?

-David Gilmour

Share this post


Link to post
Share on other sites
I need to let wholesale customers see a different main page than retail after they login. How can i do this? i want to add links to calendars/specials that only wholesale customers should be able to see.
Built something in in login.php (based on $sppc_customer_group_id:

//BOF SPPC
if ($sppc_customer_group_id == '0') {
// EOF SPPC
	if (sizeof($navigation->snapshot) > 0) {
	  $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
	  $navigation->clear_snapshot();
	  tep_redirect($origin_href);
	} else {
	  tep_redirect(tep_href_link(FILENAME_DEFAULT));
	}
} // end if ($sppc_customer_group_id == '0')
else {
tep_redirect(tep_href_link('you_special_page.php'));
}

Share this post


Link to post
Share on other sites

hi, i just have a quick question on SPPC. once a customer input his/her company tax id, the customer cannot make changes to it - which is a very good feature.

 

my question is: how can i populate that company tax id to other addresses this customer has in his/her address book? say the customer has 2 different addresses (Address A and Address B) in his/her address book. after he/she input company tax id under Address A, he/she is still able to input the company tax id under Address B. what i want to do is having one company tax id per account.

 

i am thinking of inserting the company tax id into the database based on the customer_id. however, my mySQL skill is very limited and i have no idea how to do it.

 

thanks a lot for any help!

Share this post


Link to post
Share on other sites

one more quick question: where (or which file) did SPPC insert customers_group_ra in table customers?

 

i commented out every tep_db_perform in both admin/customers.php and account_edit_process.php and it's still inserting customers_group_ra data into table customers when i clicked "update" in my address book.

 

any help is very much appreciated!

Share this post


Link to post
Share on other sites
my question is: how can i populate that company tax id to other addresses this customer has in his/her address book? say the customer has 2 different addresses (Address A and Address B) in his/her address book. after he/she input company tax id under Address A, he/she is still able to input the company tax id under Address B. what i want to do is having one company tax id per account.

 

i am thinking of inserting the company tax id into the database based on the customer_id. however, my mySQL skill is very limited and i have no idea how to do it.

Actually, that is the way it should have been from day 1 I think. I added it to address_book because other contributions using tax_id numbers were already doing that. In hindsight it doesn't seem to a good idea to follow the crowd on this (tax_id is associated with the customer). However, the entry_company is stored in the table address_book so it made kind of sense to put it there. I had hoped osC version 3 would add it, so we could follow that. I haven't seen any changes to the db so I guess it is something that either will not be in there, or not looked at yet.

 

Moving the tax_id number to the table customer is not impossible, but it would take some time to go through all the code and change everything... It is not a 5 or even 15 minute job.

 

I wouldn't worry to much about the customers_group_ra thing. Pretty innocent, it is not used on the catalogue side. It is set to 1 (on) when the customer enters a tax_id number when an account is opened (or perhaps also when a new address is added, haven't checked that).

Share this post


Link to post
Share on other sites
Moving the tax_id number to the table customer is not impossible, but it would take some time to go through all the code and change everything...
Move the taxnumber to table customers.

Changes in 3 files:

create_account.php

address_book_process.php

admin/customers.php

############### create_account.php
***ADD***

  if (ACCOUNT_COMPANY == 'true') { // BOF adapted for Separate Pricing Per Customer
  $sql_data_array['entry_company_tax_id'] = $company_tax_id;
  } // EOF adapted for Separate Pricing Per Customer

***BEFORE***

  tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

###
***REPLACE***

  if (ACCOUNT_COMPANY == 'true') { // BOF adapted for Separate Pricing Per Customer
  $sql_data_array['entry_company'] = $company;
  $sql_data_array['entry_company_tax_id'] = $company_tax_id;
  } // EOF adapted for Separate Pricing Per Customer

***WITH***

  if (ACCOUNT_COMPANY == 'true') { // BOF adapted for Separate Pricing Per Customer
  $sql_data_array['entry_company'] = $company;
  } // EOF adapted for Separate Pricing Per Customer


############### address_book_process.php
***DELETE***
  // BOF Separate Pricing Per Customer
  if (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id)) {
		  $sql_data_array['entry_company_tax_id'] = $company_tax_id;
  }
  // EOF Separate Pricing Per Customer


###
***REPLACE***
// BOF Separate Pricing Per Customer: alert shop owner of tax id number added to an account
  if (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id)) {
		  $sql_data_array2['customers_group_ra'] = '1';
  tep_db_perform(TABLE_CUSTOMERS, $sql_data_array2, 'update', "customers_id ='" . (int)$customer_id . "'");

***WITH***
// BOF Separate Pricing Per Customer: alert shop owner of tax id number added to an account
  if (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id)) {
		  $sql_data_array2['customers_group_ra'] = '1';
		  $sql_data_array2['entry_company_tax_id'] = $company_tax_id;
  tep_db_perform(TABLE_CUSTOMERS, $sql_data_array2, 'update', "customers_id ='" . (int)$customer_id . "'");


###
***REPLACE***
// BOF Separate Pricing Per Customer
 if (isset($HTTP_GET_VARS['edit']) && is_numeric($HTTP_GET_VARS['edit'])) {
$entry_query = tep_db_query("select entry_gender, entry_company, entry_company_tax_id, entry_firstname, entry_lastname, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_state, entry_zone_id, entry_country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$HTTP_GET_VARS['edit'] . "'");
// EOF Separate Pricing Per Customer

***WITH***
// BOF Separate Pricing Per Customer
 if (isset($HTTP_GET_VARS['edit']) && is_numeric($HTTP_GET_VARS['edit'])) {
$entry_query = tep_db_query("select a.entry_gender, a.entry_company, c.entry_company_tax_id, a.entry_firstname, a.entry_lastname, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id from " . TABLE_ADDRESS_BOOK . " a, " . TABLE_CUSTOMERS . " c where c.customers_id = '" . (int)$customer_id . "' and a.customers_id = '" . (int)$customer_id . "' and a.address_book_id = '" . (int)$HTTP_GET_VARS['edit'] . "'");
// EOF Separate Pricing Per Customer


############### admin/customers.php
***REPLACE***

// BOF Separate Pricing per Customer
							'customers_group_id' => $customers_group_id,
							'customers_group_ra' => $customers_group_ra,
							'customers_payment_allowed' => $customers_payment_allowed,
							'customers_shipment_allowed' => $customers_shipment_allowed);
// EOF Separate Pricing per Customer

***WITH***

// BOF Separate Pricing per Customer
							'customers_group_id' => $customers_group_id,
							'customers_group_ra' => $customers_group_ra,
							'customers_payment_allowed' => $customers_payment_allowed,
							'customers_shipment_allowed' => $customers_shipment_allowed,
							'entry_company_tax_id' => $entry_company_tax_id);
// EOF Separate Pricing per Customer


###
***REPLACE***

// BOF Separate Pricing Per Customer
	if (ACCOUNT_COMPANY == 'true') {
	$sql_data_array['entry_company'] = $entry_company;
	 $sql_data_array['entry_company_tax_id'] = $entry_company_tax_id;
	}
// EOF Separate Pricing Per Customer

***WITH***

// BOF Separate Pricing Per Customer
	if (ACCOUNT_COMPANY == 'true') {
	$sql_data_array['entry_company'] = $entry_company;
	}
// EOF Separate Pricing Per Customer


###
***REPLACE***

  default:
  // 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'] . "'");

***WITH***

  default:
  // 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, c.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'] . "'");

We now need to run a script ONCE, to add the taxfield to table customers, move the data from addressbook to customers and delete the taxfield in addressbook.

Therefor we have to create a new file, call it move_tax_id.php, add this code, upload it to the server and call it in the browserwindow to run it once. if you see nothing, everything is fine, you can delete it from the server.

<?php
 require('includes/application_top.php');

 tep_db_query("ALTER TABLE " . TABLE_CUSTOMERS . " ADD entry_company_tax_id VARCHAR( 32 ) DEFAULT NULL");

$company_tax_id_query = tep_db_query("select entry_company_tax_id, customers_id from " . TABLE_ADDRESS_BOOK);
while ($tax_ids = tep_db_fetch_array($company_tax_id_query)) {
	  tep_db_query("update " . TABLE_CUSTOMERS . " set entry_company_tax_id = '" . $tax_ids['entry_company_tax_id'] . "' where customers_id = '" . (int)$tax_ids['customers_id'] . "'");
}

 tep_db_query("ALTER TABLE " . TABLE_ADDRESS_BOOK . " DROP entry_company_tax_id");
?>

Your tax_id is moved to table customers.

Share this post


Link to post
Share on other sites

hello i have just installed version 4.15 and its not working its giving this error to me:

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

 

select count(p.products_id) as total from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials_retail_prices s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '24'

 

[TEP STOP]

 

:(( and when i try choosing manufacturer it gives me this error:

 

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

 

select count(p.products_id) as total from products p, products_description pd, manufacturers m left join specials_retail_prices s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '16'

 

[TEP STOP]

 

and when i want to search it gives me :

 

1066 - Not unique table/alias: 'pd'

 

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

 

[TEP STOP]

 

but the admin is working perfectly fine

Pleaseeee help:(

Share this post


Link to post
Share on other sites
hello i have just installed version 4.15 and its not working its giving this error to me:

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

 

select count(p.products_id) as total from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials_retail_prices s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '24'

 

[TEP STOP]

 

:(( and when i try choosing manufacturer it gives me this error:

 

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

 

select count(p.products_id) as total from products p, products_description pd, manufacturers m left join specials_retail_prices s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '16'

 

[TEP STOP]

 

and when i want to search it gives me :

 

1066 - Not unique table/alias: 'pd'

 

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

 

[TEP STOP]

 

but the admin is working perfectly fine

Pleaseeee help:(

 

I have sorted the error out but my index.php is not right it shows all the prices to everyone cant filter the prices :( anyone have any idea?

Share this post


Link to post
Share on other sites
1054 - Unknown column 'p.products_id' in 'on clause'
Try using the queries from this post on page 122 instead.

Share this post


Link to post
Share on other sites

Hi all.

 

I'm in need of a system for entering a '%' price break per category eg:

5 pcs = 5% discount

10 pcs = 6% disccount

20 pcs = 10% discount

...

 

anyone done that before ? or got any sugestions to where one migth add this to price breaks for SPPC per category ?

 

Regards

Toke Herkild

Share this post


Link to post
Share on other sites
I wouldn't worry to much about the customers_group_ra thing. Pretty innocent, it is not used on the catalogue side. It is set to 1 (on) when the customer enters a tax_id number when an account is opened (or perhaps also when a new address is added, haven't checked that).

 

The reason why I want to know where the SQL statement is for inserting customers_group_ra is because: for some reason, the database will automatically insert a "0" (zero) into the database when a customer updates his/her address book without inputing any number into the company ID field. whenever there is something (including a "0") in the tax_id field, the red light will appear. i just want to add an "IF" statement to exclude the condition where the company ID is "0" so that the red light won't turn on.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×