News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Order product by DESC

Started by saiborg, January 26, 2012, 13:24:34 PM

Previous topic - Next topic

castart

#30
The next code worked for me

Joomla 2.5.11, Virtuemart 2.0.20b
Joomla SEF on
Virtuemart SEO Switched on
SEO extenseion -detail D
Default article sort creation date

Near line 397   after: default;
               if (!empty($this->filter_order)) {
                  $orderBy = ' ORDER BY ' . $this->filter_order . ' ';



/* 20130529 begin code cast-art siwtch direction if order is created_on*/   
      $a=$this->filter_order;
      $b=$this->filter_order_Dir;
      
        if ($a=="`p`.created_on"&&$b=="DESC")
            {
           $this->filter_order_Dir="ASC";
           }
        else
            {
               if ($a=="`p`.created_on"&&$b=="ASC"||$filter_order=="`p`.created_on"&&$b=="")
                {
                  $this->filter_order_Dir="DESC";
            }
            }               
      /* end code cast-art */

slammy

I just installed 2.0.22b and this issue is present again. The choosing of "show latest added products first" and "creation Date" in products-sorting as a sort-possibility in vm -backend does not affect the product-category-view. Oldest added products showing up first!

castart

Even in 2.0.22a the issue is present.
So everytime you upgrade Virtuemart the extra code (core hack) is overridden.
So after every upgrade you will have to add the extra products-sorting script.

Milbo

Quote from: P2 Peter on December 11, 2012, 23:45:05 PM
I think I know how it can be fixed, but it's above my programmingskills atm.

in the virtuemart administrator backend - > configuration -> article sorting, the two dropdown menus for the standard sorting should need an additional select box with ascending and descending as an option. Then in the product.php file the ASC and DESC should be replaced with the value set in the configuration. But truly... I miss the time currently to solve it :(

What I am just doing, prepare to test a 2.0.22c Version.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

castart


system_error86

Hello, I know that the thread is old but I need a litle help. I would like to have in only one gategory ASC ordering and in other categories I want to have DESC ordering. I am trying to put an if statement in the line 148 for me
         if ($virtuemart_category_id = 202){
               $filter_order_Dir = strtoupper (JRequest::getWord ('order', 'ASC'));
               $valid_search_fields = VmConfig::get ('browse_search_fields');   
            }else {
                                        $filter_order_Dir = strtoupper (JRequest::getWord ('order', 'DESC'));
               $valid_search_fields = VmConfig::get ('browse_search_fields');   }

but it is not working.I have the 2.0.15a version of virtuemart and the joomla is 2.5.14. Can you help me please??
Thanks a lot


jenkinhill

Quote from: system_error86 on January 10, 2017, 10:01:22 AM
I have the 2.0.15a version of virtuemart and the joomla is 2.5.14.

Not only an old thead, but ancient and insecure VirtueMart and Joomla versions! Could you not update to current J3 VM3 versions?
http://forum.virtuemart.net/index.php?topic=118683.0

Using current versions also makes it more likely that someone can help.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

system_error86

I cannot do updates. It has many core changes in the code.
If anyone can help I would apriciate.
Thanks a lot

castart

Maybe helpful to echo the values of the fields you use to find out whether you use the right fields.

I agree with jenkinhill. You'd better update for in future more problems wil arise.