Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

I don't know how easy this is for you to figure it out but I would add a new variable to the top of PriceFormatter.php like $this->retailPrice = -1;. Then in the function loadProduct I would add:
  // re-set qty blocks and min order qty to 1: do not use values for retail customers

 

Hi Jan,

 

Thanks so much for the instructions. I'm in the process of applying them and hopefully everything works out.

 

I have another question though...how can I get catalog/products_new.php and the New Products module (catalog/includes/modules/new_products.php) display the price like the priceStringShort function as in product_listing.php??? I want the price on the new products page and in the new products module to also say "From $..." if possible. I also have the featured products module added to my store and I know you have previously posted instructions for integrating SPPC with this addon. Hopefully there is a way to get featured_products.php to display "From $..." as well.

 

Thanks so much for your help! I really appreciate it!

 

Ricky

Link to comment
Share on other sites

When I installed the sppc hide contribution now the new products are showing up twice.

 

I am not sure where to start looking to fix this.

Me neither but I would start trying the query in phpMyAdmin and see if that gives double entries. If so return to the backup and see if that is OK. Then try again?

Link to comment
Share on other sites

I have another question though...how can I get catalog/products_new.php and the New Products module (catalog/includes/modules/new_products.php) display the price like the priceStringShort function as in product_listing.php??? I want the price on the new products page and in the new products module to also say "From $..." if possible. I also have the featured products module added to my store and I know you have previously posted instructions for integrating SPPC with this addon. Hopefully there is a way to get featured_products.php to display "From $..." as well.

I assume all these modules could be made to collect the same amount of info in the query as product_listing.php does and then sending it off to store that information in PriceFormatterStore so that it can be used to make instances of PriceFormatter and then call that to get the From $...

Never looked at that though.

Link to comment
Share on other sites

Hi

 

I wonder if somebody can point me in the right direction.

 

I've installed SPPC on an RC2 shop and I'm very happy with the way it's working at the moment but want to make some improvements.

 

I'm basically a wholesaler so have set up with customer groups allowing everybody to see pictures and product information but only wholesale customers to see prices (other customers just see £0.00)

 

I'd like to be able to show the number of stock available on the product information pages.

 

I found this contribution

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

 

Which seems to be what I want but will it work with SPPC or will it screw it up?

 

Terry

Link to comment
Share on other sites

Me neither but I would start trying the query in phpMyAdmin and see if that gives double entries. If so return to the backup and see if that is OK. Then try again?

 

Thanks for all your help JanZ.

 

The only products that are showing up twice is the ones that are in more than one category.

I did what you said and reverted to backup and products are only shown once.

I inserted the code in products_new as instructed and products are shown twice. reverted back and only inserted the $products_new_query_raw line and products are shown twice. I am thinking the problem is in this line:

 

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_status = '1' 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 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0 order by p.products_date_added DESC, pd.products_name";

 

can someone tell me how to go about breaking this line down to find out what is causing the products to show up twice.

 

Mike

Edited by paq1200
Link to comment
Share on other sites

The only products that are showing up twice is the ones that are in more than one category.

I did what you said and reverted to backup and products are only shown once.

I inserted the code in products_new as instructed and products are shown twice. reverted back and only inserted the $products_new_query_raw line and products are shown twice. I am thinking the problem is in this line:

 

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_status = '1' 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 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0 order by p.products_date_added DESC, pd.products_name";

 

can someone tell me how to go about breaking this line down to find out what is causing the products to show up twice.

OK, this is good debug information. You are right (I tried it). This is kind of a bug because adding in the categories makes the results of the query with the same products_id come up twice (once for each category) although we don't select the categories_id in the field list.

 

The solution is relatively simple. Change the query in products_new.php and the line that calls the class split_page_results.php to include 'p.products_id' and only distinct products_id's will be selected:

  $products_new_query_raw = "select distinct p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_status = '1' 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 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0 order by p.products_date_added DESC, pd.products_name";
 // EOF Separate Pricing Per Customer, hide products and categories from groups
 $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW, 'p.products_id');

Link to comment
Share on other sites

Would surprise me it that was a problem.

 

Hi Jan

 

Thanks for your reply.

You're right it does work if you use the installation option 2 rather than uploading whole files.

 

I just didn't want to muck up the SPPC which I think is a fantactic contribution.

 

 

Thanks again

Link to comment
Share on other sites

I am trying to make a new Wholesale only site. I have installed OS Commerce, Installed SPPC Version 422 and Hide Products and Catagories Version 2.03. I do not receive any errors but when I set a product to "hide from retail" it cannot be seen by anyone even users that are set up as wholesale customers. Any suggestions and something I might be missing.

Link to comment
Share on other sites

I do not receive any errors but when I set a product to "hide from retail" it cannot be seen by anyone even users that are set up as wholesale customers.

Products are hidden in very many places like reviews, product list, product_info, search etcetera. Are you telling us the product is completely invisible to all customers everywhere? And these wholesale customers, do they get wholesale prices so that you verified that part works OK?

Link to comment
Share on other sites

Products are hidden in very many places like reviews, product list, product_info, search etcetera. Are you telling us the product is completely invisible to all customers everywhere? And these wholesale customers, do they get wholesale prices so that you verified that part works OK?

 

Jan:

 

Thanks for the Quick reply. I did more testing and No the wholesale pricing is not working okay. So I will work on fixing that part. I set up one product with wholesale pricing but the wholesale customer did not see the wholesale pricing.

Link to comment
Share on other sites

I am trying to track down why my wholesale pricing is not working. I set up a group called Wholesale and then went in and edited a product to to include wholesale pricing. I then assigned a user to the wholesale group. But when that user logs in he does not see the wholesale pricing. Where in the database is the Wholesale price stored?

 

Thanks.

Link to comment
Share on other sites

I did more testing and No the wholesale pricing is not working okay.

Then likely the setting of the sppc_customer_group_id (in login.php) is not going well. Try echo'ing the session to check that (in footer.php for example) with:

echo '<pre>';
print_r($_SESSION);
echo '</pre>';

Link to comment
Share on other sites

Hi

 

I've added ulta pics which first of all knocked out the wholsale box information on the product/ catagories page but I managed to get it back by comparing code etc.

 

However although it appears on the page it does't accect any price changes.

 

Any deas what I've missed out.

 

 

Terry

Link to comment
Share on other sites

Can anybody tell me which part of admin/catagories.php controls the pat to update the price in the wholesale box.

I've tried to merge the code with a working version of SPPC with code for Ultra pics.

 

The ultra pics is actually working the part that has mucked is the SPPC

 

It isn't seeing any price in the wholesale box (can't be because no matter waht you put in shows 0.00)

 

Also I've now got multiple back update and acncel buttons at the bottom.

 

Any help would be appreciated.

 

 

Terry

Link to comment
Share on other sites

Can anybody tell me which part of admin/catagories.php controls the pat to update the price in the wholesale box.

I've tried to merge the code with a working version of SPPC with code for Ultra pics.

 

The ultra pics is actually working the part that has mucked is the SPPC

 

It isn't seeing any price in the wholesale box (can't be because no matter waht you put in shows 0.00)

 

Also I've now got multiple back update and acncel buttons at the bottom.

 

Any help would be appreciated.

 

 

Terry

 

 

Sorted the the multiple boxes !!!

 

Need help with the price updatibg issue

Link to comment
Share on other sites


Then likely the setting of the sppc_customer_group_id (in login.php) is not going well. Try echo'ing the session to check that (in footer.php for example) with:

echo '<pre>';
print_r($_SESSION);
echo '</pre>';

 

 

Jan:

 

This is what I received when I echoed the session per your instructions. What am I looking for? Sorry I am new to OSC.

 

Chuck

 

Array

(

[cart] => shoppingcart Object

(

[contents] => Array

(

[25] => Array

(

[qty] => 1

)

 

)

 

[total] => 69.99

[weight] => 8

[cartID] =>

[content_type] =>

[cg_id] => 0

)

 

[language] => english

[languages_id] => 1

[currency] => USD

[navigation] => navigationhistory Object

(

[path] => Array

(

[0] => Array

(

[mode] => NONSSL

[get] => Array

(

)

 

=> Array

(

)

 

)

 

[1] => Array

(

[mode] => NONSSL

[get] => Array

(

)

 

=> Array

(

)

 

)

 

[2] => Array

(

[mode] => NONSSL

[get] => Array

(

[cPath] => 1

)

 

=> Array

(

)

 

)

 

)

 

[snapshot] => Array

(

)

 

)

 

[customer_id] => 2

[customer_default_address_id] => 2

[customer_first_name] => Tom

[customer_country_id] => 223

[customer_zone_id] => 13


=> index.php

Link to comment
Share on other sites

This is what I received when I echoed the session per your instructions. What am I looking for?

When you login on login.php a number of SPPC specific session variables are set here:

// 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');
if (tep_not_null($sppc_customer_specific_taxes_exempt)) {
	tep_session_register('sppc_customer_specific_taxes_exempt');
}
// EOF Separate Pricing per Customer

So sppc_customer_group_id etc. From the "cg_id = 0" in there (used in the class shopping_cart.php: cart) you can see that SPPC then assumes you are not logged-in and have to be treated as retail customer (customer group id 0).

Link to comment
Share on other sites

When you login on login.php a number of SPPC specific session variables are set here:

// 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');
if (tep_not_null($sppc_customer_specific_taxes_exempt)) {
	tep_session_register('sppc_customer_specific_taxes_exempt');
}
// EOF Separate Pricing per Customer

So sppc_customer_group_id etc. From the "cg_id = 0" in there (used in the class shopping_cart.php: cart) you can see that SPPC then assumes you are not logged-in and have to be treated as retail customer (customer group id 0).

 

Jan:

 

Thanks for the quick response and for pointing me in the right direction. I reloaded login.php and now the wholesale seems to be working. I am going to make sure the hidden function is working properly also.

 

You are the best...

 

Chuck

Link to comment
Share on other sites

Can some one take a look at this and identifiy the problem? Here is what happens / Customer is not logged in but has a saved cart from a previous session. This customer is part of an SPPC group. The customer has Product Options and Products Hidden from them as well as certain products that are only shown to them. When they log in, the following error get generated::::

 

Warning: implode(): Bad arguments. in /home/content/j/e/t/jetcousa/html/includes/functions/general.php on line 1450
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 [b](I've marked the line nembers below as they appear in my editor)[/b]

select p.products_id, find_in_set('1', products_hide_from_groups) as hide_or_not, find_in_set('1', categories_hide_from_groups) as in_hidden_category from products p left join products_to_categories p2c using(products_id) left join categories c using(categories_id) where p.products_id in ()

[TEP STOP]

 

Here is the section that this error references from my Functions General:::

 

  function tep_get_hide_status($hide_status_products, $customer_group_id, $temp_post_get_array) {
  foreach ($temp_post_get_array as $key => $value) {
	$int_products_id = tep_get_prid($value);
// the November 13 updated MS2.2 function tep_get_prid 
// can return false with an invalid products_id 
	if ($int_products_id != false ) {
	  $int_products_id_array[] = $int_products_id;
	}
	$list_of_products_ids = implode(',', $int_products_id_array);  // <<<<<This is Line 1450
 } // end foreach ($temp_post_get_array as $key => $value)

 $hide_query = tep_db_query("select p.products_id, find_in_set('".$customer_group_id."', products_hide_from_groups) as hide_or_not, find_in_set('".$customer_group_id."', categories_hide_from_groups) as in_hidden_category from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_id in (" . $list_of_products_ids . ")"); // <<<<< This is the offending query. 

// since a product can be in more than one category (linked products) we have to check for the
// possibility of more than one row returned for each products_id where "hide_or_not"
// is the same for every row, but "in_hidden_category" can be different

 

I think I already have figured out that [[[ where p.products_id in () ]]] is the offending portion of my syntax error, but for the life of me I cannot figure out what I have ommitted. As long as the shopping cart is empty when the customer logs in, no error gets generated. Can some one help me out?? Thank you. . .

Link to comment
Share on other sites

Just in case this comes up >>>

 

I had a small typo. Be sure to pay close attention to your opening and closing parenthisi - I found it almost immediatly following my post when I cut and Pasted the lines into the BBS - Be sure to step back and use another editor or change the font to give yor eyes something to look at - -

 

From

 

p.products_id in (" . $list_of_products_ids . ")");

 

To

 

p.products_id in ('" . $list_of_products_ids . "')");

 

:rolleyes:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...