Quantity Discounts

Locked

Started by zenlova on 21 May 2006, 1:14 AM · Views: 36,198

Results 41 to 60 of 73
This thread is locked. New replies are disabled.
7 Aug 2007, 9:43 AM
#41
infocom avatar

infocom

Zen Follower

Join Date:
Jul 2006
Location:
Cardiff, Wales
Posts:
308
Plugin Contributions:
0

Quantity Discounts

I also needed this solution and used the code but found some problems when using Special Discounts or a Sold Out Image etc. The code does not work when you use these. i.e. for Special Discounts I want the normal prioce crossed out and the savings displayed, but the code above results in the cheapest price showing and replacing the Specials Price.

So I changed the code to include a check to check for the substrings that are included when Special Price or an image we use when products are sold out and not to display the From cheapest price if they are. There of course maybe other scenarios not covered (the first line just puts cheapest price in the same format as the normal price to run the check).

$cheapest = "£".number_format(zen_get_products_discount_price_qty((int)$_GET['products_id'],20000),2);
$price = zen_get_products_display_price((int)$_GET['products_id']);
	
if ( $cheapest != $price && ( !stristr($price,"productSpecialPrice") ) && ( !stristr($price,"call_for_prices") ) )
{
	echo 'From: ' . $cheapest . '';
}
else
{
	echo $price;
}
7 Dec 2007, 7:02 PM
#42
ceobrad avatar

ceobrad

New Zenner

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

Re: Quantity Discounts

ZenLova:

Also I added the following to includes\modules\product_listing.php to give you this look with the price displayed on the product listing page (ex. http://www.promo2sell.com/index.php?main_page=index&cPath=25_48)

// case 'PRODUCT_LIST_PRICE':
// $lc_price = zen_get_products_display_price($listing->fields['products_id']) . '<br />';
// $lc_align = 'right';
// $lc_text = $lc_price;
// I made some mod's below this
case 'PRODUCT_LIST_PRICE':
// $lc_price = zen_get_products_discount_price_qty((int)$_GET['products_id'],20000);
$lc_price = zen_get_products_discount_price_qty((int)$listing->fields['products_id'],20000);
$lc_price = number_format($lc_price, 2);
$lc_text='<b><font color="red">As low as: $' . $lc_price . '</font></b><br>';

When I add this to my product_listing.php file, it does nothing. When products are listed they still show like they used to - shows highest price, not lowest quantity discount price. The only file that seems to change anything in this area is the tpl_tabular_display.php file. But when I edit that it takes the price off entirely. Editing the product_listing.php file does nothing.

I was able to figure out how to display the chepest price in the product info. But when it comes to the product listing, I am lost. Any ideas?

Kindest Regards,
Brad

3 Mar 2008, 1:11 PM
#43
jimmyyu1998 avatar

jimmyyu1998

New Zenner

Join Date:
Feb 2008
Posts:
14
Plugin Contributions:
0

Re: Quantity Discounts

ceobrad:

When I add this to my product_listing.php file, it does nothing. When products are listed they still show like they used to - shows highest price, not lowest quantity discount price. The only file that seems to change anything in this area is the tpl_tabular_display.php file. But when I edit that it takes the price off entirely. Editing the product_listing.php file does nothing.

I was able to figure out how to display the chepest price in the product info. But when it comes to the product listing, I am lost. Any ideas?

Kindest Regards,
Brad
Hi, there, I also have this problem. Any ideas?

Kindest Regards

Jimmy

7 May 2008, 2:47 PM
#44
darrels avatar

darrels

New Zenner

Join Date:
Jan 2008
Posts:
26
Plugin Contributions:
0

Re: Quantity Discounts

Jimmyyu1998:

Hi, there, I also have this problem. Any ideas?

Kindest Regards

Jimmy

exactly the same for me too, i can get it to display lowest price in product info but not product listing

16 May 2008, 6:53 PM
#45
mydanilo avatar

mydanilo

Totally Zenned

Join Date:
Dec 2004
Posts:
1,024
Plugin Contributions:
0

Re: Quantity Discounts

It DID work for me. Thank you. Hey guy's have you checked if you have
includes\modules\product_listing.php maybe already in a template folder?

includes\modules\YOUR_TEMPLATE\product_listing.php

If like me, you have the grid layout mod installed, you may have it already in the override structure as above.

Live and learn... the Zen way.

16 May 2008, 6:57 PM
#46
mydanilo avatar

mydanilo

Totally Zenned

Join Date:
Dec 2004
Posts:
1,024
Plugin Contributions:
0

Re: Quantity Discounts

Ryk:

What I want to do is only display the cheapest price (and accompanying text) when there ARE quantity discounts, but just the regular price when that's all there is.

I just can't work out what the conditional statement should be - I've managed to do it in the tpl_product_info_display.php, but it's got me beat in product_listing.php (mind you, it's waaay past my bedtime here so the brain cells are not really up to it!)

How did you do it in the tpl_product_info_display.php? I can't get the conditional going myself. :frusty:

Your solution for the product_listing.php works great, thank you.:clap:

Live and learn... the Zen way.

23 May 2008, 1:05 PM
#47
ronwong avatar

ronwong

Zen Follower

Join Date:
Jan 2006
Posts:
223
Plugin Contributions:
0

Re: Quantity Discounts

Hi, I need some help here, anyone. I put in the new code (first few lines), great, works, so now I have the 'As low as' and the lowest price.

Next step I am trying to do really is the conditional stuff. I am not a guy who like to 'confuse' with only the cheapest price. I want the single unit price shown then follow by the As low as price below IF there is one.

The code I improvised below, make use of if ($products_discount_type != 0) or if there is a quantity discount, then show the as low as price, else, just show the normal price. But it does not work, it just show the normal price. Did I miss something, anyone can open an eye?

 
 
case 'PRODUCT_LIST_PRICE':
if ($products_discount_type != 0) {
// $lc_price = zen_get_products_discount_price_qty((int)$_GET['products_id'],20000);
$lc_price = zen_get_products_discount_price_qty((int)$listing->fields['products_id'],20000);
$lc_price = number_format($lc_price, 2);
$lc_text='<b><font color="red">As low as: $' . $lc_price . '</font></b><br>';
}
else {
$lc_price = zen_get_products_display_price($listing->fields['products_id']) . '<br />'; 
$lc_align = 'right'; 
$lc_text = $lc_price; 
}
20 Jun 2008, 6:37 PM
#48
margecc avatar

margecc

Zen Follower

Join Date:
Feb 2007
Location:
Ontario, Canada
Posts:
234
Plugin Contributions:
0

Re: Quantity Discounts

Ok I've used Ryk's code from post #40 for my product listing page (Thanks for posting your work, much appreciated!!). It worked beautifully, except for one small problem. It is now displaying $0.00 on the price for things that are listed as "Call for Price", where nothing displayed before. Any idea's how to turn this off?

Anyone able to do it in the actual product listing yet?

http://transportation.actionforms.ca/cart/index.php?main_page=index&cPath=182_187_188_196

Thanks, Colleen
www.af-company.com
To err is human, but to really foul things up requires a computer. Farmers' Almanac, 1978

25 Jun 2008, 3:20 PM
#49
natemobley avatar

natemobley

New Zenner

Join Date:
Feb 2008
Posts:
8
Plugin Contributions:
0

Re: Quantity Discounts

I too have used Ryk's code and it works great in the category listing. Any ideas on how to get it to work in the all products listing (and possibly new products)?

3 Jul 2008, 7:18 PM
#50
margecc avatar

margecc

Zen Follower

Join Date:
Feb 2007
Location:
Ontario, Canada
Posts:
234
Plugin Contributions:
0

Re: Quantity Discounts

I still can't figure out how to get it not to show $0.00 instead of "Call For Price" when I applied this code.

Help please!

http://transportation.actionforms.ca/cart/index.php?main_page=index&cPath=203_205_208_210

Thanks, Colleen
www.af-company.com
To err is human, but to really foul things up requires a computer. Farmers' Almanac, 1978

19 May 2009, 6:20 PM
#51
goanna avatar

goanna

New Zenner

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

Re: Quantity Discounts

I implemented the code below and I am getting $0.00 on any items with a quantity discount on an attribute.

They are marked with "Price by attributes" in the admin area, yet it just pulls zeros instead of the actual lowest price.

// case 'PRODUCT_LIST_PRICE':
// $lc_price = zen_get_products_display_price($listing->fields['products_id']) . '<br />';
// $lc_align = 'right';
// $lc_text = $lc_price;
// I made some mod's below this
case 'PRODUCT_LIST_PRICE':
// $lc_price = zen_get_products_discount_price_qty((int)$_GET['products_id'],20000);
$lc_price = zen_get_products_discount_price_qty((int)$listing->fields['products_id'],20000);
$lc_price = number_format($lc_price, 2);
$lc_text='<b><font color="red">As low as: $' . $lc_price . '</font></b><br>';
5 Dec 2009, 6:35 AM
#52
adam2020 avatar

adam2020

New Zenner

Join Date:
Nov 2009
Posts:
33
Plugin Contributions:
0

Re: Quantity Discounts

This thread solved a problem bugging me for hours. Thanks Linda and ZenLova.

The site I used this code for is Australian with 10% tax so i added
a simple calculation so prices include 10% tax.

In tpl_product_info_display.php I replaced this:

<!--bof Product Price block -->
<h2 id="productPrices" class="productGeneral">
<?php
// base price
  if ($show_onetime_charges_description == 'true') {
    $one_time = '<span >' . TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION . '</span><br />';
  } else {
    $one_time = '';
  }
  echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']);
?></h2>
<!--eof Product Price block -->

With this:

<!--bof Product Price block --><h2 id="productPrices" class="productGeneral">
<?php
// base price
  if ($show_onetime_charges_description == 'true') {
    $one_time = '<span >' . TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION . '</span><br />';
  } else {
    $one_time = '';
  }
$cheapest = zen_get_products_discount_price_qty((int)$_GET['products_id'],20000);
$cheapest = number_format($cheapest, 2);

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

$Subtotal = $cheapest;
$Tax = round( (($cheapest * "10") / 100 ), 2);
$Total = ($Tax + $Subtotal);
?>
Subtotal: $<? echo $Subtotal; ?><br>
GST : $<? echo $Tax; ?><br>
Total: $<? echo $Total; ?><br>
</h2>
<!--eof Product Price block -->

:D

5 Dec 2009, 9:16 AM
#53
adam2020 avatar

adam2020

New Zenner

Join Date:
Nov 2009
Posts:
33
Plugin Contributions:
0

Re: Quantity Discounts

This is what i ended up using...

<!--bof Product Price block -->
<h2 id="productPrices" class="productGeneral">
<?php
// base price
  if ($show_onetime_charges_description == 'true') {
    $one_time = '<span >' . TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION . '</span><br />';
  } else {
    $one_time = '';
  }

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

    $cheapest = zen_get_products_discount_price_qty((int)$_GET['products_id'],20000);
    $cheapest = number_format($cheapest, 2);
    $tax = round( (($cheapest * "10") / 100 ), 2);
    $total = ($tax + $cheapest);
?>
Sub Total: $<? echo $cheapest; ?><br>
GST : $<? echo $tax; ?><br>
Total: $<? echo $total; ?>
</h2>
<!--eof Product Price block -->
11 Feb 2010, 9:10 AM
#54
carlepawell avatar

carlepawell

New Zenner

Join Date:
Feb 2010
Posts:
1
Plugin Contributions:
0

Re: Quantity Discounts

Hi..
I think you have to go with the problem in FAQ or you can use the internet for your zen-cart.

12 Mar 2010, 3:57 PM
#55
shelby89 avatar

shelby89

New Zenner

Join Date:
Dec 2007
Posts:
26
Plugin Contributions:
0

Re: Quantity Discounts

I am using Zen 1.38a with 1.10a quantity discount mod.
I want to discount 2nd and 3rd products from the same category by 25% but not the first item in the cart.
I have got it to work by using the currency amount. My problem is I want to exclude other product id's.
I edited the function Product Exclusion in file ot_quantity_discount but it didn't work. It's in the custom folder. When I add the excluded product to cart it still shows discount for 2 products.

Thanks, Shawn

12 Mar 2010, 4:01 PM
#56
shelby89 avatar

shelby89

New Zenner

Join Date:
Dec 2007
Posts:
26
Plugin Contributions:
0

Re: Quantity Discounts

Here is what my ot_quantity_discount file looks like

// Add products you wish to exclude to this list.
// Go to Admin->Catalog->Categories/Products->[Your category]
// and look at the left hand side of the list to determine
// product id. Note that 99999 and 99998 are just given
// as examples.
function exclude_product($prid) {
$id = (int)$prid;
switch($id) {
case 3:
return false;
}
return true;
}

3 is the product id I want to exclude.

Thanks, Shawn

12 Apr 2010, 11:14 PM
#57
genevieve avatar

genevieve

New Zenner

Join Date:
Sep 2009
Posts:
5
Plugin Contributions:
0

Re: Quantity Discounts

I'm running Zen Cart v1.3.8a/v1.3.8 and I've instituted the following code (which I got from page 3 of this thread) in my product_listing.php file to display the lowest price available with quantity discounts:

case 'PRODUCT_LIST_PRICE':
//	$lc_price = zen_get_products_discount_price_qty((int)$_GET['products_id'],20000);
$lc_price = zen_get_products_discount_price_qty((int)$listing->fields['products_id'],20000);
$lc_price = number_format($lc_price, 2);
$lc_text='As low as: $' . $lc_price . '<br>';

It works great on my category index pages main product listing area, but when I implement it in my new_products.php and featured_products.php module files, it displays the "As low as" price as $0.00 on every page that module is used on except the sub-category listing page. In other words it works here: http://babybeecards.com/index.php?main_page=index&cPath=1_3
but not here: http://babybeecards.com/index.php?main_page=index&cPath=1

On my new_products.php mod file the code looks like this:

while (!$new_products->EOF) {
    $products_price = zen_get_products_discount_price_qty((int)$new_products->fields['products_id'],20000);
    $products_price = number_format($lc_price, 2);
    $lc_text='As low as: $' . $products_price . '<br>';
    if (!isset($productsInCategory[$new_products->fields['products_id']])) $productsInCategory[$new_products->fields['products_id']] = zen_get_generated_category_path_rev($new_products->fields['master_categories_id']);

    $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><br />' . $lc_text);

Can anyone help me out?

13 Apr 2010, 7:41 PM
#58
cs_jono avatar

cs_jono

Inactive

Join Date:
Oct 2007
Posts:
187
Plugin Contributions:
0

Re: Quantity Discounts

I am sorry for my ignorance but I can't seem to find how to change this number that is controlling this $products_discount_type != 0 . where on the admin side do you control that? thanks!

Jono Herrington :: clevershoppers Inc.

13 Apr 2010, 7:45 PM
#59
cs_jono avatar

cs_jono

Inactive

Join Date:
Oct 2007
Posts:
187
Plugin Contributions:
0

Re: Quantity Discounts

nevermind...figured it out

Jono Herrington :: clevershoppers Inc.

24 May 2010, 7:51 PM
#60
aoren avatar

aoren

New Zenner

Join Date:
Sep 2008
Posts:
37
Plugin Contributions:
0

Re: Quantity Discounts

I used the code from page 3 on this thread so my code looks like this:

<strong><h2 id="productPrices" class="productGeneral">

<?php $cheapest = zen_get_products_discount_price_qty((int)$_GET['products_id'],20000); $cheapest = number_format($cheapest, 2); echo 'As low as: $' . $cheapest . '<br>'; // base price if ($show_onetime_charges_description == 'true') { $one_time = '<span >' . TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION . '</span><br />'; } else { $one_time = ''; } echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']); ?></h2></strong>

and now I have the "As low as..." working, but how do I get rid of the regular price from appearing underneath it?
You can see what I mean here:
http://blowoutparty.com/index.php?main_page=product_info&cPath=20&products_id=483