Forums / Setting Up Categories, Products, Attributes / Percentage discount, is this possible?

Percentage discount, is this possible?

Locked

Views: 3,116

Results 1 to 16 of 16
This thread is locked. New replies are disabled.
30 Apr 2009, 11:30 AM
#1
eleven01 avatar

eleven01

New Zenner

Join Date:
Mar 2009
Posts:
28
Plugin Contributions:
0

Percentage discount, is this possible?

Hi all,

Hope somebody can help,
I have a product on which I need to set up a specific type of discount.

Basically what needs to happen is:
Customer adds product to basket, if they decide to raise their quantity they get a percentage discount based on price, so if their total for this product goes over £100 they get a 10% discount, if they add more of the same product and it goes over £200 they get a 20% discount.

Or is it possible to enter a percentage discount in the "Attributes Qty Price Discount" instead of a money discount? example:
9:0.00,19:-10%,29:-20%
I have tried entering this syntax but it just takes off £10 instead of 10%.
Help please!
Thanks.

30 Apr 2009, 2:17 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Percentage discount, is this possible?

The Products Price Manager will add discounts on the Product Price ...

The Attribute Quantity Discounts work on the Attributes dollar amount and apply a discount based on quantity ... but this is based on dollar amount ...

If you need that to be percentages, then you would need to customize the code for that ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

30 Apr 2009, 2:58 PM
#3
eleven01 avatar

eleven01

New Zenner

Join Date:
Mar 2009
Posts:
28
Plugin Contributions:
0

Re: Percentage discount, is this possible?

Hi, Thanks for the reply, so it is possible?
Which file(s) or bits of code would I need to look at to make this possible?
Thanks again.

30 Apr 2009, 3:17 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Percentage discount, is this possible?

I'd start with the Developers Tool Kit and do a search on the field for the Attributes Qty Discount and find all of the places where it is referenced to see where it would need adjusting ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

30 Apr 2009, 3:18 PM
#5
eleven01 avatar

eleven01

New Zenner

Join Date:
Mar 2009
Posts:
28
Plugin Contributions:
0

Re: Percentage discount, is this possible?

Thanks for the tip, I'll look into it.

Cheers.

5 May 2009, 10:47 AM
#6
eleven01 avatar

eleven01

New Zenner

Join Date:
Mar 2009
Posts:
28
Plugin Contributions:
0

Re: Percentage discount, is this possible?

Can anybody give me any hints on how to make this possible?
I'm in way over my head here.
Thanks.

5 May 2009, 11:15 AM
#7
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: Percentage discount, is this possible?

See PM. Start with Quantity Discounts and see if that works.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

6 May 2009, 10:33 AM
#8
eleven01 avatar

eleven01

New Zenner

Join Date:
Mar 2009
Posts:
28
Plugin Contributions:
0

Re: Percentage discount, is this possible?

Anybody give me any hints on how to adjust the code for this function? I'm sure soembody out there knows, but I can't figure it out.
There must be a way to set attribute qty discount field to accept percentages instead of just units of currency?
Anyone?
Thanks.

6 May 2009, 2:24 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Percentage discount, is this possible?

I have not tested this, but if you check the shopping_cart.php class file for:
zen_get_attributes_qty_prices_onetime

when it uses attributes_qty_prices ... that is getting the result of the amount based on the quantity passed to it ...

You could alter how that result is used and instead of being the new price for the attribute, you could take the existing attribute price and add that amount by using it as a percentage ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

7 May 2009, 9:12 AM
#10
eleven01 avatar

eleven01

New Zenner

Join Date:
Mar 2009
Posts:
28
Plugin Contributions:
0

Re: Percentage discount, is this possible?

Thanks for the response again Ajeh, you're very patient.
I have been trying your previous suggestion but can't seem to figure it out, (i'm fairly new to all this)
Is there a way to just enter the data in Attributes Qty Price Discount field like:

10:-10%,20:-20% etc
When I tried this it just discounted £10 instead of 10%.

Thanks again,

Any suggestions would be greatly appreciated.

7 May 2009, 6:26 PM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Percentage discount, is this possible?

No, you have to customize the code to make the amount work as a percentage ...

At this time, there is nothing built into the code for this ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

8 May 2009, 9:04 AM
#12
eleven01 avatar

eleven01

New Zenner

Join Date:
Mar 2009
Posts:
28
Plugin Contributions:
0

Re: Percentage discount, is this possible?

Once again thanks very much for the responses and your time,
I know I'm being a pain but does anyone out there know how to alter the code to make this work?
I'm sure I'm not the first person to have tried this?
Thanks.

8 May 2009, 1:54 PM
#13
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Percentage discount, is this possible?

Well ... it is really hard to sit down and write up all you have to do without actually writting all of the code to do this ... :blink:

The field attributes_qty_prices is used to obtain a "new price" base on quantity ...

What you want to do is change how this is used by searching for this field in the Developers Tool Kit:
attributes_qty_prices

and changing everywhere that calls this from being a "new price" to being a percentage that is then applied against the price ...

Example, in the shopping_cart.php class is the code:

            // attributes_qty_prices
            $added_charge = 0;
            if ($attribute_price->fields['attributes_qty_prices'] != '') {
              $added_charge = zen_get_attributes_qty_prices_onetime($attribute_price->fields['attributes_qty_prices'], $qty);

              $this->total += $qty * zen_add_tax($added_charge, $products_tax);
            }

What it is doing is getting the "new price" based on the attributes_qty_prices and quantity ...

What you really are wanting is to make a "new price" by using this same code but using it as a percentage of the attribute price ...

But more or less your work is in the shopping_cart.php class and the functions_prices.php functions ...

This is not an easy change, but it is not impossible either ... you just have to take your time relating the current attribute_qty_prices as being used properly as a percentage rather than a new price ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

11 May 2009, 8:22 AM
#14
eleven01 avatar

eleven01

New Zenner

Join Date:
Mar 2009
Posts:
28
Plugin Contributions:
0

Re: Percentage discount, is this possible?

Once again, thanks for your help,
I'll start digging into this and hopefully find the solution, will update if I do,
Thanks.

30 May 2009, 12:37 AM
#15
vandiermen avatar

vandiermen

Totally Zenned

Join Date:
Feb 2007
Posts:
518
Plugin Contributions:
1

Re: Percentage discount, is this possible?

Did you see the Quantity Discounts mod:
http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=235
I am hoping its going to help me with this problem

"This mod allows you to set up to five quantity discounts on a per item, per category or total item basis. Discounts may be expressed in dollars or percentages. A link is provided on the checkout page to show the customer how the discount was computed. No schema changes; only two new files and one modification to install.

30 May 2009, 1:18 AM
#16
vandiermen avatar

vandiermen

Totally Zenned

Join Date:
Feb 2007
Posts:
518
Plugin Contributions:
1

Re: Percentage discount, is this possible?

p.s.
in my case I dont think this will work as I am trying to set up a percentage discount on attribute or similar, but it does look like it will work for total purchase quantities