VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: charlesmdq on May 26, 2020, 18:09:11 PM

Title: fix "orderby" in view categories
Post by: charlesmdq on May 26, 2020, 18:09:11 PM
I want to fix the "orderby" of the products view in the categories. Selecting an order and then going to another category reverses this one.
As you will see in this link https://www.disegnowebologna.it/pendra1/catalogo/narrativa-1.html it is displayed correctly with the entry order that is "uscita" (by date - newest to oldest) and to change order to "Titolo book" is done correctly.
Now if I change the category the order should go back to "uscita (by date) from newest to oldest, but no .. Go back to" uscita but inverted, (the oldest first).
Is there a way that when clicking on a category (being in one), the variable "orderby" is reset ?, I'm trying but I can't find the correct function.

$(#sp-right li a).click(function(){
    //reset variable
   <?php unset($this->orderByList['orderby']);?>
});
I already know that php runs on the server side and js on the client, but it is more or less the idea for it to be understood.
can anybody help me? Thank you