Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How to display a selection of items from a specific category, limited to specific attribute? 
 
tjonnyc
Sr. Member
 
Total Posts:  111
Joined:  2009-04-07
 

I would like to use an “accordion” script to show products separated by a specific attribute (in my case, width), for example:

[ - - - - - 5-inch Widgets - - - - - ] <---- this is the “subcategory” header (always visible)
[ item] [item] [item] [item] [etc..] <---- this is the products listing (hidden initially, opens on mouseover/click on header)

[ - - - - - 10-inch Widgets - - - - - ]
[ item] [item] [item] [item] [etc..]

[ - - - - - 15-inch Widgets - - - - - ]
[ item] [item] [item] [item] [etc..]

[ - - - - - 20-inch Widgets - - - - - ]
[ item] [item] [item] [item] [etc..]

As I understand it, in the default approach, the products are added to the category page by the file frontend/default/{theme}/template/catalog/product/list.phtml.

I would like to know, how can I limit the output of list.phtml to “write out” ONLY the products whose {attribute} matches {value}?

Here is my current list.phtml: http://pastebin.com/f1adeaf77

(Can’t post here due to character limit).

NOTE: Since I’m using a liquid layout, I’ve changed the Magento default table-based layout to DIV/UL/LI, so I can float the UL - automatically resizing the list of items to fit the screen. Plus, tables suck.

If anyone can figure this out, i.e. how to use Magento’s list.phtml with custom parameters, it would be a huge bonus to any developers trying to integrate accordion scripts or jQuery sliding panels - “I want {this selection} from {this category} right in {here}”.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top