Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2009
    Posts
    128
    Plugin Contributions
    0

    Default SQL code to populate a wholesale column as a percentage of the product price.

    Hi,

    I have installed the addon "Dual Pricing" so now my table "products" as two columns:
    - "products_price"
    - "products_price_w"

    The column "products_price_w" is empty. for new products I'll set manually from the product admin the wholesale price, but I'd like to populate the "products_price_w" column for all the thousands of products I already have listed with a value calculated as 90% of the "products_price" (so all wholesale prices are discounted by 10%).

    Could you please tell me the SQL Query to populate the "products_price_w" as 90% value of "products_price"?
    It is an one time operation.

    Thank you very much.

  2. #2
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: SQL code to populate a wholesale column as a percentage of the product price.

    Quote Originally Posted by ilmarchez View Post
    Hi,

    I have installed the addon "Dual Pricing" so now my table "products" as two columns:
    - "products_price"
    - "products_price_w"

    The column "products_price_w" is empty. for new products I'll set manually from the product admin the wholesale price, but I'd like to populate the "products_price_w" column for all the thousands of products I already have listed with a value calculated as 90% of the "products_price" (so all wholesale prices are discounted by 10%).

    Could you please tell me the SQL Query to populate the "products_price_w" as 90% value of "products_price"?
    It is an one time operation.

    Thank you very much.
    Backup database before performing. Use tools->install SQL patches from the admin panel.

    Code:
    UPDATE products SET products_price_w = (0.9 * products_price);
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Aug 2009
    Posts
    128
    Plugin Contributions
    0

    Default Re: SQL code to populate a wholesale column as a percentage of the product price.

    Quote Originally Posted by mc12345678 View Post
    Backup database before performing. Use tools->install SQL patches from the admin panel.

    Code:
    UPDATE products SET products_price_w = (0.9 * products_price);
    Perfect, thank you!

  4. #4
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: SQL code to populate a wholesale column as a percentage of the product price.

    Quote Originally Posted by ilmarchez View Post
    Perfect, thank you!
    Glad to get some code right today... :) Glad it worked for you too.. :) Good luck!
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. Replies: 8
    Last Post: 26 Feb 2016, 11:58 PM
  2. v139h Mysql instruction to populate new price column?
    By ilmarchez in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 24 May 2015, 06:20 PM
  3. Replies: 9
    Last Post: 25 Mar 2013, 09:31 AM
  4. v150 Charge shipping a percentage of the product price
    By beyre in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 10 Sep 2012, 05:16 PM
  5. Replies: 3
    Last Post: 26 Nov 2007, 05:11 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