cancel
Showing results for 
Search instead for 
Did you mean: 

Product List Sorting - in view or extension?

Product List Sorting - in view or extension?

Hi,

I have two questions relating to product sorting in CE  1.9.

 

1) I want to sort product listing by a custom attribute - so that product with this attribute are promoted in the results while out of stock items are demoted. My question is this: should this be done in the view (list.phtml) or in a custom extension? It doesn't seem correct to "pollute" the view with too much logic. Also, I'm wondering if its more efficient to perform logic in the extension - whether database queries are cached, etc, in a way that's not done in the view?

 

2) A related question is that I have different attribute sets, each with unique custom attributes. Again, should this logic go in an extension? For example, I'll need to determine which attribute set I'm dealing with & then retrieve the list of attributes unique to that set & return then as an array (or similar). So, is this best done in an extension?

 

Any pointers on this would be appreciated.

 

Thanks,

Eddie