Group Pricing Per Item Issue
I have installed the mod for Group Pricing Per Item. This is exactly what I was looking for.
All installed well and fine. When I converted an account over to Group A Pricing, the correct pricing appeared on the product info page and the other product listing sites.
However, the price reverted back to the normal retail price on the shopping cart page. And in the shopping cart sidebox.
I have made sure all files are properly uploaded. I can't seem to understand what the problem is.
Has anyone else had this issue and know a fix for it?
I am using the latest version of zen cart.
thanks
Re: Group Pricing Per Item Issue
Anyone have a similar issue?
I previously was using the dual pricing add on when I had v1.2.6 cart.
When I upgraded, I decided this mod would be better. And I really need to get it working.
I have looked at the code and cannot figure out why it is wiping out the wholesale price when it gets to the shopping cart page or listing the prices in the shopping cart side box.
Re: Group Pricing Per Item Issue
Quote:
Originally Posted by
gdrudy
Anyone have a similar issue?
I previously was using the dual pricing add on when I had v1.2.6 cart.
When I upgraded, I decided this mod would be better. And I really need to get it working.
I have looked at the code and cannot figure out why it is wiping out the wholesale price when it gets to the shopping cart page or listing the prices in the shopping cart side box.
I get the same problem, the unit price in the shopping cart is the new group price but the total in the shopping cart shows retail. However, when I go ahead with the checkout process, everything seems find, the total showing in the payment confirmation page is the right one. It must be a bug somewhere but I can't find it, can anyone provide a bug fix? Thanks
Re: Group Pricing Per Item Issue
Quote:
Originally Posted by
lennypeng
I get the same problem, the unit price in the shopping cart is the new group price but the total in the shopping cart shows retail. However, when I go ahead with the checkout process, everything seems find, the total showing in the payment confirmation page is the right one. It must be a bug somewhere but I can't find it, can anyone provide a bug fix? Thanks
I have a similar problem, except mine shows normal retail price on the product page, then it shows the new price in the shopping cart.
from what ive gathered from your posts, is its literaly the opposite.
Re: Group Pricing Per Item Issue
I had the same issue too. I looked at the code and think I found the problem. I am no zen cart guru, far from it in fact; However, there appears to be a problem with the scope of the $customers_group variable. This is used in the calculate function of the shopping_cart.php file. Calculate calls reset() and then proceeds to use the $customer_group variable to decide which price should be used in calculating the total. The problem is that the $customers_group variable is local to the reset() function and is blank by the time calculate() starts using it.
To fix this I did the following:
1. Created a global variable at the of shopping_cart.php ($this->customers_group)
2. Made sure reset() was actually setting the global variable.
3. Put a one liner in calculate() to set the local customers_group = $this->customers_group.
Not clean but it works. Not sure if somebody else didn't fix this already, but, figured I would post just the same. Appears to work for me.
Re: Group Pricing Per Item Issue
Quote:
Originally Posted by
codeMonger
To fix this I did the following:
1. Created a global variable at the of shopping_cart.php ($this->customers_group)
2. Made sure reset() was actually setting the global variable.
3. Put a one liner in calculate() to set the local customers_group = $this->customers_group.
Really, really bummed to discover this doesn't work correctly. I had the same issues with the displaying the non-discounted prices etc. For those of us that are even further away from being zen gurus could you please elaborate on the specifics of what you did to tweak this. Which "shpping_cart.php" file (in classes?) did you edit and could you please be so kind as to upload an edited version? Thanks so much!
1 Attachment(s)
Re: Group Pricing Per Item Issue
Sorry I wasn't specific. I have attached the shopping_cart.php file in zip format. I am using Zen Cart 1.3.7 plus I have added a few other modules, so, be careful with just uploading my shopping_cart.php (in the includes/classes directory) as it may clobber something you have installed different from me. Specifically, here is what I changed:
1. Lines 63-67 of the file comment and create a global variable called $customers_group. ("var $customers_group;")
2. Line 221 I make sure that the global customer_group is set when the reset function is called. ("$this->customers_group = $customer_group->fields['group_name'];")
3. Line 622 sets the customer_group, local to the calculate function, equal to the global variable I created in #1 and set in #2. Definitely cleaner ways to code but I really didn't have time to tinker. ("$customers_group = $this->customers_group;") In essence this saves you from having to change all the lines with $customers_group in them.
I would recommend copying and pasting the specific lines mentioned into your existing file so that you don't break something else.
Best of luck!
Re: Group Pricing Per Item Issue
Quote:
Originally Posted by
TCarter
I have a similar problem, except mine shows normal retail price on the product page, then it shows the new price in the shopping cart.
from what ive gathered from your posts, is its literaly the opposite.
Hiya all,
Same prob, tried above fix, but didn't fix it.
Sure must be little bug and someone will find it soon, otherwise excellent little contrib.
Thanks :blink:
Re: Group Pricing Per Item Issue
Quote:
Originally Posted by
codeMonger
Best of luck!
thank you codeMonger! No luck needed, that did the trick... very kind of you to upload that!... only now come to find out GPPI doesn't play at all nice with "special pricing" or "salemaker". Really wacked... e.g. displays:
$196.60 $233.46
Save: -19% off
where $196.60 is the group price (strike through in zen cart) and $233.46 (in red) is the "special" price. Calculates a minus percentage! The right price shows up correctly in the shopping cart but this looks really wacky on the products display. It looks like the code in shopping_cart.php is supposed to turn off the special_price when group_price (// exclude group price) is active, but doesn't look like it's working, or I'm not reading it correctly.
Re: Group Pricing Per Item Issue
Yep, I had assumed the code was correct and didn't take the time to look at it in detail. At first glance I would say the problem is the use of $customers_group as a condition in the if statements [if($customers_group) ] Not really safe code. All $customers_group needs is a space character in it to cause problems. There is an assumption made by this condition that the data will never be in error and we all know what happens when we ASSUME.:shocking: This wasn't a problem when we set the $products_price variable because we explicitly looked for $customers_group == "Group A" etc. and we have no else clause. So, worst case it drops through the if statement with the same price it had originally. I don't have time to tinker today.... but, if you want a quick and dirty fix I would start with the following change
CHANGE
// exclude group price
if(!$customers_group)
{
TO THIS
// exclude group price (SOLUTION A)
if($products_price != $product->fields['products_price'])
{
OR TO THIS
// exclude group price (SOLUTION B)
if($customers_group != "Group A" && $customers_group != "Group B" && $customers_group != "Group C" && $customers_group != "Group D" )
{
Solution A: should work because we just want to know if we have changed the price. If the price is not the original price don't dork around with special pricing.
Solution B: should work because we look specifically for "Group A", "Group B" etc. One possible gotcha here -> we never check that $products->fields['products_group_b_price'] != 0. So, we might have a situation where Group A is set but no price was set. That might be goofy:D as the Group X price might be $0.00. Looks like, worst case, that would lead to a situation where special_price is not used even though we are still, unknowingly, using the original price.
Looks like there are 5 or 6 places were if(!$customers_group) is used as a condition. May want to look at them all. I will look at it later and post if I don't see your post first. Good Luck!