Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2008
    Posts
    13
    Plugin Contributions
    0

    Default displaying attributes in product listing

    I can't figure out which file to edit to add an attribute on my product listing page

    I'm starting a music store, and the way I have my inventory set up is that the Product's Name is the artist (eg, Neil Diamond) and the particular album is an attribute I set up elsewhere. This attribute already displays on the particular item info (as it should) but I would also like to to show up in lieu of the product description on the Product Listing page (the general category, in this case, 1970s.) I'm pretty sure I can figure out how to make that happen if someone can just tell me which PHP file to edit for that page -- I can't find it

    Thanks!

  2. #2
    Join Date
    Jun 2008
    Posts
    13
    Plugin Contributions
    0

    Default Re: displaying attributes in product listing

    OK, I found the file in ../includes/modules/product_listing.php; the code is throwing me. Where can I add the code to display the attribute? In a perfect world, I'd like to delete the product description and add the attribute, a simple tit-for-tat; is there an easy way?

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: displaying attributes in product listing

    No, there is not an easy way (unless you are a PHP/MySQL professional).
    The listings are not set up to process attributes. It can be done, but involves a lot of custom coding.

    Is your idea to have multiple albums show up as attributes under each "artist's name" product?

  4. #4
    Join Date
    Jun 2008
    Posts
    13
    Plugin Contributions
    0

    Default Re: displaying attributes in product listing

    no, I think that may be too difficult -- instead, each record has its own product ID. Tom Petty, for instance, is the Product Name and Album is an attribute. Tom Petty - Damn the Torpedoes and Tom Petty - Into the Great Wide Open are different products. The attributes are already stored in the main SQL database, and I have the attributes displaying when you click on a specific product -- I'd like to have that attribute also appear on the product listing page within the specific category (in this case, 1970's.) I don't need the product description to display.

    I'm surprised there isn't just a quick call to the product description data within the database that I could just edit to return a different field -- but then, I'm not the world's greatest coder, either :)

  5. #5
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: displaying attributes in product listing

    What you describe doesn't sound like a good use of attributes. Why do you feel it is necessary to use attributes at all in this case?
    Since you apparently only want read-only attributes (there is nothing to select), you could run a db query to display that.

    I would think making the product names Tom Petty - Damn the Torpedoes and Tom Petty - Into the Great Wide Open, or else a subcategory called Tom Petty with products named Damn the Torpedoes and Into the Great Wide Open would work better.

  6. #6
    Join Date
    Jun 2008
    Posts
    13
    Plugin Contributions
    0

    Default Re: displaying attributes in product listing

    Quote Originally Posted by gjh42 View Post
    What you describe doesn't sound like a good use of attributes. Why do you feel it is necessary to use attributes at all in this case?
    Since you apparently only want read-only attributes (there is nothing to select), you could run a db query to display that.

    I would think making the product names Tom Petty - Damn the Torpedoes and Tom Petty - Into the Great Wide Open, or else a subcategory called Tom Petty with products named Damn the Torpedoes and Into the Great Wide Open would work better.
    The reason for the read-only attributes is so that data entry is much faster; I deal in used merchandise, so I have to describe it to the customer. Other attributes I have include Vinyl Condition, Cover Condition, and the album year; by making them fields in the data collection screen, I can save a lot of time instead of manually typing those characteristics in the product description. The problem with sub-categories is that I'll have hundreds of them, and if, for instance, I run out of Tom Petty albums I'll just have an empty sub-category; in the scenario I'm running now, they just won't appear if I don't have any in stock.

    As far as the database query is concerned, I looked in my PRODUCT_LISTING.PHP file and I couldn't find the query for the description -- I think the zen-cart field is product_description or something like that; like I said, I'm not the best coder in the world, but I think I'm in the right place - I just need a little boost to get me where I need to go. How does the product listing screen read the product description to return it? Is that a simple database query that I can just edit to be my products_album_name field?

  7. #7
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: displaying attributes in product listing

    Using read-only attributes for condition and such sounds reasonable. I still think it makes more sense for the product name to include the album title, like Tom Petty - Damn the Torpedoes. That's not just an attribute, it IS the product, and deserves equal weight in the listing display with the artist name. I do understand not making the artists into subcats as you state.

    The db lookup is more complicated, and I'm not sure exactly where the code to modify would be.
    At the top of product_listing.php is this line:

    $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_PRODUCTS_LISTING, 'p.products_id', 'page');

    and farther down is this:

    $listing = $db->Execute($listing_split->sql_query);

    so $listing_split is an instance of the splitPageResults class, and you might find splitPageResults() in /includes/classes/??. Use the Developers Toolkit in admin > Tools to find the file.

 

 

Similar Threads

  1. v154 Featured Listing Not displaying on Product Listing Page
    By cyberfolli in forum Templates, Stylesheets, Page Layout
    Replies: 24
    Last Post: 28 Aug 2015, 12:17 AM
  2. v139h Displaying Product Viewed in Product Listing Page
    By Eric Chen in forum Setting Up Categories, Products, Attributes
    Replies: 36
    Last Post: 25 Apr 2015, 02:29 PM
  3. Problem with Required attributes after moving attributes to product listing page
    By bigmo337 in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 20 Jun 2010, 12:03 AM

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