Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Targeting specific products in product listing

    I haven't found what I'm looking for - so I don't know if it's just never been asked before (ha!) or if I'm just not putting in the right search terms (more likely).

    I have a client who will be selling some limited edition items. I've placed the "Limited Edition" items in their own separate category, but because they share some of the same attributes of other products, they will show up in other categories as well.

    To clarify, I'll use the example of slippers. We'll say her limited edition stuff is pink fuzzy bunny slippers. But because they are pink, then they'll also show up in the "slippers by color" category, under "pink". Or when listing all items available, then they'll show up in there, as well.

    Now, when she runs out of these pink fuzzy bunny slippers - she's out, and will sell no more of them. She wants to have a "snipe" (apparently an actual term used in printing - so I guess next time I take my little brother on a "snipe hunt" he can actually look for one! LOL) go across regular items when they are sold out to say "Sold out, available soon". But if the Limited Edition stuff is sold out, she simply wants it to say "Sold Out" and nothing more.

    Now, I know on the individual "product details" page, I could do this, because I can use the stylesheet to specifically target that product ID, and issue forth the correct style to do what she wants. But when it comes to the alternate listings...is there a way to target specific items in the listing pages so if a regular item is sold out, it'll say "more soon", but if a Limited Edition item is right next to it in the listing, it'll just say "sold out"?

    I didn't know if I could do this, so I didn't want to say "sure I can!" and then eat my words later on. I suppose I could do something like edit the field to set a class that shows the product ID for each individual listing...

    But that's me thinking out loud. Would anyone know if this is a possibility?

  2. #2
    Join Date
    Jan 2005
    Location
    USA, St. Louis
    Posts
    3,710
    Plugin Contributions
    9

    Default Re: Targeting specific products in product listing

    Quote Originally Posted by doodlebee View Post
    I haven't found what I'm looking for - so I don't know if it's just never been asked before (ha!) or if I'm just not putting in the right search terms (more likely).

    I have a client who will be selling some limited edition items. I've placed the "Limited Edition" items in their own separate category, but because they share some of the same attributes of other products, they will show up in other categories as well.

    To clarify, I'll use the example of slippers. We'll say her limited edition stuff is pink fuzzy bunny slippers. But because they are pink, then they'll also show up in the "slippers by color" category, under "pink". Or when listing all items available, then they'll show up in there, as well.

    Now, when she runs out of these pink fuzzy bunny slippers - she's out, and will sell no more of them. She wants to have a "snipe" (apparently an actual term used in printing - so I guess next time I take my little brother on a "snipe hunt" he can actually look for one! LOL) go across regular items when they are sold out to say "Sold out, available soon". But if the Limited Edition stuff is sold out, she simply wants it to say "Sold Out" and nothing more.

    Now, I know on the individual "product details" page, I could do this, because I can use the stylesheet to specifically target that product ID, and issue forth the correct style to do what she wants. But when it comes to the alternate listings...is there a way to target specific items in the listing pages so if a regular item is sold out, it'll say "more soon", but if a Limited Edition item is right next to it in the listing, it'll just say "sold out"?

    I didn't know if I could do this, so I didn't want to say "sure I can!" and then eat my words later on. I suppose I could do something like edit the field to set a class that shows the product ID for each individual listing...

    But that's me thinking out loud. Would anyone know if this is a possibility?
    It can be done... though its a bit complicated.

    I recently did something *similar* for a client. What I did was for a certain category, when you went to that category, it listed the three products in the category, but there was no way to "link" to that actual product... so the customer would be forced to click the "buy now" on that page, without actually going to the product.

    I edited includes/modules/product_listing.php, to basically say "If the master_categories_id != 16 , then show the regular code, else, show this code" (!= mean does not equal).

    Assuming that you'd want the changes you want both on the categories page with the listed products (like I did above) AND on the ALL PRODUCTS page, then you'd make your changes to includes/modules/YOUR_TEMPLATE/product_listing.php, AND includes/templates/YOUR_TEMPLATE/templates/tpl_modules_products_all_listing.php

    So basically, you'd edit the section where it shows the sold out button, and you'd say "If product is not in this certain category, show this sold out button, BUT if it is in this certain category, show this sold out button".

    Now, since the sql code for both the all products and the category products listing does not query for the master_categories_id, you have to make a change in the sql query (I can tell you how to do this, if you still want to proceed after reading how complicated it is, LOL) so that it does ask for the products master_categories_id.

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

    Default Re: Targeting specific products in product listing

    If the master category for the slippers is the limited edition category, you could probably create an if statement for the sold out image to show the plain sold out when the master category = catid. In other words, if you copied from the limited edition cat as a link (versus copy) to the pink category.

    Regardless of where the item shows up, it should still track its master category id.
    A little help with colors.
    myZenCartHost.com - Zen Cart Certified, PCI Compatible Hosting by JEANDRET
    Free SSL & Domain with semi-annual and longer hosting. Updating 1.5.2 and Up.

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

    Default Re: Targeting specific products in product listing

    had this sitting open and didn't realize it had been answered so well. Should have refreshed before fininishing.
    A little help with colors.
    myZenCartHost.com - Zen Cart Certified, PCI Compatible Hosting by JEANDRET
    Free SSL & Domain with semi-annual and longer hosting. Updating 1.5.2 and Up.

  5. #5
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Re: Targeting specific products in product listing

    Now, since the sql code for both the all products and the category products listing does not query for the master_categories_id, you have to make a change in the sql query (I can tell you how to do this, if you still want to proceed after reading how complicated it is, LOL) so that it does ask for the products master_categories_id.
    Here I am, trying to figure out why it's not working. I'm like halfway there, and then I read this part of your answer. That'll teach me not to read *everything* first ;)

    Yes, I'd be interested in how to edit the SQL query. Actually, I'm not afraid of doing that, I've edited a few SQL queries in my time. But if you already have the method of doing it worked out, it would save me some time from trying to figure it out on my own. I'd really appreciate it if you could pass that long to me :)

  6. #6
    Join Date
    Jan 2005
    Location
    USA, St. Louis
    Posts
    3,710
    Plugin Contributions
    9

    Default Re: Targeting specific products in product listing

    Quote Originally Posted by doodlebee View Post
    Here I am, trying to figure out why it's not working. I'm like halfway there, and then I read this part of your answer. That'll teach me not to read *everything* first ;)

    Yes, I'd be interested in how to edit the SQL query. Actually, I'm not afraid of doing that, I've edited a few SQL queries in my time. But if you already have the method of doing it worked out, it would save me some time from trying to figure it out on my own. I'd really appreciate it if you could pass that long to me :)
    IF I remember correctly, (my brains already moved on from this, lol, it can only hold so much before the old stuff is deleted), but from some research, I found out I modified the SQL query here:

    includes/index_filters/default_filter.php

    Approx line 73, I added p.master_categories_id after

    p.products_type

    so it looks like this:

    Code:
    $listing_sql = "select " . $select_column_list . " p.products_id, p.products_type, p.master_categories_id, p.manufacturers_id, .........
    Then in the includes/modules/product_listing.php I did the:

    if (($listing->fields['master_categories_id']) != '16') {

    to say "if this product is not in category 16, do this, else, do that...."

    Hope that helps... it seems like you're on the right track, so I wont elaborate more, but let me know how it goes....

  7. #7
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Re: Targeting specific products in product listing

    OMG - I LOVE you. You have no idea how much time you just saved me. Thank you *so* much!

  8. #8
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Re: Targeting specific products in product listing

    And I thought I'd update. It worked great on the product listing pages. But I can't get it to work on the All listing (where it lists *all* products).

    I changed the line to:

    Code:
    if (($products_all->fields['master_categories_id']) == '24') {
    ...but the SQL query is only for the $listing_sql (in default_filter.php), but the all listing sql is for $products_all_sql or $products_all_split_sql..which I can't find anywhere. (Looking for $products_sql too - I just don't know what it's named!)

    But I'm halfway there...if anyone else has any suggestions on how to get this to work on the "All" listing, that'd be great.

  9. #9
    Join Date
    Jan 2005
    Location
    USA, St. Louis
    Posts
    3,710
    Plugin Contributions
    9

    Default Re: Targeting specific products in product listing

    Quote Originally Posted by doodlebee View Post
    And I thought I'd update. It worked great on the product listing pages. But I can't get it to work on the All listing (where it lists *all* products).

    I changed the line to:

    Code:
    if (($products_all->fields['master_categories_id']) == '24') {
    ...but the SQL query is only for the $listing_sql (in default_filter.php), but the all listing sql is for $products_all_sql or $products_all_split_sql..which I can't find anywhere. (Looking for $products_sql too - I just don't know what it's named!)

    But I'm halfway there...if anyone else has any suggestions on how to get this to work on the "All" listing, that'd be great.
    Ah, you'll also need to adjust the SQL in includes/modules/pages/products_all/header_php.php

  10. #10
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Re: Targeting specific products in product listing

    perfect - thank you!

    This is wroking beautifully - thanks so much!

 

 

Similar Threads

  1. Specific Product Listing CSS file
    By jadedchron in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 27 Jan 2010, 12:01 AM
  2. Show Specific Category on Index Listing or Add Entire Category to Featured Products.
    By devnut in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 8 Oct 2008, 04:29 PM
  3. CSS applied to product listing page in specific categories only
    By robgt in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 7 Mar 2008, 01:32 AM
  4. Create a new product type to allow specific refining of product listing?
    By dumoti in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 15 Jun 2007, 05:07 PM
  5. Product listing of specific categories
    By seville in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 26 Aug 2006, 09:34 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