Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Oct 2004
    Location
    Southport, UK
    Posts
    4,237
    Plugin Contributions
    20

    Default How to show which discount group?

    The client offers a range of trade discounts set up in Group Pricing. He would like his customers to be able to see their trade discount level (i.e. 15%, 20% or 25%) when logged in.

    I understand that
    Code:
    if (isset($_SESSION['customer_id']))
    determines the logged in state, but not being a programmer, I'm not at all sure of the syntax for now creating the following query against that customer_id:

    IF a trade customer (ie in one of the 3 groups) DISPLAY the % allocated to that group.


    Can anybody rattle off the syntax for me please?
    Development Manager @ JSWeb Ltd
    Over 15 years with Zencart

  2. #2
    Join Date
    Oct 2004
    Location
    Southport, UK
    Posts
    4,237
    Plugin Contributions
    20

    Default Re: How to show which discount group?

    I've made a fair bit of progress using my standard trial and error technique, and I can get the results I want when I enter a known value of 'customer_id' into the SELECT command.

    However, can someone please tell me how to SELECT using the variable value of $_SESSION['customer_id']?

    Code:
    if (isset($_SESSION['customer_id'])) {
    				
    	$show='SELECT * FROM zen_customers WHERE customers_id=WHAT GOES HERE PLEASE;
    Development Manager @ JSWeb Ltd
    Over 15 years with Zencart

  3. #3
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: How to show which discount group?

    Try using:

    Code:
    $show="SELECT * FROM " . TABLE_CUSTOMERS . " WHERE customers_id='" . $_SESSION['customer_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: v1.5.5]
    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!

  4. #4
    Join Date
    Oct 2004
    Location
    Southport, UK
    Posts
    4,237
    Plugin Contributions
    20

    Default Re: How to show which discount group?

    THANK YOU!!
    Development Manager @ JSWeb Ltd
    Over 15 years with Zencart

  5. #5
    Join Date
    Feb 2006
    Posts
    11
    Plugin Contributions
    0

    Re: How to show which discount group?

    Hi!

    I'm not sure if it's the right place to follow up - but if I'm wrong, direct me.

    Befor I even found this thread I made this file: it shows the price in a table after
    "Product Price block" and before "free ship icon". Sorry for the quick hack...

    1) Add this between <!--eof Product Price block --> <!--bof free ship icon --> in the file includes/templates/*my_template*/templates/tpl_product_info_display.php - it should be around line #80:

    <!-- bof customers dicount info & price -->
    <?php
    echo display_group_pricings ((int)$_GET['products_id']);
    ?>
    <!-- eof customers dicount info & price -->


    2) Copy attached - and unzipped file - to includes/functions/extra_functions.

    P.S.
    Mind you, it might be some leftovers from the swedish language. If you do find such a word and do not the meaning of it - PM me and I'll answer back.
    Attached Files Attached Files
    Regards

    //
    // God is real,
    // unless declared integer.
    //

  6. #6
    Join Date
    Jul 2005
    Location
    Charlottesville, VA
    Posts
    431
    Plugin Contributions
    0

    Default Re: How to show which discount group?

    MissterX,

    I like your suggestion. I'd like to include the group pricing group name in the display. I've been playing around with how to include it in the product info display page, using your product_info_group_pricing_discount.php function, but I am not having success. Have you worked it out?

    This did not work:

    Code:
    $content .= $group_discount->fields['group_name'] . ' discount: <strong>' . 
                $group_pricing . '%</strong>.';
    I also tried inserting this after
    $group_pricing = (int)$q_sql->fields['g_p'];

    Code:
    $sql = 'SELECT group_name g_n FROM '.TABLE_GROUP_PRICING.' 
           WHERE group_id LIKE "'.$q_sql->fields['g_n'].'"';
    $q_sql = $db->Execute($sql);
    $group_name = $q_sql->fields['g_n'];
    and then:

    Code:
    $content .= $group_name . ' discount: <strong>' . 
                     $group_pricing . '%</strong>.';
    but that didn't work either. I'm just parroting what I see, I'm not a programmer .

    ---Diana

  7. #7
    Join Date
    Feb 2006
    Posts
    11
    Plugin Contributions
    0

    Default Re: How to show which discount group?

    Quote Originally Posted by dbrewster
    MissterX,

    I like your suggestion. I'd like to include the group pricing group name in the display. I've been playing around with how to include it in the product info display page, using your product_info_group_pricing_discount.php function, but I am not having success. Have you worked it out?

    ...
    Hi D.

    I think so.

    File: includes/functions/extra_functions/product_info_group_pricing_discount.php
    Line no: 8
    Code:
    $sql = 'SELECT group_percentage g_p FROM '.TABLE_GROUP_PRICING.' WHERE group_id LIKE "'.$q_sql->fields['cg_p'].'"';
    should be change to:
    Code:
    $sql = 'SELECT group_percentage g_p, group_name g_n FROM '.TABLE_GROUP_PRICING.' WHERE group_id LIKE "'.$q_sql->fields['cg_p'].'"';
    Line no: 14
    Add after it:
    Code:
    $group_name = $q_sql->fields['g_n'];
    Then you can put in the group name ($group_name) where you want.
    Regards

    //
    // God is real,
    // unless declared integer.
    //

  8. #8
    Join Date
    Jul 2005
    Location
    Charlottesville, VA
    Posts
    431
    Plugin Contributions
    0

    Default Re: How to show which discount group?

    Thank you MissterX, works like a charm!!

    This is so good, it should be a part of ZC.

    Here's my simplified display implementation, without the fancy tax calculation table:

    Code:
    $content .= '<div style="font-size:small; width:85%; background-color:#e9e9e9; 
    padding: 0.5em; margin: 0.5em">';
    $content .= $group_name . ' discount: <strong>' . $group_pricing . '%</strong>.';
    $content .= '</div>';

    ---Diana

  9. #9
    Join Date
    Nov 2006
    Posts
    3
    Plugin Contributions
    0

    red flag Re: How to show which discount group?

    Hi@ all, hi MissterX,

    this workaround i have long searched for.

    It works...but it seems to be not finally ?

    I have it putted as you descripted.


    All prices are rounded and looks crashed ":-":

    Your Discount: 5%.

    Total -16% MwSt MwSt
    Price 81:- 70:- 11:-
    -5% -4:- -4:-
    Your 77:- 66:- 11:-
    price

    The original price i.e. was here 81,14.

    Sorry for my bad english, im a german-user with some broken english in school and no good experience in programming.

    CU

  10. #10
    Join Date
    Nov 2006
    Posts
    3
    Plugin Contributions
    0

    Default Re: How to show which discount group?

    @ all :

    i forget some. i need two numbers behind komma :

    i.e. 81,14

    Who can i fix this ?

    CU

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v154 Group Pricing Discount and Discount Coupons show on checkout, paypal/eway charge full
    By edvon in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 5
    Last Post: 22 Sep 2015, 02:27 PM
  2. Set max discount for Group Discount + Discount + etc.
    By KEnik in forum Setting Up Specials and SaleMaker
    Replies: 0
    Last Post: 16 Jun 2010, 05:39 PM
  3. Group Discount - How to NOT apply other discounts?
    By jplanet in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 14
    Last Post: 9 Mar 2010, 03:16 PM
  4. Group pricing - show discount
    By stoscano in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 1
    Last Post: 27 Sep 2007, 06:55 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