Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2008
    Location
    Pacific Northwest
    Posts
    40
    Plugin Contributions
    0

    Default MySQL query to change discount pricing group

    I'm working on a custom form that will allow members to enter a promotion code which will change their discount pricing group if it's valid.

    So far everything is working fine except that I'm not sure how to put together a MySQL query that will change 'customers_group_pricing' in the 'customers' table. Can someone point me in the right direction?

  2. #2
    Join Date
    Nov 2008
    Location
    Pacific Northwest
    Posts
    40
    Plugin Contributions
    0

    Default Re: MySQL query to change discount pricing group

    Well this is what I have so far. It seems to give me access to the table, but I'm still unsure of how to update value stored there.

    Code:
    $promo_query = "SELECT customers_group_pricing
                    FROM   " . TABLE_CUSTOMERS . "
                    WHERE  customers_id = :customersID";
    $promo_query = $db->bindVars($promo_query, ':customersID', $_SESSION['customer_id'], 'integer');
    $promo = $db->Execute($promo_query);
    Last edited by Ells; 19 Feb 2009 at 07:35 PM.

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

    Default Re: MySQL query to change discount pricing group

    The raw SQL for this is:
    Code:
    UPDATE customers SET customers_group_pricing = XX where customers_id = YY
    Now just translate that in your code to use the correct values for what customers_group_pricing and which customers_id ...

    If you look at some of the UPDATE statements via the Developers Tool Kit with a search on:
    update

    you should be able to see numerous examples of how UPDATE statements can be written ...

    See if that helps you some ...
    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!

  4. #4
    Join Date
    Nov 2008
    Location
    Pacific Northwest
    Posts
    40
    Plugin Contributions
    0

    Default Re: MySQL query to change discount pricing group

    Thanks! That is just what I needed. I'm learning SQL in the fly and didn't know what to look for.

    I now have something like this which seems to be working fine.

    Code:
    $promo_query = "UPDATE " . TABLE_CUSTOMERS . " SET customers_group_pricing = 1 where customers_id = :customersID";
    $promo_query = $db->bindVars($promo_query, ':customersID', $_SESSION['customer_id'], 'integer');
    $promo = $db->Execute($promo_query);

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

    Default Re: MySQL query to change discount pricing group

    Thanks for the update that this helped 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!

 

 

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. group pricing discount?
    By balihr in forum Managing Customers and Orders
    Replies: 2
    Last Post: 29 Jan 2009, 11:26 PM
  3. Group discount vs. sale pricing
    By aeolidia in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 1
    Last Post: 6 Jan 2008, 09:31 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
  5. Group Pricing + Quantity Discount
    By zilwiz in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 5
    Last Post: 20 Dec 2006, 01:48 PM

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