Zen Cart Logo
Forums / All Other Contributions/Addons / Group Pricing Per Item Issue

Group Pricing Per Item Issue

Views: 60,102

Results 1 to 20 of 136
6 Mar 2007, 9:25 PM
#1
gdrudy avatar

gdrudy

New Zenner

Join Date:
Jun 2005
Posts:
23
Plugin Contributions:
0

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

7 Mar 2007, 4:37 PM
#2
gdrudy avatar

gdrudy

New Zenner

Join Date:
Jun 2005
Posts:
23
Plugin Contributions:
0

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.

14 Mar 2007, 9:02 AM
#3
lennypeng avatar

lennypeng

New Zenner

Join Date:
Nov 2004
Posts:
45
Plugin Contributions:
0

Re: Group Pricing Per Item Issue

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

22 Mar 2007, 12:06 AM
#4
tcarter avatar

tcarter

New Zenner

Join Date:
Mar 2007
Posts:
18
Plugin Contributions:
0

Re: Group Pricing Per Item Issue

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.

26 Apr 2007, 8:56 PM
#5
codemonger avatar

codemonger

New Zenner

Join Date:
Apr 2007
Posts:
3
Plugin Contributions:
0

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.

30 Apr 2007, 8:27 PM
#6
perelandra avatar

perelandra

New Zenner

Join Date:
Jun 2006
Posts:
12
Plugin Contributions:
0

Re: Group Pricing Per Item Issue

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!

2 May 2007, 2:39 AM
#7
codemonger avatar

codemonger

New Zenner

Join Date:
Apr 2007
Posts:
3
Plugin Contributions:
0

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!

2 May 2007, 10:28 AM
#8
beatnik avatar

beatnik

New Zenner

Join Date:
Aug 2006
Location:
London
Posts:
53
Plugin Contributions:
0

Re: Group Pricing Per Item Issue

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:

4 May 2007, 11:10 PM
#9
perelandra avatar

perelandra

New Zenner

Join Date:
Jun 2006
Posts:
12
Plugin Contributions:
0

Re: Group Pricing Per Item Issue

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.

5 May 2007, 4:46 PM
#10
codemonger avatar

codemonger

New Zenner

Join Date:
Apr 2007
Posts:
3
Plugin Contributions:
0

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!

5 May 2007, 10:08 PM
#11
perelandra avatar

perelandra

New Zenner

Join Date:
Jun 2006
Posts:
12
Plugin Contributions:
0

Re: Group Pricing Per Item Issue

CodeMonger, you are being most helpful! Thanks, I really appreciate it as I attempt to flounder around in the PHP... I didn't know the correct syntax and looks like your solutions would work, but… I've been looking at the functions_prices.php code and wondering if there isn't an alternative solution, at least for my purposes. I'd rather just nix the whole specials deal and have all customers be assigned to price groups. But, I'd like to show the regular price, and the discount for the group_pricers, and all the cute little red text etc., so I'm looking to see if I can integrate the group_price price into the display_special_price, display_sale_price code… dunno.. may be way over my head… I could use that luck now!

7 May 2007, 5:30 AM
#12
kgmmusic avatar

kgmmusic

New Zenner

Join Date:
Nov 2005
Posts:
76
Plugin Contributions:
0

Re: Group Pricing Per Item Issue

codeMonger's updates to the >shopping_cart.php< file in [includes/classes] worked like a charm when I updated the file manually.

Thank you!!!

18 May 2007, 7:36 AM
#13
auzzie avatar

auzzie

New Zenner

Join Date:
Apr 2007
Posts:
3
Plugin Contributions:
0

Re: Group Pricing Per Item Issue

Just wondering if anyone has experienced this issue.

When adding or updating a product the Group prices are not saving to the database.

EG: I enter the normal price, plus the prices for each group ie. Group A, Group B etc...

Save the updates. When I go back to edit the product again only the Normal price is showing none of the Group Prices have updated.

I am using Zen Cart version 1.3.7.

18 May 2007, 8:05 AM
#14
auzzie avatar

auzzie

New Zenner

Join Date:
Apr 2007
Posts:
3
Plugin Contributions:
0

Re: Group Pricing Per Item Issue

Please ignore the last post I have solved the problem.
I reinstalled the module.

20 Jun 2007, 5:05 AM
#15
vivaraquel avatar

vivaraquel

Zen Follower

Join Date:
Sep 2004
Location:
Australia
Posts:
305
Plugin Contributions:
0

Re: Group Pricing Per Item Issue

I am interested in using this odule but not interested in the hassles. Just wondering if the actual module download has been fixed or if I will need nedd to fix it manually.

Thank you.

24 Jun 2007, 5:52 AM
#16
happymom avatar

happymom

New Zenner

Join Date:
May 2006
Posts:
82
Plugin Contributions:
0

Re: Group Pricing Per Item Issue

vivaraquel:

I am interested in using this odule but not interested in the hassles. Just wondering if the actual module download has been fixed or if I will need nedd to fix it manually.

Thank you.

ZEN cart version: 1.3.7

Thanks codeMonger!!! I just copy your shopping_cart.php file to the right place and it worked !!!!! Finallly!!

To answer your question, vivaraquel, the file in the download area has not been updated. I just try it today [June 23, 2007] and I run into this problem. To be honest, I fiddle alot with the installation process, but I think this is the right order:

Install the group pricing patch.

Install the online group pricing patch. [The prices in the shopping cart are really messed up with this]

Then install/copy codeMonger's shopping_cart.php file in the right location (includes/classes)

This is what worked for me. Hopefully it will work for you too.

Thanks!

24 Jun 2007, 6:09 AM
#17
happymom avatar

happymom

New Zenner

Join Date:
May 2006
Posts:
82
Plugin Contributions:
0

Re: Group Pricing Per Item Issue

perelandra:

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.

After re-installing my database ... I noticed I had this same issue. I applied the database patch: "group_pricing_remove" and then the "group_pricing" and the prices show correctly now.

Hopefully this might help you too.

Thanks!

Norma

24 Jun 2007, 6:17 AM
#18
happymom avatar

happymom

New Zenner

Join Date:
May 2006
Posts:
82
Plugin Contributions:
0

Re: Group Pricing Per Item Issue

Never mind... please ignore my message.
After a new database upgrade, I'm am now having the same problem you did. :(

24 Jun 2007, 7:41 AM
#19
happymom avatar

happymom

New Zenner

Join Date:
May 2006
Posts:
82
Plugin Contributions:
0

Re: Group Pricing Per Item Issue

At first I thought this was a problem with the new version of zen 1.3.7 because I had both the group price and the online group price patches install on my older zen cart (version 1.3.0 ) but that is not true.

This problem has been there from the start. It also exists on my old version but I just didn't notice it.

This means that most likely it would be fixed. :(

Now I starting to wonder... how much do the zen-cart guru's would charge for a fix like this...

:unsure:

24 Jun 2007, 9:40 PM
#20
happymom avatar

happymom

New Zenner

Join Date:
May 2006
Posts:
82
Plugin Contributions:
0

Re: Group Pricing Per Item Issue

Hi,

I'm trying to fix the negative sale price that shows for the group pricing items when the group price is less than the sale price.

So, I grep for the "save:" keyword and it seems that these are the areas where the negative sale price is being calculated:


/catalog/admin/includes/functions/functions_prices.php

Line #204 : $show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . $show_discount_amount . PRODUCT_PRICE_DISCOUNT_PERCENTAGE . '</span>';

Line #207 : $show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . $currencies->display_price(($display_normal_price - $display_sale_price), zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . PRODUCT_PRICE_DISCOUNT_AMOUNT . '</span>';

Line #211 : $show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . number_format(100 - (($display_special_price / $display_normal_price) * 100),SHOW_SALE_DISCOUNT_DECIMALS) . PRODUCT_PRICE_DISCOUNT_PERCENTAGE . '</span>';

Line #213 : $show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . $currencies->display_price(($display_normal_price - $display_special_price), zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . PRODUCT_PRICE_DISCOUNT_AMOUNT . '</span>';


**catalog/includes/functions/functions_prices.php **

Line #242 : $show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . $show_discount_amount . PRODUCT_PRICE_DISCOUNT_PERCENTAGE . '</span>';

Line #245 : $show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . $currencies->display_price(($display_normal_price - $display_sale_price), zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . PRODUCT_PRICE_DISCOUNT_AMOUNT . '</span>';

Line #249 : $show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . number_format(100 - (($display_special_price / $display_normal_price) * 100),SHOW_SALE_DISCOUNT_DECIMALS) . PRODUCT_PRICE_DISCOUNT_PERCENTAGE . '</span>';

Line #251 : $show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . $currencies->display_price(($display_normal_price - $display_special_price), zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . PRODUCT_PRICE_DISCOUNT_AMOUNT . '</span>';


But when I change the way is calculating it, so that if the sale price is more than the regular price, it leaves the regular price, nothing happens. I even tried appending my name on the string being display and I didn't even see that.

Is the group price being identified by the $display_normal_price?

Can someone give an ideas as to what else could be happening?

My change was like this in line 211 (admin) and 245 (includes) in both admin and include files:


if $display_normal_price > $display_special_price then

//do line #211 calculate sale.
Line #211 : $show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . number_format(100 - (($display_special_price / $display_normal_price) * 100),SHOW_SALE_DISCOUNT_DECIMALS) . PRODUCT_PRICE_DISCOUNT_PERCENTAGE . '</span>';

else
//do not calculate sale. This a group pricing. Display $display_normal_price
//by doing this new line:
Line #new line: $show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . number_format(100 - (($display_normal_price / $display_normal_price) * 100),SHOW_SALE_DISCOUNT_DECIMALS) . PRODUCT_PRICE_DISCOUNT_PERCENTAGE . '</span>';


Thanks!