Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2008
    Location
    Netherlands
    Posts
    26
    Plugin Contributions
    0

    Default new column in TABLE_ORDERS_PRODUCTS

    Hello,

    I'm new to ZC and am experiencing some hard times in finding my way around the scripts. Hopefully anyone can point me into the right direction.

    I added a new column (products_cost) in the products table and orders_products table.
    When an order is placed, I need the products_cost data to be inserted in to the new column in the orders_products table.

    Which files need to be edited to achive this?

    thank you for your time ;)
    cheers

  2. #2
    Join Date
    Aug 2005
    Posts
    26,038
    Plugin Contributions
    9

    Default Re: new column in TABLE_ORDERS_PRODUCTS

    As most things around this take place in includes/classes/shopping_cart.php this would be a good place to begin
    Zen-Venom Get Bitten
    Get Your Business Found

  3. #3
    Join Date
    Jan 2004
    Posts
    58,259
    Blog Entries
    3
    Plugin Contributions
    106

    Default Re: new column in TABLE_ORDERS_PRODUCTS

    If you look for references to TABLE_ORDERS_PRODUCTS in the /includes/classes/order.php file, you'll see where the insert happens. You'll have to add your extra field to the array of fields being passed to the zen_db_perform() function.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Oct 2008
    Location
    Netherlands
    Posts
    26
    Plugin Contributions
    0

    Default Re: new column in TABLE_ORDERS_PRODUCTS

    Thank you both very much for your reply.

    Before I posted my question here in the forum, I edited the orders class so it inserts the data in TABLE_ORDERS_PRODUCTS.
    Also the shopping_cart class was changed to retreive data out of TABLE_PRODUCTS.

    Now what happens is that the inserted data is zero, while it should insert the data from TABLE_PRODUCTS.

    What am I missing here?

  5. #5
    Join Date
    Jan 2004
    Posts
    58,259
    Blog Entries
    3
    Plugin Contributions
    106

    Default Re: new column in TABLE_ORDERS_PRODUCTS

    If you want to keep it simple, then instead of changing the shopping_cart class, why don't you just read the data from the products table fresh when you need it (in the orders class just before writing to the orders_products table), especially since the data has no relevance to the customer?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Oct 2008
    Location
    Netherlands
    Posts
    26
    Plugin Contributions
    0

    Default Re: new column in TABLE_ORDERS_PRODUCTS

    That's probably a good idea. Sometimes I want to desperately keep all codes as original as possible...without any reason.

    The past year I worked quite intence with phpbb3, which was, along with its community forums, my main learning school for mysql and php. Now starting with zc while thinking it would be the same as phpbb 3, i find myself lost many times

 

 

Similar Threads

  1. Column layout grid for product listing - one column only
    By london mummy in forum Templates, Stylesheets, Page Layout
    Replies: 15
    Last Post: 26 Oct 2009, 10:06 AM
  2. Setting an image column and text column in Product Info page?
    By monkeypeach in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 1 Sep 2008, 04:19 AM
  3. Admin errors: 1054 Unknown column 'untries_id' , and 1052 column is ambiguous
    By kayamaya in forum Installing on a Linux/Unix Server
    Replies: 4
    Last Post: 9 Aug 2008, 04:40 AM
  4. third column beyond main wrapper, product description moving beyond third column
    By Capslock118 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 10 Jul 2007, 01:42 AM
  5. Column Grid Layout on 1.3.7 (single column problem)
    By Taipa in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 12 May 2007, 11:44 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
  •