Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

My apologies if this has been asked before. I searched the forum, but simply couldn't find anything on this.

 

Does the QPPC mod work with the latest version of SPPC (4.2)? If so, is it a straightforward install or are there several changes required that differ from the installation instructions included in the QPPC package?

 

TIA

Share this post


Link to post
Share on other sites
Does the QPPC mod work with the latest version of SPPC (4.2)? If so, is it a straightforward install or are there several changes required that differ from the installation instructions included in the QPPC package?

Couldn't find what you meant with QPPC but if you mean QPBPP (Quantity Price Break Per Product) than you would need the version for SPPC. However, from the top of my head the bulk of changes are in the files that you have to upload (apart from admin/categories.php of course), not much or no change on the catalog side compared to the "original" version. There are not many changes to make to install QPBPP on the catalog side.

Share this post


Link to post
Share on other sites
Couldn't find what you meant with QPPC but if you mean QPBPP (Quantity Price Break Per Product) than you would need the version for SPPC. However, from the top of my head the bulk of changes are in the files that you have to upload (apart from admin/categories.php of course), not much or no change on the catalog side compared to the "original" version. There are not many changes to make to install QPBPP on the catalog side.

 

Yes, that's what I meant, Quantity Price Breaks for Separate Pricing Per Customer, sorry for the wrong acronym. I have downloaded the latest version and it only indicates that it is for SPPC 4.0 and 4.1. The version of SPPC I have installed is 4.2 and I just wanted to make sure that it would work following the instructions in the Quantity Price Breaks Per Product 1.11.3 for version 4.0/4.1 of Separate Pricing Per Customer package. Phew that's a mouthful.

 

Thanks again.

Share this post


Link to post
Share on other sites

Thanks Jan - would that be this bit of code? :blush:

 

// BOF Separate Pricing per Customer
tep_session_register('sppc_customer_group_id');
tep_session_register('sppc_customer_group_show_tax');
tep_session_register('sppc_customer_group_tax_exempt');
// EOF Separate Pricing per Customer

 

 

OK, than probably the query gets every field, but the session parameter for customer group id is not set. Look at login.php to see how that is done for SPPC.

~Tracy
 

Share this post


Link to post
Share on other sites
Thanks Jan - would that be this bit of code? :blush:

 

// BOF Separate Pricing per Customer
tep_session_register('sppc_customer_group_id');
tep_session_register('sppc_customer_group_show_tax');
tep_session_register('sppc_customer_group_tax_exempt');
// EOF Separate Pricing per Customer

Partially, you would also need to specify the variables $sppc_customer_group_id etc. before that, using the results of the query for the customer data like (for sppc_customer_group_id):

$sppc_customer_group_id = $check_customer['customers_group_id'];

Share this post


Link to post
Share on other sites

Jan,

 

Turns out that replacing both customers.php files solved the inability to assign customers to groups. I thought I did that but probably missed one of them. You know your stuff! I am very thankful to you. :D

 

I'm still having issues with making only the retail price show up for the guest users. I fear it is the Quantity module that is jacking things up. Everyone can see the same quantity price break regardless of group. Have you encountered this before, and where should I look in the code to make sure the customer is being recognized properly? I added a piece of code to see session information on login.php, yet didn't see anything there about any customer_id or such. Thoughts on confirming that customers are being ID-checked?

 

I'm still looking into the code you gave that forces new accounts to be guests. I'll see if that functions. Thanks again.

 

Here's the session info from login.php (white space removed to shorten. sorry to post long code...hope it is helpful):

Array
(
[cart] => shoppingcart Object
	(
		[contents] => Array
			(
			)
		[total] => 0
		[weight] => 0
		[cartID] => 
		[content_type] => 
	)
[language] => english
[languages_id] => 1
[currency] => USD
[navigation] => navigationhistory Object
	(
		[path] => Array
			(
				[0] => Array
					(
						

 => index.php
						[mode] => NONSSL
						[get] => Array
							(
							)
						[post] => Array
							(
							)
					)
				[1] => Array
					(
						

 => advanced_search_result.php
						[mode] => NONSSL
						[get] => Array
							(
								[keywords] => 3/4
							)
						[post] => Array
							(
							)
					)
				[2] => Array
					(
						

 => product_info.php
						[mode] => NONSSL
						[get] => Array
							(
								[products_id] => 62
							)
						[post] => Array
							(
							)
					)
				[3] => Array
					(
						

 => account.php
						[mode] => NONSSL
						[get] => Array
							(
							)
						[post] => Array
							(
							)
					)
				[4] => Array
					(
						

 => login.php
						[mode] => SSL
						[get] => Array
							(
							)
						[post] => Array
							(
							)
					)
			)
		[snapshot] => Array
			(
				

 => account.php
				[mode] => NONSSL
				[get] => Array
					(
					)
				[post] => Array
					(
					)
			)
	)
)

Share this post


Link to post
Share on other sites

Hello Jan,

 

Again, I can not tell you how well the SPPC works..... I do have a question. On the sites I have, the current customers are dealer and distributor pricing. I have had a request from them to have, on the product info page:

 

Retail Price $

Dealer Price $

 

and

 

Retail Price $

Distributor Price $

 

What would be the coding needed to add to product info page.

 

Thanks JR

Share this post


Link to post
Share on other sites
What would be the coding needed to add to product info page.

To always have the retail price available no matter the group the customer is in you can add p.products_price as retail_price to the $product_info_query.

Then you could add after the products_model stuff something like:

	  if ($customer_group_id > 0) {
$retail_price = $currencies->display_price($product_info['retail_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
}

And then depending on where you want this to display code to only echo that retail price if customer_group_id > 0.

Share this post


Link to post
Share on other sites
I'm still having issues with making only the retail price show up for the guest users. I fear it is the Quantity module that is jacking things up. Everyone can see the same quantity price break regardless of group.

That is quite impossible. Are you aware of the fact that visitors are assumed to be retail customers, so are "treated" as having customers_group_id 0?

I added a piece of code to see session information on login.php, yet didn't see anything there about any customer_id or such.

A. That is not the place to look for session information, because your customer hasn't logged-in yet.

B. You are showing the shopping cart session, that is not the PHP session.

Thoughts on confirming that customers are being ID-checked?

Echo on product_info.php, preferably in the footer or somewhere else on the bottom:

echo '<!-- '; // start HTML comment: not showing this to the customer, only visible in the page source
echo '<pre>Session: <br>';
print_r($_SESSION);
echo '<br>';
echo 'Customer group id: <br>';
echo $customer_group_id;
echo '</pre>';
echo ' -->'; // end HTML commenting

You should see things like sppc_customer_group_id and lastly the customer group id as evaluated on that page.

Share this post


Link to post
Share on other sites

Hello Jan,

 

We'll as mentioned before, thanks for the help, but I messed something up.. I added to query, but may not be correct, and echo the below. But I get this error 1066 - Not unique table/alias: 'p'.

 

Thanks JR

 

$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 . " p.products_price as retail_price " . " 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 . "'");

 

--------------------------------------

 

<td class="pageHeading" valign="top"><?php echo $products_name; ?></td>

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

 

<td class="pageHeading" align="right" valign="top">

<?php echo

if ($customer_group_id > 0) {

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

}

</td>

Share this post


Link to post
Share on other sites
I messed something up..
Indeed :)

$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 retail_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 . "'");

 

<td class="pageHeading" valign="top"><?php echo $products_name; ?></td>
		<td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>

<td class="pageHeading" align="right" valign="top">
<?php
if ($customer_group_id > 0) {
$retail_price = $currencies->display_price($product_info['retail_price'], tep_get_tax_rate($product_info['products_tax_class_id'])); 
echo $retail_price;
}
?>
</td>

Share this post


Link to post
Share on other sites
That is quite impossible. Are you aware of the fact that visitors are assumed to be retail customers, so are "treated" as having customers_group_id 0?

 

A. That is not the place to look for session information, because your customer hasn't logged-in yet.

B. You are showing the shopping cart session, that is not the PHP session.

 

Echo on product_info.php, preferably in the footer or somewhere else on the bottom:

echo '<!-- '; // start HTML comment: not showing this to the customer, only visible in the page source
echo '<pre>Session: <br>';
print_r($_SESSION);
echo '<br>';
echo 'Customer group id: <br>';
echo $customer_group_id;
echo '</pre>';
echo ' -->'; // end HTML commenting

You should see things like sppc_customer_group_id and lastly the customer group id as evaluated on that page.

 

+ So the Wholesale user isn't getting the discounted prices? I switched the ID #'s and I still just get the QPBPP prices from the first list of breaks in the product editor.

+ After applying the code above, I got the array stuff, but nothing about sppc at all. The bottom of the output did show:

	[customer_id] => 2
[customer_default_address_id] => 2
[customer_first_name] => ProTest
[customer_country_id] => 223
[customer_zone_id] => 22
)
<br>Customer group id: <br>0</pre>

 

So where am I going wrong if there's no sppc_customer_group_id?

 

Tired.

Share this post


Link to post
Share on other sites

I need to make sure SPPC is capable of the following:

+ Guests only see retail price.

+ Logged-in users see price break. (break(s) with qpbpp)

- Everyone sees the first prices entered into the product page. I can't make anyone see the second set of pricing.

 

 

Are there known tweaks/incompatibilities with:

STS 4.5.x

 

I backed out the changes that QPBPP made to SPPC and I still can't make the single price change for ANY user. It always shows the first price from the product editing screen. :/

Share this post


Link to post
Share on other sites
Is set when you log-in.

 

If the sppc_customer_group_id isn't there after login, either, then what? It doesn't show up. I get:

 

		)

[customer_id] => 2
[customer_default_address_id] => 2
[customer_first_name] => ProTest
[customer_country_id] => 223
[customer_zone_id] => 22
)
<br>Customer group id: <br>0</pre> --></body>

Share this post


Link to post
Share on other sites
If the sppc_customer_group_id isn't there after login, either, then what?

Perhaps with STS you load another login.php than the one you modded for SPPC?

Share this post


Link to post
Share on other sites

Thank you Jan - how does this look?

 

if ($where_clause) {

			$search_sql = "select * from ".TABLE_CUSTOMERS." where ".$where_clause;
			$search_query = tep_db_query($search_sql);

//BOF SPPC
	$sppc_customer_group_id = $search_query['customers_group_id'];
	for (sppc_customer_group_id) {
		tep_session_register('sppc_customer_group_id');
		tep_session_register('sppc_customer_group_show_tax');
		tep_session_register('sppc_customer_group_tax_exempt');				
		}
		global $customer_group_id;
		if(!isset($customer_group_id)) { $customer_group_id = '0'; }
//EOF SPPC			

			if (tep_db_num_rows($search_query)) {

			$info_box_contents[] = array('align' => 'center',
						 'text'  => TEXT_ADMIN_MATCHES);

 

Thanks!

 

Partially, you would also need to specify the variables $sppc_customer_group_id etc. before that, using the results of the query for the customer data like (for sppc_customer_group_id):

$sppc_customer_group_id = $check_customer['customers_group_id'];


~Tracy
 

Share this post


Link to post
Share on other sites
If the sppc_customer_group_id isn't there after login, either, then what? It doesn't show up. I get:

 

		)

[customer_id] => 2
[customer_default_address_id] => 2
[customer_first_name] => ProTest
[customer_country_id] => 223
[customer_zone_id] => 22
)
<br>Customer group id: <br>0</pre> --></body>

 

Swami - PM me with your email address and I will send you my login.php file for you to compare with yours. I do have Quantity Price Breaks for SPPC installed, as well as many other contrib's - so I'm sure there will be some differences between the my file and yours - but it might allow you to see if you are missing some necessary code, or if you have it in the wrong spot :thumbsup:

Edited by TracyS

~Tracy
 

Share this post


Link to post
Share on other sites
Thank you Jan - how does this look?

Not so good Tracy, not so good:

 

if ($where_clause) { // this brace doesn't "end" in this piece of code, is that OK?

			$search_sql = "select * from ".TABLE_CUSTOMERS." where ".$where_clause;
			$search_query = tep_db_query($search_sql);
			$search_query_result = tep_db_fetch_array($search_sql);

//BOF SPPC
	$sppc_customer_group_id = $search_query_result['customers_group_id'];
//		for (sppc_customer_group_id) {
  $customers_specific_taxes_exempt = $search_query_result['customers_specific_taxes_exempt'];
  $check_customer_group_tax = tep_db_query("select customers_group_show_tax, customers_group_tax_exempt, group_specific_taxes_exempt from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id = '" .(int)$check_customer['customers_group_id'] . "'");

$customer_group_tax = tep_db_fetch_array($check_customer_group_tax);
$sppc_customer_group_show_tax = (int)$customer_group_tax['customers_group_show_tax'];
$sppc_customer_group_tax_exempt = (int)$customer_group_tax['customers_group_tax_exempt'];
$sppc_customer_group_tax_exempt = (int)$customer_group_tax['customers_group_tax_exempt'];
$group_specific_taxes_exempt = $customer_group_tax['group_specific_taxes_exempt'];
if (tep_not_null($customers_specific_taxes_exempt)) {
	$sppc_customer_specific_taxes_exempt = $customers_specific_taxes_exempt;
} elseif (tep_not_null($group_specific_taxes_exempt)) {
	$sppc_customer_specific_taxes_exempt = $group_specific_taxes_exempt;
} else {
	$sppc_customer_specific_taxes_exempt = '';
}
		tep_session_register('sppc_customer_group_id');
		tep_session_register('sppc_customer_group_show_tax');
		tep_session_register('sppc_customer_group_tax_exempt');				
	 //   }
//			global $customer_group_id;
$customer_group_id = $sppc_customer_group_id;
//			if(!isset($customer_group_id)) { $customer_group_id = '0'; }

//EOF SPPC			

			if (tep_db_num_rows($search_query)) {

			$info_box_contents[] = array('align' => 'center',
						 'text'  => TEXT_ADMIN_MATCHES);

The group_specific_taxes might not be in your installation. It is from the latest version.

Share this post


Link to post
Share on other sites
Thank you Jan - how does this look?

Not so good Tracy, not so good:

 

if ($where_clause) { // this brace doesn't "end" in this piece of code, is that OK?

			$search_sql = "select * from ".TABLE_CUSTOMERS." where ".$where_clause;
			$search_query = tep_db_query($search_sql);
			$search_query_result = tep_db_fetch_array($search_sql);

//BOF SPPC
	$sppc_customer_group_id = $search_query_result['customers_group_id'];
//		for (sppc_customer_group_id) {
  $customers_specific_taxes_exempt = $search_query_result['customers_specific_taxes_exempt'];
  $check_customer_group_tax = tep_db_query("select customers_group_show_tax, customers_group_tax_exempt, group_specific_taxes_exempt from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id = '" .(int)$check_customer['customers_group_id'] . "'");

$customer_group_tax = tep_db_fetch_array($check_customer_group_tax);
$sppc_customer_group_show_tax = (int)$customer_group_tax['customers_group_show_tax'];
$sppc_customer_group_tax_exempt = (int)$customer_group_tax['customers_group_tax_exempt'];
$sppc_customer_group_tax_exempt = (int)$customer_group_tax['customers_group_tax_exempt'];
$group_specific_taxes_exempt = $customer_group_tax['group_specific_taxes_exempt'];
if (tep_not_null($customers_specific_taxes_exempt)) {
	$sppc_customer_specific_taxes_exempt = $customers_specific_taxes_exempt;
} elseif (tep_not_null($group_specific_taxes_exempt)) {
	$sppc_customer_specific_taxes_exempt = $group_specific_taxes_exempt;
} else {
	$sppc_customer_specific_taxes_exempt = '';
}
		tep_session_register('sppc_customer_group_id');
		tep_session_register('sppc_customer_group_show_tax');
		tep_session_register('sppc_customer_group_tax_exempt');				
	 //   }
//			global $customer_group_id;
$customer_group_id = $sppc_customer_group_id;
//			if(!isset($customer_group_id)) { $customer_group_id = '0'; }

//EOF SPPC			

			if (tep_db_num_rows($search_query)) {

			$info_box_contents[] = array('align' => 'center',
						 'text'  => TEXT_ADMIN_MATCHES);

The group_specific_taxes might not be in your installation. It is from the latest version.

Share this post


Link to post
Share on other sites

Success! TracyS's login.php code showed I was missing an all important reference. I probably had it in there at one point and modded myself right out of it. Since I was using STS, I couldn't see the session capture's success after login because I was using the product_info template.

 

NOTE TO OTHERS: Turn off STS's product_info template if you plan to use SPPC. Easy fix once the login.php was set right.

 

Thanks to Jan Z and TracyS! Your support has made OsC worthwhile.

 

I do have *one* more issue: My AttributePercentage mod no longer works. If you have ideas, great. If not, I'll be in their support thread readin their codez.

Share this post


Link to post
Share on other sites
I do have *one* more issue: My AttributePercentage mod no longer works. If you have ideas, great.

I'm not familiar with that contribution, but because of the new attribute group thing added in the last version I can imagine things going wrong there.

Share this post


Link to post
Share on other sites

Completely blank page for catalog/shopping_cart.php?action=update_product

 

Hi

After a lot of work, I have SPPC V4.2.0 and Multiple columns, which are mostly working thanks to the forums. But, Whenever I go to Cart Contents, an odd thing happens.

 

If I click ALL the checkboxes to remove all products from the cart, then the cart is updated and the next page displays as expected (ie I see shopping_cart.php displayed with 'Your shopping cart is empty!'.

 

However, if I don't check any products, or check only some of them for removal, then I see a completely blank page with .../catalog/shopping_cart.php?action=update_product as the browser address (and View Source is blank).

 

I don't know where to begin to look, and would appreciate some suggestions. I don't know a lot yet about php and don't know how the checkbox entries get processed for cart updating.

 

regards, John

Share this post


Link to post
Share on other sites
I don't know where to begin to look

Me neither. The code that processes that action can be found in application_top.php (switch $action, case: bla bla). Obviously your hosting provider has setup the server so that errors are not displayed to the visitor which is good practice for a production server but makes for lousy debugging.

 

Perhaps your hosting company keeps an error log instead for you to see what goes wrong?

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

×