Author Topic: Ordering child items in a drop down list (not solved since 2006?)  (Read 7583 times)

blans

  • Jr. Member
  • **
  • Posts: 80
Dear Development guys,

Nothing but the greatest respect for the awesome job you guys are doing to help us all by putting so much time and energy in VM development.

That said I have a simple question:

Is it already possible to order the child products in a drop down list? This is the bases of having a user friendly, professional looking webshop.

I came across this thread where it was already mentioned in 2006!

http://forum.virtuemart.net/index.php?topic=23879.msg62332#msg62332

Again mentioned in 2010:

http://chrismalpass.net/2010/02/03/ordering-virtuemart-child-items/comment-page-1/#comment-539

Now in 2011 and not wanting to modify these core files myself I'm still seeing my "example t-shirts" as L-XXL-S-XS-M etc...  :(

It would be a joy to have it sorted by SKU (like the back-end nicely does) or even be able to sort it by hand.

I know there is so little time and so much to do so don't get me wrong... Just asking.

All the best guys.

Blans
Multilingual VM Webshop
Joomla 1.5.26
VM 1.1.9
Joomfish 2.1.7
Artio JoomSEF 3.8.2
CSVi VM 3.8.1

VM2 has the power of Magento and the usability of Opencart. I just can't get it to do what I managed to do with VM1 for so long...

zanardi

  • Contributing Developer
  • Full Member
  • *
  • Posts: 878
    • GiBiLogic
Re: Ordering child items in a drop down list (not solved since 2006?)
« Reply #1 on: January 28, 2011, 15:30:54 pm »
Simple answer: no. As far as VirtueMart 1.1.6 this is still not possible.

Technical reason is, products order is saved in "product_category_xref" table. In other words, a product hasn't any "ordering" by itself, only an ordering related to a specific category. Now, since child products have NO category (they are only related to their parent) there is no way to order them without a significant rewrite of the code.

This is not going to happen in VM 1.1.x; we can hope this feature will appear in VM 2 (formerly known as 1.5).

P.S. if this is such a significant requisite, maybe there is a patch for it somewhere. A nice thing about VirtueMart, which many seem to ignore, is that there are a LOT of third party extensions out there, both free and commercial. I suggest a search on the internet.
--
Francesco (zanardi)
http://extensions.gibilogic.com
@gibilogic on Twitter

blans

  • Jr. Member
  • **
  • Posts: 80
Re: Ordering child items in a drop down list (not solved since 2006?)
« Reply #2 on: February 10, 2011, 10:29:24 am »
Quote
P.S. if this is such a significant requisite, maybe there is a patch for it somewhere. A nice thing about VirtueMart, which many seem to ignore, is that there are a LOT of third party extensions out there, both free and commercial. I suggest a search on the internet.

I understand and I will try to find a solution but I'm still slightly disappointed that this issue is not solved after 5 years.
Multilingual VM Webshop
Joomla 1.5.26
VM 1.1.9
Joomfish 2.1.7
Artio JoomSEF 3.8.2
CSVi VM 3.8.1

VM2 has the power of Magento and the usability of Opencart. I just can't get it to do what I managed to do with VM1 for so long...


biltong

  • Jr. Member
  • **
  • Posts: 129
    • Starfish Websites
Re: Ordering child items in a drop down list (not solved since 2006?)
« Reply #4 on: July 29, 2011, 10:06:58 am »
hi!
Maybe this can help:
http://chrismalpass.net/2011/01/10/ordering-virtuemart-child-items-in-dropdowns/

Reincha, thanks for the link, which helped but did not provide a solution.

I belieive I have solved this as follows:

To clarify, I am talking about ordering the values in the ‘advanced’ attribute drop-down list on the front-end product flypage.

I tried adding ORDER BY to the SELECT queries in ps_product_attribute.php as explained in the link above, which made no difference.

I then thought, ok let’s try ordering the resultant array of values just before the drop-down list html is constructed using a PHP asort() function. This seems to work on initial testing.

This is done in file /components/com_virtuemart/themes/default/template/product_details/includes/addtocart_advanced_attribute.tpl.php around line 4 and 26 (should do both cases). If you are using a different VM theme, substitute default with your theme name.

add
Code: [Select]
asort($attribute['options_list']);
immediately after
Code: [Select]
foreach($attributes as $attribute) {
That should do it.

To see this working, it will be available soon at http://www.trendco.co.uk. Just look at one of the Amore wigs flypages.

peppeirace

  • Beginner
  • *
  • Posts: 2
Re: Ordering child items in a drop down list (not solved since 2006?)
« Reply #5 on: April 20, 2012, 13:24:58 pm »
In the addtocart_advanced_attribute.tpl.php I just found 
foreach($attributes as $attribute) {
on line 3 and I  add
asort($attribute['options_list']);
like that
foreach($attributes as $attribute) {
asort($attribute['options_list']);

but nothing is changed
look at
http://www.cacacecasa.com/home.html?page=shop.product_details&flypage=flypage.tpl&product_id=101&category_id=2

any suggestion?

thanks
peppe