Hello,
i search a way to order my product "by order" in ONLY one category. Actually, i use the alphabetic ordering for all the site.
I have seen many post in this forum but no solution...
Any idea ?
Regards
VM 3.6.10 10211
Joomla 3.9.18
make a manual url menu to it with the required ordering?
index.php?option=com_virtuemart&view=category&virtuemart_category_id=13&keyword=&Itemid=101&orderby=product_sku
or perhaps a local redirect in the template over ride
if catid == 13
redirect to index.php?option=com_virtuemart&view=category&virtuemart_category_id=13&keyword=&Itemid=101&orderby=product_sku
Hello,
Thank you. But i have the default category on the VM main page + a menu extension tierce. So i think the template override will be better.
Can you please be a little bit more precise for the code i have to put and where i have to put this code ?
I see in the category configuration i can select a template override. Is it this in your mind ? Can create a template override with this function, and after, i can select it in the cat config ?
Is it possible to create another product layout with a specific ordering, and after that, use it independently of the default order ?
QuoteIs it possible to create another product layout with a specific ordering, and after that, use it independently of the default order ?
no .. because the order is already set by the model
$category_id = vRequest::getInt ('virtuemart_category_id', 0);
$orderby = vRequest::getString ('orderby', '');
if ($category_id == 13 && !$orderby){
$uri = JUri::getInstance();
$url = $uri->toString().'&orderby=product_sku';
header("Location: " .$url);
exit();
}
OK thank you. I will try this next day and i come back.
Last question, can i put this code in my template css override ? Or i have to put it in a specific VM view ?
over ride of components\com_virtuemart\views\category\tmpl\default.php
Hello,
that dosent work... I have the error : ERR_TOO_MANY_REDIRECTS
And if i check the url, i have
https://boutique.energie-sante.ch/materiel-therapeutique-aimants-chromotherapie/chromoth%C3%A9rapie-1&orderby=product_sku&orderby=product_sku&orderby=product_sku&orderby=product_sku&orderby=product_sku&orderby=product_sku&orderby=product_sku&orderby=product_sku&orderby=product_sku&orderby=product_sku&orderby=product_sku&orderby=product_sku&orderby=product_sku&orderby=product_sku&orderby=product_sku&orderby=product_sku&orderby=product_sku&orderby=product_sku&orderby=product_sku
Regards
Check if the ordering by product_sku is active in the virtuemart config.
Else it try to set &orderby=product_sku in the URL, product_sku is not valid then remove it and redirect again and try to set &orderby=product_sku ....
It dosent work. I will to order by "order" and not product_sku...
But i thing it is SEF causing problem ?
If i put in my url : https://boutique.energie-sante.ch/index.php?option=com_virtuemart&view=category&virtuemart_category_id=47&orderby=order
It render good.
But with the code in the template override, the output url is with sef and it dosent work.
But i see another thing, that if i am in my category and modify the selector and put order by "order", in my url i have : https://boutique.energie-sante.ch/materiel-therapeutique-aimants-chromotherapie/chromoth%C3%A9rapie-1/by,ordering?keyword=
I dont know if is it important or relevant ?
I just tested on a test site, if i desactivate the sef, it work with orderby=order with your code.
But not with sef...
So i have modified your code and tested on my test site, it work but i dont know if it is correct or not :
<?php
$category_id = vRequest::getInt ('virtuemart_category_id', 0);
$orderby = vRequest::getString ('orderby', '');
if ($category_id == 47 && !$orderby){
$uri = JUri::getInstance();
$url = $uri->toString().'/by,ordering?keyword=';
header("Location: " .$url);
exit();
}
?>
Quote$url = $uri->toString().'/by,ordering?keyword=';
I think yes.
But for another language we use translated values for "by" and "ordering". Then I think not function. The values I think is language constant in SEF componeent (I remember then see inside Artio JoomSEF).
Maybe better use language constant at first?
Try to change
'&orderby=product_sku'
to
'?orderby=product_sku'
delete
Quote from: Studio 42 on April 28, 2020, 19:16:40 PM
Try to change
'&orderby=product_sku'
to
'?orderby=product_sku'
YES ! It work like this.
Thank you very much.
Thanks Patrick :)