If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / Unit price to change based on quantity

Unit price to change based on quantity

Started by dharrison on 20 May 2011, 5:58 AM · Views: 3,725

Results 1 to 20 of 28
20 May 2011, 5:58 AM
#1
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Unit price to change based on quantity

Hi all

I have run into a problem on our website. If I can use http://ergonomiceducationfurniture.co.uk/index.php?main_page=product_info&cPath=70&products_id=221 as an example, the unit price is determined on quantity. eg between 2-5 is price A, 6-11 Price B etc. This is selected and then the individual fills in the quantity box as to how many units they actually want.

The problem is, this is a) very fiddly and b) what's to stop the buyer selecting the cheapest price on the drop-down list and ordering a low quantity? As its payment online, by the time we've got the order they'd be very little we can do about it.

My question is, how can we resolve this? Is there an add-on (although I have looked and found nothing yet) or am I simply approaching this the wrong way?

Please, any help will be gratefully received.

Thanks in advance

Debbie Harrison
DVH Design | Web Design blog

20 May 2011, 7:18 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Unit price to change based on quantity

Instead of using attributes to select quantities and lower pricing, use the built-in Discount Quantities feature: https://www.zen-cart.com/tutorials/index.php?article=59

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

20 May 2011, 4:17 PM
#3
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Re: Unit price to change based on quantity

Thank you DrByte - that works better

However, rather than have a list of unit groups and prices, we did like the lowest cost being displayed and labelled "prices starting from:" Like how it shows up when you use attributes. How would we achieve that?

I hope you can help. :laugh:

Debbie Harrison
DVH Design | Web Design blog

23 May 2011, 5:43 AM
#4
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Re: Unit price to change based on quantity

Hi all

Following on from http://www.zen-cart.com/forum/showthread.php?t=180118 where I was using attributes to fix prices depending on the quantities order, I was just wondering how I can change the price field to read 'Prices from £xx' ?

I have basic knowledge of PHP, and can learn patterns of script easily if that helps.

Many thanks

Debbie Harrison
DVH Design | Web Design blog

23 May 2011, 2:58 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Unit price to change based on quantity

These articles may be of help if you're trying to replace existing wording with something else:
https://www.zen-cart.com/tutorials/index.php?article=38
https://www.zen-cart.com/tutorials/index.php?article=39

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

23 May 2011, 3:07 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Unit price to change based on quantity

Are you just trying to put the words:
Prices from

in front of the £275.00 ... :unsure:

And just to confirm ... who "owns" the price ... the Product or the individual Attributes?

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!

23 May 2011, 8:06 PM
#7
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Re: Unit price to change based on quantity

Hi Ajeh

That is correct. The prices are structured using Product price manager. The attributes just show the price for each unit so the client can see it.

When I did use attributes The lowest price was quoted with the prefix "Prices starting from". We would like to replicate that rather than showing the most expensive prices as we currently do.

Not all of our products are ordered in bulk so to just write a prefix in the language file would not work.

I hope this helps (and I hope I have explained that OK!) :blush:

Debbie Harrison
DVH Design | Web Design blog

23 May 2011, 10:34 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Unit price to change based on quantity

If you look at the template tpl_product_info_display.php and change it in your templates and overrides around line 71 to read:

  echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : 'Price from ') . zen_get_products_display_price((int)$_GET['products_id']);

Does that accomplish what you want? :unsure:

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!

24 May 2011, 9:38 AM
#9
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Re: Unit price to change based on quantity

Hi Ajeh

I wish it did! That just adds Prices starting from at the front of every cost.

Not all of our items are dependent on bulk orders. And it still lists the highest price regardless.

Thanks anyway :cry:

Debbie Harrison
DVH Design | Web Design blog

24 May 2011, 2:28 PM
#10
ajeh avatar

ajeh

Oba-san

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

Re: Unit price to change based on quantity

You could use an IF statement and check if the Product uses discount:

(zen_products_lookup((int)$_GET['products_id'], 'products_discount_type') !=0 ? 'Price from ' : '')

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!

24 May 2011, 3:48 PM
#11
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Re: Unit price to change based on quantity

In the same file on the same line?

Sorry but I have to check.

Debbie Harrison
DVH Design | Web Design blog

24 May 2011, 5:02 PM
#12
ajeh avatar

ajeh

Oba-san

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

Re: Unit price to change based on quantity

Where you currently have:
'Price from '

replace it with the new code and see if the IF statement makes the text work correctly for you ...

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!

25 May 2011, 6:19 AM
#13
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Re: Unit price to change based on quantity

Hi Ajeh

I replaced line 71 with

echo $one_time . (zen_products_lookup((int)$_GET['products_id'], 'products_discount_type') !=0 ? 'Price from ' : '');

Which just showed Prices From: and no price throughout the site.

I also tried:

if (zen_products_lookup((int)$_GET['products_id'], 'products_discount_type') !=0 ? 'Price from ' : '');

So the first one does work and shows prices from but I need to be able to list the lowest unit price as well. Sorry to be a pain. Maybe I'm not as PHP savvy as I thought! :D

I have had to change it back to how it was as we're seeing the boss today and showing him how it works.

Thanks for your help so far, I do appreciate it more than you know. :bigups:

Debbie Harrison
DVH Design | Web Design blog

25 May 2011, 1:25 PM
#14
ajeh avatar

ajeh

Oba-san

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

Re: Unit price to change based on quantity

I must have lost my mind on what I posted ...

This should post the Priced From when there are Discount Quanties made with Products Price Manager:

  echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : (zen_products_lookup((int)$_GET['products_id'], 'products_discount_type') !=0 ? 'Price from ' : '')) . zen_get_products_display_price((int)$_GET['products_id']);

Are you saying you need the Price to show the lowest Discount Quantity Price on display?

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!

25 May 2011, 8:51 PM
#15
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Re: Unit price to change based on quantity

Hi Ajeh

Yes. The lowest discount price.

Hope this helps.

Debbie Harrison
DVH Design | Web Design blog

26 May 2011, 1:18 AM
#16
ajeh avatar

ajeh

Oba-san

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

Re: Unit price to change based on quantity

See what this does for you:

echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : 'Price from ') . $currencies->display_price(zen_get_products_discount_price_qty((int)$_GET['products_id'], 999999), zen_get_tax_rate($products_tax_class_id));

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!

26 May 2011, 4:22 PM
#17
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Re: Unit price to change based on quantity

Hi Ajeh

That works but it also lists Prices starting from for all the products on the website now.

I shall see what the boss man thinks

Thank you so much :clap:

Debbie Harrison
DVH Design | Web Design blog

26 May 2011, 5:03 PM
#18
ajeh avatar

ajeh

Oba-san

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

Re: Unit price to change based on quantity

See if this one shows the
Prices From - Discount Quanties
Starting At: - Attributes
nothing - Regular Products

echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : (zen_products_lookup((int)$_GET['products_id'], 'products_discount_type') !=0 ? 'Price from ' : '')) . $currencies->display_price(zen_get_products_discount_price_qty((int)$_GET['products_id'], 999999), zen_get_tax_rate($products_tax_class_id));

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!

27 May 2011, 10:17 AM
#19
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Re: Unit price to change based on quantity

it works!!! Thank you sooo much. Donation has been made. :bigups:

Debbie Harrison
DVH Design | Web Design blog

27 May 2011, 1:15 PM
#20
ajeh avatar

ajeh

Oba-san

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

Re: Unit price to change based on quantity

Glad that this has helped and thanks for the support ... always a help to keep things rolling along ... :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!