News:

Support the VirtueMart project and become a member

Main Menu

Specific category product ordering

Started by thefbi, April 27, 2020, 09:05:41 AM

Previous topic - Next topic

thefbi

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

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

thefbi

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 ?

thefbi

Is it possible to create another product layout with a specific ordering, and after that, use it independently of the default order ?

GJC Web Design

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();
}

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

thefbi

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 ?

GJC Web Design

over ride of components\com_virtuemart\views\category\tmpl\default.php
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation


Studio 42

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 ....

thefbi

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 ?

thefbi

I just tested on a test site, if i desactivate the sef, it work with orderby=order with your code.
But not with sef...

thefbi

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();
}
?>


pinochico

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?
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

Studio 42

Try to change
'&orderby=product_sku'
to
'?orderby=product_sku'

pinochico

#14
delete
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products