Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2013
    Posts
    811
    Plugin Contributions
    0

    Default Product Discount Display

    example: https://jnsflooringandsupplies.com/T...Grouting_Float, ZC Version 1.56c,
    i have this
    Code:
    // 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);
                    $price = zen_get_products_actual_price((int) $_GET['products_id']);
                    $price = '$' . number_format($price, 2);
                    $bulkqty = $products_discounts_query->fields['discount_qty'];
    				$bulkpercent = round($quantityDiscounts[$columnCount]['discounted_price'] = $products_discounts_query->fields['discount_price']);
                    if ($cheapest != $price && (!stristr($price, "productSpecialPrice") ) && (!stristr($price, "call_for_prices") && ($calculator == 1))) {
                        echo 'Buy&nbsp;'. $bulkqty . '&nbsp;Sq.&nbsp;Ft.&nbsp;for&nbsp;' . $cheapest .'&nbsp;and&nbsp;save&nbsp;' . $bulkpercent.'%';
                  } else if ($cheapest != $price && (!stristr($price, "productSpecialPrice") ) && (!stristr($price, "call_for_prices") && ($calculator == 2))) {
                        echo 'Buy&nbsp;'. $bulkqty . '&nbsp;Sq.&nbsp;Ft.&nbsp;for&nbsp;' . $cheapest .'&nbsp;and&nbsp;save&nbsp;' . $bulkpercent.'%';
                     } else if ($cheapest != $price && (!stristr($price, "productSpecialPrice") ) && (!stristr($price, "call_for_prices") && ($calculator == 0))) {
                        echo 'Buy&nbsp;'. $bulkqty . '&nbsp;for&nbsp;' . $cheapest .'&nbsp;each&nbsp;and&nbsp;save&nbsp;' . $bulkpercent.'%';
                     }
                    ?>
    code to display my discounts like this
    Buy 60 for $8.92 each and save 8%
    but this does not show all discounts, just the last 1 in list.
    based on code above what do i need to add to it to make it show all fields in discount table?

  2. #2
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,682
    Plugin Contributions
    9

    Default Re: Product Discount Display

    jimmie,
    your code is.... well.... u know...

    there is no need for this var $products_discounts_query->fields[whatever] in this code. that is just taking the last record used.

    what you need is the var $quantityDiscounts, which you only use once, and in fact you end up replacing it with the above var.

    u need a loop as $quantityDiscounts is an array that contains all of your data.

    i'm just not sure why you are not using:

    includes/templates/template_default/templates/tpl_modules_products_quantity_discounts.php

    which will output all of the discounts.

    if you want to do it in your above code, you need to do something like:

    PHP Code:
             foreach ($quantityDiscounts as $discount) {
                                      
                       
    // do stuff with $discount, ie all of your calculations and then echoing to the screen.
                       // the next line will help you see....  hopefully
                     
    print_r($discount);
             } 
    hope that helps.

    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  3. #3
    Join Date
    Jan 2013
    Posts
    811
    Plugin Contributions
    0

    Default Re: Product Discount Display

    im sorry not understanding where to put your code. i tried but it prints it out as inputted in database, trying to style as my code

 

 

Similar Threads

  1. v139h Exclude a product from discount coupons or quantity discount
    By reiddg in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 1
    Last Post: 7 Aug 2014, 08:21 AM
  2. Attribute Quantity discount table display on product page
    By eric47905 in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 20 Nov 2013, 06:13 AM
  3. v150 On Product Display Page add text before Price when using Qty Discount & change Price
    By rufusclc in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 4 Jun 2013, 08:04 PM
  4. display group pricing discount in product listing
    By aeisecurity in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 29 Sep 2008, 02:17 PM
  5. How to display quantity discount box in product list?
    By tintin123 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 7 Oct 2007, 07:59 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR