Zen Cart Logo
Forums / All Other Contributions/Addons / Online Group Pricing

Online Group Pricing

Views: 21,027

Results 1 to 20 of 123
6 Jan 2008, 2:55 AM
#1
darrell avatar

darrell

New Zenner

Join Date:
Feb 2005
Posts:
4
Plugin Contributions:
0

Online Group Pricing

I am trying to get the mod Online Group Pricing to work on the latest and greatest version of Zen Cart and I am having a problem. It is applying the group discount twice - once during product browsing and once during checkout.

I have tried just installing it, carefully patching the mod with the latest Zen Cart files, and running it all back at the 1.3.0 version for which the mod was designed. The mod works fine back at version 1.3.0, but no matter what I try, on the newest Zen version it applies the discount twice.

Unfortunately my customers, like most people, except to see their discounted price while browsing instead of just at the checkout. So, help getting this figured out would be greatly appreciated.

Attached is my patched version of the mod.

Thanks all!

9 Jan 2008, 2:56 PM
#2
hllight avatar

hllight

Zen Follower

Join Date:
May 2007
Location:
Port Charlotte, FL
Posts:
125
Plugin Contributions:
0

Re: Online Group Pricing

I am running the latest version of zencart on two sites and would VERY much like to install this feature. I will watch this thread but if you find a solution, would you be kind enough to let me know the fix? I have contacted my web person, and have asked him to see if he can find a solution. If he does I will let you know.

Harold

19 Jan 2008, 2:56 AM
#3
darrell avatar

darrell

New Zenner

Join Date:
Feb 2005
Posts:
4
Plugin Contributions:
0

Re: Online Group Pricing

I figured it out. Actually, a really easy fix - just hard to find.

I have been planning on get a fix posted, but have been just too busy. The mod contains zen files that have since been updated and I need to seperate the mod from the old zen files and then apply the mod to the newest zen files. (I hope that made sense.)

I will try to get it 'packaged up' this weekend. Send me a private message with your email - I would like some one else to test it before I post it.

Thanks

20 Jan 2008, 5:02 PM
#4
darrell avatar

darrell

New Zenner

Join Date:
Feb 2005
Posts:
4
Plugin Contributions:
0

Re: Online Group Pricing

Here is my fix to it. Hope it works for you. My change is in the ot_group_pricing.php file.

Darrell

24 Mar 2008, 10:30 AM
#5
fuzzybunny avatar

fuzzybunny

New Zenner

Join Date:
Sep 2007
Location:
Melbourne Australia
Posts:
60
Plugin Contributions:
0

Re: Online Group Pricing

Hi Darrell,

Your upgraded version of OGP works perfectly.

I installed on a new 1.3.8a install with a heap of other mods installed and not even a whisper of a problem

I think this is safe to stick up as a new version in the downloads section.

Well done!! :clap:

26 May 2008, 4:07 PM
#6
s_p_ike avatar

s_p_ike

Zen Follower

Join Date:
Feb 2005
Location:
Italy
Posts:
178
Plugin Contributions:
0

Re: Online Group Pricing

I found a bug in this contrib.

There's a problem with rounded prices (maybe only when product price has more than 2 decimals and only for certain values).

Example:

I had a product with base price 1.033 and a discount group ( well, not discount, the opposite) with 10% (so -10%, expecting the price to be raised by 10%)

So 110% of 1.033 is 1.1363, that rounded by 2 decimals should be 1.14

Everywhere in Zen Cart it results 1.14, but not in shopping cart, product info and so on (obviously after having installed this contrib) where it results 1.13 (you could say, wow a cent... yes in effect it is not really a matter of loosing money or something, but the client who look at this, doesn't understand, expecially if he is buyng 300 products (why 3 dollars / euro difference between product total and subtotal?).

So I looked at the function_prices.php file, into the function zen_get_products_display_price that has been modified by this contrib and found this code:

$display_normal_price = round(zen_get_products_base_price($products_id),2);
$display_special_price = round(zen_get_products_special_price($products_id, true) * $products_qty,2);
$display_sale_price = round(zen_get_products_special_price($products_id, false) * $products_qty,2);
//OGP end
$show_sale_discount = '';

// echo " -- " . $display_normal_price . " --";
//OGP start
$display_normal_price = round(zen_display_group_pricing($display_normal_price,$products_qty),2);

look at first and last lines, we have 2 rounding, so I simply removed the round form the first line and now my prices are correct.

Byez

26 May 2008, 9:09 PM
#7
darrell avatar

darrell

New Zenner

Join Date:
Feb 2005
Posts:
4
Plugin Contributions:
0

Re: Online Group Pricing

Nice catch s_p_ike! Bad math/code is a big deal - no matter how small the money amount.

If you have installed this mod, to make this fix -

Around line 205 of /includes/functions/functions_prices.php find:
```
$display_normal_price = round(zen_get_products_base_price($products_id),2);

	
Change to:
    ```
$display_normal_price = zen_get_products_base_price($products_id);

I attached new install files with this fix integrated.

Honestly, I do not have the desire to be the maintainer of this mod. My step-mother needed it and I fixed it for her and shared with the Zen community. I would love it it if some one stepped up and took care of this simple and yet obviously needed modification. Until then - I will do what I can to keep it going.

Thanks all.

27 May 2008, 8:33 AM
#8
s_p_ike avatar

s_p_ike

Zen Follower

Join Date:
Feb 2005
Location:
Italy
Posts:
178
Plugin Contributions:
0

Re: Online Group Pricing

Good work darrel ;)

In effect, the dev team could consider to include this mod in the official distribution, maybe with an option in configuration to activate it or not (ok this would require an extra bit of coding...), since I believe a lot of e-commerce need group pricing and almost all b2b need that their customers can see only the prices addressed to them.

28 May 2008, 4:18 AM
#9
hllight avatar

hllight

Zen Follower

Join Date:
May 2007
Location:
Port Charlotte, FL
Posts:
125
Plugin Contributions:
0

Re: Online Group Pricing

I contacted the author of the mod several months ago and I had him update a version for me. I have been using it without a problem since. If you encounter further problems, you may want to contact him directly.
He is a very nice guy to work with and really knows what he is doing.

7 Jul 2008, 11:19 PM
#10
fuzzybunny avatar

fuzzybunny

New Zenner

Join Date:
Sep 2007
Location:
Melbourne Australia
Posts:
60
Plugin Contributions:
0

Re: Online Group Pricing

Copy of email I sent to a.fragner (contributor of the contribution).

If anyone else can offer any siggestions or assistance that would be great.


Andreas,

Thanks for the great mod for Zen Cart and the updated files to work with attributes.

I recently updated to the latest version from the Zen downloads section: V0.21

I am working with ZenCart1.3.8a and have had no problems as far as compatibility is concerned. All functions work great apart from a couple of niggly issues.

It would be greatly appreciated if you could provide some help with two issues (the first being the most important).

  1.     Attributes:
         a)         When there is one attribute the application works beautifully. ref: <http://www.floriculture.com.au/index.php?main_page=product_info&cPath=37&products_id=168> 
         b)         When there are two attributes to a product the math for the cart total appears to be incorrect when the product is added to the cart.  The attributes I am using don’t particularly have a value, so the prices and weights values (in attributes controller) are usually set at zero.  When this is the case the product displays the correct price, but when added to the cart returns a zero balance in the shopping cart total, however the lines in the cart display correctly.  I have played with the attribute price values to get a work around, but nothing I am doing seems to work.  Currently the value of the first attribute is set at price factor 1.0 offest 0.5, with the values of the second attribute set at the default zero.  This has the same as the above where correct, however always displays the 50% discount group rate in the cart total regardless of the group discount rate.
    

c) From all of this I think it must be the math for the cart total that is not working correctly, however your knowledge of these functions is a lot better than mine.
d) ref: http://www.floriculture.com.au/index.php?main_page=product_info&cPath=37&products_id=103

  1.     Specials:
         a)         You had a note to contact you to enable GroupPricing also at special prices, so I am contacting you about that also.
    

I hope you are able to assist with the above issues/requests, as we work extensively with group pricing for a number of different customer levels with our site. Also, if we can get this module to work well with attributes it will make management of our products a LOT easier.

Thank you very much in advance for any help you can provide.


Again, any help anyone can provide would be greatly appreciated.

9 Jul 2008, 1:06 PM
#11
fuzzybunny avatar

fuzzybunny

New Zenner

Join Date:
Sep 2007
Location:
Melbourne Australia
Posts:
60
Plugin Contributions:
0

Re: Online Group Pricing

OK . . . .

Got the above issue worked out - had the special turned on - which affects some of the other functionality with this mod - and a decrease in value from attributes, which has to be a + for the mod to work.

BUT . . . I am still getting an addition problem with attributes.

If the attribute does not change the $ value all is OK.

If the attribute does change the $ value the shopping_cart (page and side box) display show only the "item base price" (wihtout the attribute change to the item price).

Also, if you are logged in as a dicount group member the shopping_cart (page and sidebox) list the adjusted total at the non-discount attribute amount.

ALL is fine when it gets to the checkout pages, but those values can't be transposed to the shopping cart pages.

The value that is not being calculated correctly is
$cartShowTotal
$product['productsPriceEach']
$product['productsPrice']

Has anyone had similar issues and come up with a fix, or does anyone know how to fix this?

Perhaps it is just as tweak in ../includes/classes/shopping_cart.php ???

Any help greatly appreciated.

Thanks, Max

10 Jul 2008, 12:16 AM
#12
fuzzybunny avatar

fuzzybunny

New Zenner

Join Date:
Sep 2007
Location:
Melbourne Australia
Posts:
60
Plugin Contributions:
0

Re: Online Group Pricing

I have isolated the issue to what appears to be a single error, which is the item and total $ values in the shopping_cart page and shopping_cart side box.

What “appears” to be happening in the math is that the shopping_cart total is using the correct group discounted value for the items base price, however the attribute price is being added at the full price (not the group discounted amount). The value displayed for the item in the shopping_cart is the correct group discounted value for the items base price, but without any adjustment for the attributes.


Explanation of attached pictures as an example of the problem:

In the pictures attached as an example, the shopper is a wholesale client and has a group discount of 50% discount off the database prices.

The database price for “alstroemeria” is $7.00, but with the 50% group discount the price is $3.50 per item, so 10x is $35. The attribute “Red / Burgundy” has an attribute +PriceFactor of .01 (or 10%), which increases the per item group value by $0.35 to $3.85, so the item should display at $3.85 and the total for 10x should display at $38.50. The shopping_cart total displays $42, which appears to be the group discount base $35 PLUS the non-discount attribute value, which for 10x would be $7 ($0.70 per item).

When we get to the checkout_ pages the $ totals (these screens do not have item values), including the attribute calculation are correct, so it seems the math in this area is working OK.

Also, after the order is confirmed and we look at the invoice from the admin side all the figures are correct, including the per item $ value displaying correctly at $3.85 (with the discounted attribute amount).

I hope someone can provide some assistance on this and that I have provided enough information for you to be able to make an “easy” evaluation of a fix.

Perhaps also a (not) returned value from "zen_display_group_pricing" in functions_prices.php ????

11 Oct 2008, 4:45 AM
#13
fuzzybunny avatar

fuzzybunny

New Zenner

Join Date:
Sep 2007
Location:
Melbourne Australia
Posts:
60
Plugin Contributions:
0

Re: Online Group Pricing

There is an erros in the code, which was isolated by someone doing another paid mod for me. The error, which can be fixed really easily is:

file: ../includes/modules/pages/shopping_cart/header_php.php

around line 281:
//OGP start
// $productsPrice = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');

$productsPrice = zen_get_products_display_price((int)$products[$i]['id'],(int)$products[$i]['quantity']);
// $productsPriceEach = $currencies->display_price(zen_get_products_display_price((int)$products[$i]['id']), zen_get_tax_rate($products[$i]['tax_class_id']), 1) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');

$productsPriceEach = zen_get_products_display_price((int)$products[$i]['id']);
//OGP end

Change to:

$productsPrice = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');

$productsPriceEach = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');

THIS ALSO FIXES THE ADDITION PROBLEMS ON THE SHOPPING CART PAGE. The shopping cart will now display the correct line items amount, reflecting the actual cost to the customer.

Hope fully if anyone else has noticed this problem this snippet of code will fix their problems also. . . . :lookaroun

11 Oct 2008, 10:00 AM
#14
fuzzybunny avatar

fuzzybunny

New Zenner

Join Date:
Sep 2007
Location:
Melbourne Australia
Posts:
60
Plugin Contributions:
0

Re: Online Group Pricing

Also . . .

This file and the problem seem to be isolated to OGP 0.11 & 0.12 The file had disappeared from the contribution in 0.21 - guess it still works??

What this means however, is that even if you install the new contribution the old files will still be there causing the problem.

Perhaps installing the new contribution and removing (or renaming) the old files that aren't there on the new one will fix the problem. Otherwise, just update the file as above to fix problems.

19 Nov 2008, 5:29 AM
#15
kadesign avatar

kadesign

Totally Zenned

Join Date:
Feb 2005
Location:
New Jersey
Posts:
593
Plugin Contributions:
0

Re: Online Group Pricing

I am getting en error when anyone that is assigned to a group discount is online. In admin when you view who's online or user tracking, I get the following error message:

Fatal error: Call to undefined function zen_display_group_pricing() in /home/mysite/public_html/includes/classes/shopping_cart.php on line 1076

Any ideas anyone???

Thanks,
Kelly

5 Sep 2009, 8:38 PM
#16
toniscraparoni avatar

toniscraparoni

Zen Follower

Join Date:
Apr 2009
Posts:
158
Plugin Contributions:
0

Re: Online Group Pricing

sleepless:

I am getting en error when anyone that is assigned to a group discount is online. In admin when you view who's online or user tracking, I get the following error message:

Fatal error: Call to undefined function zen_display_group_pricing() in /home/mysite/public_html/includes/classes/shopping_cart.php on line 1076

Any ideas anyone???

Thanks,
Kelly

Got my invitation to this party a little late. LOL! Same thing was happening to me . . . of course! ;)

The fix is to uncomment the code on the indicated line number in includes/classes/shopping_cart.php.

Hope this helps someone! :)

        $special_price = zen_get_products_special_price($prid);
        if ($special_price) {
        $products_price = $special_price;
        }
11 Sep 2009, 10:57 PM
#17
debbers avatar

debbers

New Zenner

Join Date:
Feb 2009
Posts:
15
Plugin Contributions:
0

Re: Online Group Pricing

ZenCart info:
Zen Cart 1.3.8a
Patch: 1::
Database Patch Level: 1.3.8

Security patch from June applied

There are a number of add-ons, including Admin_Profiles, Sales Report, CrossSell_Advanced, Newsletter discount, Zen Lightbox, hmmm, and others. None of these add-ons are recent.

So, I'm having trouble with this Online Group Pricing Add-On.

  1. I backed up the database
  2. I backed up the relevant files
  3. I applied the sql
  4. I ftp'd the files
  5. I went to log in to the admin page, and now receive this special error message:

Fatal error: Cannot redeclare zen_update_products_price_sorter() (previously declared in /path/to/my/admin/includes/functions/general.php:2525) in /path/to/my/admin/includes/functions/functions_prices.php on line 1334

I'm looking for suggestions what to do next to fix this. Luckily, I have the luxury of a Sandbox to test in, so this didn't happen in the live shop.

deb

12 Sep 2009, 4:20 AM
#18
hllight avatar

hllight

Zen Follower

Join Date:
May 2007
Location:
Port Charlotte, FL
Posts:
125
Plugin Contributions:
0

Re: Online Group Pricing

darrell:

I am trying to get the mod Online Group Pricing to work on the latest and greatest version of Zen Cart and I am having a problem. It is applying the group discount twice - once during product browsing and once during checkout.

I have tried just installing it, carefully patching the mod with the latest Zen Cart files, and running it all back at the 1.3.0 version for which the mod was designed. The mod works fine back at version 1.3.0, but no matter what I try, on the newest Zen version it applies the discount twice.

Unfortunately my customers, like most people, except to see their discounted price while browsing instead of just at the checkout. So, help getting this figured out would be greatly appreciated.

Attached is my patched version of the mod.

Thanks all!

I contacted a zen cart programmer named Andreas who wrote a mod that worked perfectly for me using 1.3.7.1. I have not upgraded to 1.3.8 so I cannot tell you if it will work on the latest version. His email address is: [email protected]
He was very responsive and the price was very reasonable. Since the program has already been written, I am sure he will work with you on getting it to work on the new version.

Good luck!

27 Mar 2010, 12:01 AM
#19
kes99 avatar

kes99

New Zenner

Join Date:
May 2009
Posts:
42
Plugin Contributions:
0

Re: Online Group Pricing

ToniScraparoni:

Got my invitation to this party a little late. LOL! Same thing was happening to me . . . of course! ;)

The fix is to uncomment the code on the indicated line number in includes/classes/shopping_cart.php.

Hope this helps someone! :)

    $special_price = zen_get_products_special_price($prid);
    if ($special_price) {
    $products_price = $special_price;
    }

Followed your advise but it didn't work for me....the code you say to uncomment is after the place where the error occurs:oops:
27 Mar 2010, 12:06 AM
#20
kes99 avatar

kes99

New Zenner

Join Date:
May 2009
Posts:
42
Plugin Contributions:
0

Re: Online Group Pricing

Turned on MSRP..but it displays all the time...How do you turn it off for non group members (normal customers)? As it is it displays the same price twice...duh....:oops: