Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

Big thanks to all involved here - great contrib(s) and 83 pages of support! Can I ask a Hide from Groups question: pretty rare case - shop has 20+ groups.

 

To save ticking 19+ checkboxes for each product, could the Hide from Groups checkbox code be modified to serve as "show to this group" i.e. all boxes checked, by default, or a radio button or drop-down allowing the product to be shown to only one of the groups? I thought the answer was "yes, easily," ...until I tried!

 

<?php
  if (isset($pInfo->hide)) {
   echo tep_draw_checkbox_field('hide[' . $hide_customers_group['customers_group_id'] . ']',  $hide_customers_group['customers_group_id'] , (isset($pInfo->hide[ $hide_customers_group['customers_group_id']])) ? 1: 0);
  } else {
  echo tep_draw_checkbox_field('hide[' . $hide_customers_group['customers_group_id'] . ']',  $hide_customers_group['customers_group_id'] ,  (in_array($hide_customers_group['customers_group_id'], $hide_from_groups_array)) ? 1: 0);
  } ?>

Share this post


Link to post
Share on other sites
I was thinking about using this contribution (Shipping, Order Processing module, http://www.oscommerce.com/community/contributions,832) with SPPC.

 

This module offers many features that will be extremely useful on my site. My PHP skills are limited, could someone take a look at this to see if it will work with SPPC?

I couldn't download the latest version (which is still several years old :( ) so I don't know what is going on there. From a quick scan of the description, the purpose of the contribution and the files it looks like this does it job when SPPC has done his. Once an order is in the database, SPPC has nothing to do with anymore.
It would be great to incorporate this module into the next revision of SPPC.
They seem to do very different things, so personally I don't see why they shouldn't be kept separate.

Share this post


Link to post
Share on other sites

Jimmy,

Can I ask a Hide from Groups question: pretty rare case - shop has 20+ groups.

 

To save ticking 19+ checkboxes for each product, could the Hide from Groups checkbox code be modified to serve as "show to this group" i.e. all boxes checked, by default, or a radio button or drop-down allowing the product to be shown to only one of the groups? I thought the answer was "yes, easily," ...until I tried!

Tough one, since the states of unchecked boxes are not "posted", so you would have to figure out which ones would have been possible and then take out the ones that were posted. Not an easy one if you ask me.

 

I haven't looked at it, but wouldn't it be possible to add a button that triggers a piece of JavaScript that does a "Select all" on those checkboxes? I'm not very good in JavaScript to be honest, but I think I have done something like this in an (unrelated personal) project of mine (by mining the internet for something that did just that, so that I could adapt it for, for sure).

Share this post


Link to post
Share on other sites
Jimmy,

Tough one, since the states of unchecked boxes are not "posted", so you would have to figure out which ones would have been possible and then take out the ones that were posted. Not an easy one if you ask me.

 

I haven't looked at it, but wouldn't it be possible to add a button that triggers a piece of JavaScript that does a "Select all" on those checkboxes? I'm not very good in JavaScript to be honest, but I think I have done something like this in an (unrelated personal) project of mine (by mining the internet for something that did just that, so that I could adapt it for, for sure).

 

Thanks JanZ - I'll give the javascript method a try - could maybe even do it without a button, by using 'onload' (haven't thought that through either - it would work on a static page)! - I just thought my cat-sat-on-the-mat php was the problem! lol

 

I should stick to what I'm good at: cut&paste cut&paste cut&paste cut&paste :-"

Share this post


Link to post
Share on other sites
I couldn't download the latest version (which is still several years old :( ) so I don't know what is going on there. From a quick scan of the description, the purpose of the contribution and the files it looks like this does it job when SPPC has done his. Once an order is in the database, SPPC has nothing to do with anymore.

They seem to do very different things, so personally I don't see why they shouldn't be kept separate.

 

Don't bother. I installed the contrib. today and it is of little value. The description for the conttribution is better than the contribution.

 

You are right it does NOT belong with SPPC.

 

I am still trying to find a way to manage backorders and partial shipments. Any ideas?

Share this post


Link to post
Share on other sites

Dear Janz, First of all, I thank you for your help in your contribution, I have installed the Version 1.02 additional instructions for price break per category, everything works well in each category, however when the "update" function in shopping_cart.php relating several categories of products, it goes to a wrong result.

Please allow me to explain it in detail as follows:

Suppose there are two categories of A and B. A normal price is usd10/unit, and usd8/unit when order 3 units in one purchase. B normal order is usd3/unit and usd2/unit when 5 units in one order.

Your instructions for price break works well, if we order either A or B. But in case we try to order both A and B, for example 1 unit of A and 5 units of B, the respondent price of A is usd10/unit and B is usd2/unit, the calculation of total sum is usd20, it seems everything is correct. At this stage if we change order of A to 2 unit, then press "update" button, the respondent price A falls to usd8/unit(the corrcet price should be still usd10/unit, as the order does not reach the break quantity of 3 unit), the total sum wrongly shows usd26(the correct sum should be usd30). Even if we change nothing in that primary stage, but press "update" only, the oringal correct result goes wrongly as that A price drops to usd8/unit and the total sum drops usd18. Apparantly there has a bug in this "update" function which might plus each category order all together, makes both quantity reaching respective break orders.

I can not settle the problem, Janz, can you help me? Thanks in advance.

Share this post


Link to post
Share on other sites

shi xijia,

however when the "update" function in shopping_cart.php relating several categories of products, it goes to a wrong result.
Sorry, you are absolutely right. I now see that I made a small, crucial, and unbelievable stupid error in the class PriceFormatter.php to make it work correctly.

 

In the function loadProduct (around line 210) there is an $sql that starts around line 219. This is the start of it:

	$sql = "select pd.products_name, p.products_model, p.products_image, p.products_id," .
	" p.products_price, p.products_weight," .
	" 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_pri
ce4_qty, p.products_price5_qty,p.products_price6_qty,p.products_price7_qty,p.products_pri
ce8_qty," .
	" p.products_qty_blocks," .
	" p.products_tax_class_id," .
	" NULL as specials_new_products_price" .
	" from " . TABLE_PRODUCTS_DESCRIPTION . " pd," .
	"	  " . TABLE_PRODUCTS . " p" .
//   BOF Price Break for SPPC mod, price break per category
" LEFT JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " using(products_id) " .
//   EOF Price Break for SPPC mod, price break per category

Now the table products_to_categories is included in the sql since it is needed to find out what category the product is in. However, the field categories_id that we need for that is not in the "selected" fields :blush:

 

If you change it to:

	$sql = "select pd.products_name, p.products_model, p.products_image, p.products_id," .
	" p.products_price, p.products_weight," .
	" 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_pri
ce4_qty, p.products_price5_qty,p.products_price6_qty,p.products_price7_qty,p.products_pri
ce8_qty," .
	" p.products_qty_blocks," .
//   BOF Price Break for SPPC mod, price break per category
	" p.products_tax_class_id, categories_id," .
	" NULL as specials_new_products_price" .
	" from " . TABLE_PRODUCTS_DESCRIPTION . " pd," .
	"	  " . TABLE_PRODUCTS . " p" .
" LEFT JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " using(products_id) " .
//   EOF Price Break for SPPC mod, price break per category

it should work as promised.

Share this post


Link to post
Share on other sites
If anybody could offer some help on this, it would be greatly appreciated :)

 

http://forums.oscommerce.com/index.php?s=&...ndpost&p=725513

 

Thanks in advance

 

Anybody wanna through some ideas out for me to play with? I have this project lurking around that still needs done and I dont really know where to start. Guessing that adding a couple lines similiar to the others but calling out the SPPC pricing is all it needs.....I just dunno what to start hacking at. >_<

Share this post


Link to post
Share on other sites

Hi everyone,

 

I've not been on here for a while - my shop was working fine so I took a break from fiddling with the code :rolleyes: . Anyway I now have to build a new shop (long story) and rather than copy and adapt the old one I decided to start from scratch with all the latest versions of my favourite contributions etc. Looking for SPPC I see references to v4.1 but the contribution download page doesn't seem to have this? It has 4.0 complete then a few extras which appear to apply to 4.1 and 4.1.1 .... I have spent the last hour or so reading this thread and searching for various keywords but, eek 80+ pages, I'm getting a headache! You've been busy since I was last here :'(

 

help, anyone? Is 4.0 the one to install or am I missing 4.1 somewhere?

 

cheers,

 

dcmo

Share this post


Link to post
Share on other sites
Is 4.0 the one to install or am I missing 4.1 somewhere?
Nope, 4.1.1 is the one you need to install, the third entry at the moment: Version 4.1.1.: minor change. The second one is the HTML documentation of Marvin and the first one is the one you need if you use ACA (sorry haven't looked at it myself yet :blush: )

Share this post


Link to post
Share on other sites
Nope, 4.1.1 is the one you need to install, the third entry at the moment: Version 4.1.1.: minor change. The second one is the HTML documentation of Marvin and the first one is the one you need if you use ACA (sorry haven't looked at it myself yet :blush: )

 

Oops :blush: I have no idea why, when I looked at that list earlier, I thought "Version 4.1.1.: minor change" was only a change to apply to 4.1 and not the full download under that option :-" thanks JanZ

Share this post


Link to post
Share on other sites

Hi,

 

I am trying to set up a group for which checkout shipping page will be skipped and go direct to payment.

 

Any suggestions? thanks.

Share this post


Link to post
Share on other sites

Very early in "Manual Installation* the following words appear...

 

Modify the catalog\includes\languages\english\login.php file to include the Site Administrator's email address. This email address is used for wholesale account notifications. You can find the appropriate section of that file by doing a search for the keyword root.

 

Would someone please elaborate on exactly what is to be done? Perhaps I am missing something...

 

Thanks in advance!

Share this post


Link to post
Share on other sites

jlee,

 

I will try and share with you my understanding, and experience so far, with SPPC. However, there are others here with much more knowledge and understanding of this brilliant contribution, who will likely be able to assist you further should you need to be.

 

root@localhost is located in the contributions catalog\includes\languages\english\login.php file, which is included in the contribution. This file is meant to be uploaded as is after replacing root@localhost with whatever eMail address you are going to use to test/view the different group prices that you set-up.

 

I believe what the instructions are trying to say is; if you are not doing a manual install, you can search for the word "root" in the catalog\includes\languages\english\login.php file, and find where to replace root@localhost with the eMail address you are going to use for testing purposes.

 

The install instructions further suggest that you use "the Site Administrator's email address" (the eMail address that is set in the admin side of OSCommerce).

 

Where it might be a little confusing is that the instructions sort of imply that the eMail address used in the catalog\includes\languages\english\login.php file will be the address that receives the "wholesale account notifications", which is only going to be true if the address used is "the Site Administrator's email address", The instructions imply it has to be, and it does not have to be.

 

To clarify:

 

If when registering, a customer fills in the "Company's tax id number" field, created when installing SPPC, a wholesale account notification is sent to the Site Administrator's email address.

 

To test the SPPC install, you register a testing account on your WebSite. The eMail address you use when registering the testing account is the address that you would replace root@localhost with. Then, when you login using your testing account, you will have a choice of which group to login under, giving you the ability to view/test the different prices you have set for the different groups you have created. This feature is meant to save you the trouble of having to create a test account for each group you create.

 

I hope this helped some.

 

Regards,

 

Carlos

Share this post


Link to post
Share on other sites
jlee,

 

I will try and share with you my understanding, <snip...>

 

Thank you Carlos! The instructions were not clear about the NEW login.php file. I kept looking at the original and thinking this can't be right...

 

Any heads up about using this with the latest BTS?

 

Thanks again!

Share this post


Link to post
Share on other sites
Any heads up about using this with the latest BTS?

jlee,

 

If you have a basic understanding of how BTS is structured, there should be no problems with installing SPPC with it.

 

I think the best "heads up" I have to give is to note that there is an exceptional amount of useful and dependable information already available in this forum string.

 

With some exceptions, most of what I needed to know, to modify what I needed to modify, had been referred to somewhere here already. With that said, the support I received here when I couldn't find a solution already posted to a problem I was having, is by far the highlight of my OSCommerce experience to date.

 

Regards,

 

Carlos

Edited by carlost

Share this post


Link to post
Share on other sites

Hello,

 

Is there a way to disable the type of prices the user can see when they log in? I do not want to give business users the opportunity to look at retail.

 

The screen i am talking about is the one that appears right after you log on to the site.

 

Regards

 

M Parmar

Share this post


Link to post
Share on other sites

Hi,

 

Apologies if this has been answered elsewhere. I have spent ages trying to find an answer but have had no luck.

 

How can I have retail prices not display... ie, if someone has not logged in they aren't shown any prices at all?

 

TIA

Share this post


Link to post
Share on other sites
The screen i am talking about is the one that appears right after you log on to the site.
And only one person sees that screen, and that is the one who has his email address in languages/english/login.php:

// BOF Separate Pricing Per Customer
// define the email address that can change customer_group_id on login
define('SPPC_TOGGLE_LOGIN_PASSWORD', 'root@localhost');
// EOF Separate Pricing Per Customer

So no worries, however if you don't use Hide Price if $0 contribution or some other contribution that will hide the price until you login there is a good chance a business user will learn about the retail price...

 

 

How can I have retail prices not display... ie, if someone has not logged in they aren't shown any prices at all?
Isn't that what the Prices for Logged-In Users Only contribution does?

Share this post


Link to post
Share on other sites

Im wondering if somebody here could take a look at this problem im having and see if its possibly SPPC related.

 

http://forums.oscommerce.com/index.php?sho...07entry737507

 

Today I realized that im only having this problem(at least with what testing ive done today) when I log in as the store owner, not while loggin in as a customer with a regular account. When logging in as the store owner the SPPC group selection comes up fine, then when I continue form there I get the blank screen. It doesnt happen when I use my old configure.php file(which doesnt use the addon domain I have through my host) and it doesnt happen when login in as a normal customer. If I refresh on the blank screen i get the login screen with an error that says I used an invalid login/password BUT im actually logged in. Also most of the time I try to go to the checkout page I get a blank page.

 

Should be plenty of info in the above link as well as another link contained inside that post. If anybody thinks this could somehow be related to SPPC please let me know.

 

Thanks a ton :thumbsup:

Share this post


Link to post
Share on other sites
shi xijia,

......

it should work as promised.

 

Dear Janz,

 

One more question for price break per category comes! We have many subcategories under one main category. For instance, the cagegory of sports, includes basketball, soccer, baseball, and other subcategory. Our clients can enjoy preferrable price if buy 5 products in sports category, either all in main category or some in different subcategories.

 

However, we are not able to gather different items under same main category but different subcategory , they are always treated as different categories, i.e. if a client to buy 3 basketball products and 2 baseball products, he has to pay the bill in the normal price, because according to programme, he selected two categories, none has reached the promotion quantity, but actally it should be the same as to buy 5 sports products.

 

Therefore, Can you tell me how to achieve this funtion?

 

Thank you in advance.

 

LizzyShi

Share this post


Link to post
Share on other sites

Zvi Gat,

I am trying to set up a group for which checkout shipping page will be skipped and go direct to payment.
If you look at the code in checkout_shipping.php it is already skipped when all items are downloadable:

// if the order contains only virtual products, forward the customer to the billing page as
// a shipping address is not needed
 if ($order->content_type == 'virtual') {
if (!tep_session_is_registered('shipping')) tep_session_register('shipping');
$shipping = false;
$sendto = false;
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
 }

I assume you can do something similar if ($_SESSION['sppc_customer_group_id'] == 'xx') { etc.

 

However, for the invoice etc. I would use the code starting around 110 too:

   $free_shipping = true; // needed later on
		$quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
		$quote[0]['methods'][0]['cost'] = '0';

		  $shipping = array('id' => $shipping,
							'title' => (($free_shipping == true) ?  $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'),
							'cost' => $quote[0]['methods'][0]['cost']);

		  tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

Share this post


Link to post
Share on other sites
Im wondering if somebody here could take a look at this problem im having and see if its possibly SPPC related.
I can't see a reason why SPPC (login as shop owner) could cause that. Of course it is strange that you can succeed in 10% of the cases.

Just to be certain I would move the shop to the root directory (there is even a contribution: Store in root that explains it) if I were you. Something else to look at would be to check the url that is associated with the cookie when you login. Is it the old site or the new site?

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

×