Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Help to create list of unique products based on attributes applied

    Hi Everyone,

    I have a requirement to create a list of unique products from an inventory on zen cart using the attributes that are set.

    For example products are listed like this:

    model 1000 with options small, medium, large
    model 1001 with options small, medium
    model 1003 eith options medium, large

    What I need to be able to do is build a query that will output a list like this:

    model 1000 - small
    model 1000 - medium
    model 1000 - large
    model 1001 - small
    model 1001 - medium
    model 1003 - medium
    model 1003 - large

    can anyone help with with the query please?

    I note that on the store there is never multiple attributes/combination attributes as I would think that that would make it near impossible to do but am hope what I want to achieve should be.

    Many thanks,

    Phil
    Phil Rogers
    A problem shared is a problem solved.

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

    Default Re: Help to create list of unique products based on attributes applied

    Quote Originally Posted by philip937 View Post
    Hi Everyone,

    I have a requirement to create a list of unique products from an inventory on zen cart using the attributes that are set.

    For example products are listed like this:

    model 1000 with options small, medium, large
    model 1001 with options small, medium
    model 1003 eith options medium, large

    What I need to be able to do is build a query that will output a list like this:

    model 1000 - small
    model 1000 - medium
    model 1000 - large
    model 1001 - small
    model 1001 - medium
    model 1003 - medium
    model 1003 - large

    can anyone help with with the query please?

    I note that on the store there is never multiple attributes/combination attributes as I would think that that would make it near impossible to do but am hope what I want to achieve should be.

    Many thanks,

    Phil
    Not sure what the true need is, but have you lookedat the available output of EasyPopulate ver 4? If not mistaken it offers this exact result if that is all that you are after.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Help to create list of unique products based on attributes applied

    ive not seen anything in easy populate 4. its a table join ?I need help with.

    To get what I need I need the product table joined with the attributes table and in turn joined with the table that contains the attributes name.

    so joining 'products' to 'products_attributes' with products_id then 'products_attributes' to 'products_options_values' with products_options_values_id

    If there is anyone that can help me build this query i'd be greatful for the help. Thanks
    Phil Rogers
    A problem shared is a problem solved.

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

    Default Re: Help to create list of unique products based on attributes applied

    Quote Originally Posted by philip937 View Post
    ive not seen anything in easy populate 4. its a table join ?I need help with.

    To get what I need I need the product table joined with the attributes table and in turn joined with the table that contains the attributes name.

    so joining 'products' to 'products_attributes' with products_id then 'products_attributes' to 'products_options_values' with products_options_values_id

    If there is anyone that can help me build this query i'd be greatful for the help. Thanks
    You mean both this won't do the trick for you and you didn't see it? It's been simplified down to the two pieces of data you were trying to display, but is essentially what you were after I thought, and EP4 can provide this as output to a file, so if you are trying to "reinvent" the wheel, was trying to save you some time unless there is some other need for the code to return that same type data.

    Code:
    SELECT
    p.products_model    as v_products_model,
    o.products_options_name             as v_products_options_name,
    FROM '
    .TABLE_PRODUCTS_ATTRIBUTES.     ' as a,'
    .TABLE_PRODUCTS.                ' as p,'
    .TABLE_PRODUCTS_OPTIONS.        ' as o,'
    .TABLE_PRODUCTS_OPTIONS_VALUES. ' as v
    WHERE
    a.products_id       = p.products_id AND
    a.options_id        = o.products_options_id AND
    a.options_values_id = v.products_options_values_id AND
    o.language_id       = v.language_id AND
    o.language_id       = 1 ORDER BY a.products_id, a.options_id, v.products_options_values_id'
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Help to create list of unique products based on attributes applied

    Cheers for this, i'll have a play.

    no I hadnt seen this as when I use EP4 the option values are liated agains individual items seperated by commas so on the face of it didnt appear to be somewhere I could look for the info.

    I'll have a play with what you posted cheers.
    Phil Rogers
    A problem shared is a problem solved.

  6. #6
    Join Date
    Jul 2012
    Posts
    16,734
    Plugin Contributions
    17

    Default Re: Help to create list of unique products based on attributes applied

    Quote Originally Posted by mc12345678 View Post
    You mean both this won't do the trick for you and you didn't see it? It's been simplified down to the two pieces of data you were trying to display, but is essentially what you were after I thought, and EP4 can provide this as output to a file, so if you are trying to "reinvent" the wheel, was trying to save you some time unless there is some other need for the code to return that same type data.

    Code:
    SELECT
    p.products_model    as v_products_model,
    o.products_options_name             as v_products_options_name,
    FROM '
    .TABLE_PRODUCTS_ATTRIBUTES.     ' as a,'
    .TABLE_PRODUCTS.                ' as p,'
    .TABLE_PRODUCTS_OPTIONS.        ' as o,'
    .TABLE_PRODUCTS_OPTIONS_VALUES. ' as v
    WHERE
    a.products_id       = p.products_id AND
    a.options_id        = o.products_options_id AND
    a.options_values_id = v.products_options_values_id AND
    o.language_id       = v.language_id AND
    o.language_id       = 1 ORDER BY a.products_id, a.options_id, v.products_options_values_id'
    I did just notice that this only returns/addresses option names/option features in the first/primary language of the cart. (Note: o.language_id = 1 in the "last" line)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Help to create list of unique products based on attributes applied

    thats cool I only need it in one language!
    Phil Rogers
    A problem shared is a problem solved.

  8. #8
    Join Date
    Jul 2012
    Posts
    16,734
    Plugin Contributions
    17

    Default Re: Help to create list of unique products based on attributes applied

    Quote Originally Posted by philip937 View Post
    Cheers for this, i'll have a play.

    no I hadnt seen this as when I use EP4 the option values are liated agains individual items seperated by commas so on the face of it didnt appear to be somewhere I could look for the info.

    I'll have a play with what you posted cheers.
    That I believe is the basic attribute export to which you are referring. The above comes from the detailed attribute list where more information is presented specific to a product and it's attribute.

    For anyone else following, as said, I trimmed down the list of output variables significantly to just the two for which you indicated you were looking: model# and option name. If I happened to miss a variable you wanted, don't worry you have any field within those four tables from which you can pull a piece of information if you like.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. v150 Pairing products based on attributes
    By hubert in forum General Questions
    Replies: 5
    Last Post: 12 May 2015, 02:00 PM
  2. Creating Unique Product Ids based on Attributes
    By TwitchDesign in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 9 Mar 2011, 08:42 PM
  3. Create a block to hold a list of products?
    By Cindy2010 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 7 May 2010, 05:30 AM
  4. Need to set up Unique downloads based on text attributes
    By nyrad in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 5 May 2010, 05:33 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