VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: mronayne on January 31, 2015, 00:28:15 AM

Title: How to Order Cart Variant/Custom fields in product detail
Post by: mronayne on January 31, 2015, 00:28:15 AM
In VirtueMart 3.0.4 how can I reorder the position of Cart Varient and Custom Fields in the addtocart "Layout position"?
I cannot find any way to place these cart variant and custom fields in a specific order on the product details page.
Is there a way to do that?
Title: Re: How to Order Cart Variant/Custom fields in product detail
Post by: bluezeyes on January 31, 2015, 02:13:59 AM
Try to ordering them in the custom field list.

Kind regards,

Bluezeyes
Title: Re: How to Order Cart Variant/Custom fields in product detail
Post by: mronayne on February 20, 2015, 01:37:15 AM
Custom Field List doesn't allow any reordering?
Title: Re: How to Order Cart Variant/Custom fields in product detail
Post by: NielsJE on March 30, 2015, 21:20:13 PM
Hi,

I have VM2.6.14 but had the same problem and was able to solve it.
It is a bug in VM, maybe it is still in VM3.

It is function getProductCustomsFieldCart from administrator/components/com_virtuemart/models/customfields.php.

Around line 821 you find


// group by virtuemart_custom_id
$query = 'SELECT C.`virtuemart_custom_id`, `custom_title`, `show_title`, C.`custom_value`,`custom_field_desc` ,`custom_tip`,`field_type`,field.`virtuemart_customfield_id`,`is_hidden`
FROM `#__virtuemart_customs` AS C
LEFT JOIN `#__virtuemart_product_customfields` AS field ON C.`virtuemart_custom_id` = field.`virtuemart_custom_id`
Where `virtuemart_product_id` =' . (int)$product->virtuemart_product_id . ' and `field_type` != "G" and `field_type` != "R" and `field_type` != "Z"';
$query .= ' and is_cart_attribute = 1 group by virtuemart_custom_id ORDER BY field.`ordering`';


You only need to change the last row.
ORDER BY field.`ordering`
should be
ORDER BY C.`ordering`

It was first sorting on custom option level, not on custom level itself.

That solves the problem for me. Now its a hack, but maybe should solved in next version  ;)

Niels
Title: Re: How to Order Cart Variant/Custom fields in product detail
Post by: sandstorm on July 16, 2015, 11:42:29 AM
I am using;
Virtuemart 3.0.8
Joomla 3.4.3

In Custom Fields, there is drag/drop ordering, but it seems a bit wonky. Upon saving, sometimes it saves OK & other times not.
If I go into each custom field manually and set the order number, this then shows in the back end as being ordered OK,

But in the front end, on a product page showing some String Custom Fields, the ordering is random, even after clearing all site & Browser cache.

Is there a bug/problem with ordering custom fields this way?

If not can anyone point me in the right direction of solving this.

Thanks

Andy

Title: Re: How to Order Cart Variant/Custom fields in product detail
Post by: jenkinhill on July 18, 2015, 16:37:19 PM
http://forum.virtuemart.net/index.php?topic=130799.msg450754#msg450754