Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2011
    Location
    Lumberton, TX
    Posts
    527
    Plugin Contributions
    0

    Default Attributes and their place in the DB

    I have been examining the database tables in order to understand completely how products in an order are related to their attributes.

    A bit o prep for the question...if an order were to contain the following [model] - [Option1][Option1 Value] [Option2][Option2 Value] with three different combinations...

    Product 1 - Color: Red Size: Medium
    Product 1 - Color:Blue Size: Medium
    Product 1 - Color: Green Size: Medium

    Will there be three individual db entries for the same model number in the orders_products table? I do not see where anything says "yes" but it is the only way I can see how the orders_products_attributes table can get a link back to a specific line item in the order.

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,486
    Plugin Contributions
    88

    Default Re: Attributes and their place in the DB

    Quote Originally Posted by g2ktcf View Post
    I have been examining the database tables in order to understand completely how products in an order are related to their attributes.

    A bit o prep for the question...if an order were to contain the following [model] - [Option1][Option1 Value] [Option2][Option2 Value] with three different combinations...

    Product 1 - Color: Red Size: Medium
    Product 1 - Color:Blue Size: Medium
    Product 1 - Color: Green Size: Medium

    Will there be three individual db entries for the same model number in the orders_products table? I do not see where anything says "yes" but it is the only way I can see how the orders_products_attributes table can get a link back to a specific line item in the order.
    You'd wind up with 3 separate records in the orders_products table (one for each combination) and then 6 records total (2 attributes * 3 combinations) in the orders_products_attributes table; each of the records will contain the same orders_id value, pointing back to the overall order.

  3. #3
    Join Date
    Feb 2011
    Location
    Lumberton, TX
    Posts
    527
    Plugin Contributions
    0

    Default Re: Attributes and their place in the DB

    Quote Originally Posted by lat9 View Post
    You'd wind up with 3 separate records in the orders_products table (one for each combination) and then 6 records total (2 attributes * 3 combinations) in the orders_products_attributes table; each of the records will contain the same orders_id value, pointing back to the overall order.
    Perfect! Exactly what I thought it would have to be. THANKS!

  4. #4
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,149
    Plugin Contributions
    11

    Default Re: Attributes and their place in the DB

    The only time the orders_products table will have multiple, duplicate products_model entries is if the customer orders two of the model. Since each could still have separate attributes, they are tied together in the orders_products_attributes table.
    The order_id is tied to the orders_products_id and then to the orders_products_attributes_id
    The duplicate products_model entries are given separate orders_products_id. The separate orders_products_id entries then get the tied to the appropriate orders_products_attributes_id.

    Beat me to it.

  5. #5
    Join Date
    Feb 2011
    Location
    Lumberton, TX
    Posts
    527
    Plugin Contributions
    0

    Default Re: Attributes and their place in the DB

    Quote Originally Posted by dbltoe View Post
    The only time the orders_products table will have multiple, duplicate products_model entries is if the customer orders two of the model. Since each could still have separate attributes, they are tied together in the orders_products_attributes table.
    The order_id is tied to the orders_products_id and then to the orders_products_attributes_id
    The duplicate products_model entries are given separate orders_products_id. The separate orders_products_id entries then get the tied to the appropriate orders_products_attributes_id.

    Beat me to it.
    I appreciate it all the same!

 

 

Similar Threads

  1. Replies: 2
    Last Post: 1 Feb 2015, 03:35 PM
  2. How can I copy attributes AND their prices to multiple products / categories?
    By bendlikewillow in forum Setting Up Categories, Products, Attributes
    Replies: 17
    Last Post: 4 Feb 2014, 02:17 AM
  3. Customer backend for trusted partners to place their own automated orders?
    By d9000 in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 20 Mar 2013, 10:11 PM
  4. v150 give attributes their own colum in the shopping cart?
    By coreyalderin in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 18 Jun 2012, 04:48 AM
  5. A little problem in displaying the attributes and their image
    By public2009 in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 1 Apr 2009, 07:38 PM

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