Forums / Templates, Stylesheets, Page Layout / Category index listing - products with qty discounts

Category index listing - products with qty discounts

Locked

Started by bodyjewelrystores on 13 Sep 2006, 12:23 AM · Views: 2,252

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
13 Sep 2006, 12:23 AM
#1
bodyjewelrystores avatar

bodyjewelrystores

Zen Follower

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

Category index listing - products with qty discounts

I'm using v1.3.0 (with the Column Grid Layout add-on).

Most of our products are going to have qty discounts. Currently, in the list of items in each category, it shows the base price for each item and an "add to cart" field (as long as the item doesn't have any attributes). When an item has qty discounts, this isn't very good - we want the customers to know immediately that they can get this item for lower prices if they order by bulk.

So, I'm looking to do the following changes to the category view:

  1. Instead of showing the base price of an item that has qty discounts - show the words "As low as" and then the lowest price that is available for this item (we enter all our qty discounts as "Actual Price" discounts, and the lowest one is always the last, i.e. for the highest quantity)

  2. For every item that has qty discounts - show a "more info" link instead of an "add to cart" field, just like the one that appears for items that have attributes. In other words, show this link whenever an items has attributes AND/OR qty discounts.

#1 would be more important. Any PHP wizards who can help? :dontgetit

Thanks in advance!

13 Sep 2006, 12:39 AM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Category index listing - products with qty discounts

Doing a search on lowest discount price came up with this thread ...

http://www.zen-cart.com/forum/showthread.php?t=45789

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!

13 Sep 2006, 11:16 AM
#3
bodyjewelrystores avatar

bodyjewelrystores

Zen Follower

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

Re: Category index listing - products with qty discounts

Thanks Linda!! Sorry for not thinking about doing a search myself. :blush:
However, I have a further question.

In the thread linked above, I saw a modification for includes/modules/product_listing.php, to do the "As low as:" thing. Worked great. However, it did this to all products, not just the ones with qty discounts.
So, I tried to modify the code a little - so that if the product doesn't have discount, the "As low as:" text won't show.

Thing is, it doesn't work - I ALWAYS get the "As low as" text no matter what....
Could you please take a look at the code below and tell me what went wrong??
(I know this is not very optimized... just want to know the principle)

Thanks!

         case 'PRODUCT_LIST_PRICE':    //MODIFIED BY ME
      $lc_baseprice = zen_get_products_display_price($listing->fields['products_id']);
      $lc_baseprice = number_format($lc_baseprice, 2);
		$lc_discprice = zen_get_products_discount_price_qty((int)$listing->fields['products_id'],20000);
		$lc_discprice = number_format($lc_discprice, 2);
		if ($lc_baseprice != $lc_discprice) {
			$lc_price = $lc_discprice;
			$lc_text='As low as: <b>$' . $lc_price . '</b><br/>';
		} else {
		  $lc_price = $lc_baseprice;
		$lc_text='<b>$' . $lc_price . '</b><br/>';
		}
13 Sep 2006, 1:12 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Category index listing - products with qty discounts

0 doesn't = $10.00 either ... :eek:

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!

13 Sep 2006, 4:17 PM
#5
bodyjewelrystores avatar

bodyjewelrystores

Zen Follower

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

Re: Category index listing - products with qty discounts

Sorry, but I don't quite understand :blush:

Are you saying I did something that causes $lc_baseprice to be always 0?

I'd appreciate it if you could point out my error, since I know as much about php as I know about taiwanese oyster diving (i.e. not much) :P

Thanks in advance.

13 Sep 2006, 5:31 PM
#6
bodyjewelrystores avatar

bodyjewelrystores

Zen Follower

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

Re: Category index listing - products with qty discounts

Nevermind!! Figured out the problem. Data types mismatch.

If anyone's interested, here's a corrected function. If there are qty discounts, it displays the base price + "as low as" + the lowest price... if there aren't any - just the base price:

("nicePrice" is a custom class I've added to the stylesheet - feel free to experiment)

case 'PRODUCT_LIST_PRICE':    //MODIFIED BY ME
$lc_baseprice = zen_get_products_display_price($listing->fields['products_id']);
$lc_discprice = zen_get_products_discount_price_qty((int)$listing->fields['products_id'],20000);
$lc_discprice = "\$" . number_format($lc_discprice, 2);
if ($lc_baseprice != $lc_discprice) {
	$lc_price = $lc_discprice;
	$lc_text = $lc_baseprice . ', as low as <span class="nicePrice">' . $lc_price . '</span><br/>';
} else {
	$lc_price = $lc_baseprice;
	$lc_text='<span class="nicePrice">' . $lc_price . '</span><br/>';
}