[SOLVED]Product navigation completely wrong in VM2, rev 5302

Started by patrik60, January 21, 2012, 18:02:19 PM

Previous topic - Next topic

joao.garin

Hello,

How is this issue fixed?I updated yesterday to version 2.0.14  and I am still getting this problem.

Seems product neighbours wherever they are ordered are getting the wrong order..and I don't seem to find what order that is.Or even where is the file that does this..

Can someone help?

Best regards,
Joao Garin

Spule

Hello,
I found this thread exactly with the same problem as Joao Garin reported (version  2.0.14) ... prev/next seem to show random neighbour products, in Category-Page the order is fine. At virtuemart 1.x it just worked out of the box correctly.

Any hint would be really apreciated.

Regards
Spule

Milbo

It is using always order by $q .= ' ORDER BY `slug` ' . $direction . ' LIMIT 0,' . (int)$max;

slug = Product Alias
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

ccfs70

We have migrated to 2.0.18a only to find out that product navigation does not work. You can not go "next" and jump to the next product in that category..Can someone help.
thanks
Carol

franzpeter

There is nothing solved with VM 2.0.18a. Going forward or backward from product details page with the navigation buttons does choose products from somewhere in the category but not the next or previous product in that category!!

patrik60

QuoteThere is nothing solved with VM 2.0.18a. Going forward or backward from product details page with the navigation buttons does choose products from somewhere in the category but not the next or previous product in that category!!

I don't have this problem any more since a long time. To be sure that it isn't a problem of mine (maybe with other extensions) I have installed a clean Joomla with only the latest VM 2 version with the sample datas on my local environment. Before posting a problem I always check it there. As far as it works fine there I try to find the problems in my configuration.

Did you try this?

Sometimes problems like these remain because using old template overrides. Disabling the whole html folder in the template folder could solve the problem too.

Regards
Patrik

Jumbo!

Quote from: ccfs70 on January 15, 2013, 01:59:46 AM
We have migrated to 2.0.18a only to find out that product navigation does not work. You can not go "next" and jump to the next product in that category..Can someone help.
thanks
Carol

Quote from: franzpeter on January 15, 2013, 14:20:51 PM
There is nothing solved with VM 2.0.18a. Going forward or backward from product details page with the navigation buttons does choose products from somewhere in the category but not the next or previous product in that category!!
I have found something which should help you to resolve this problem to some extent.

Product Navigation (Next/Prev) is directly related to the "Default product sort order". For some unknown reason product neighbors array only gets populated when you set the "Default product sort order" field to one of the followings:

  • Product Name
  • Product Short description
  • Product Description
  • Product in stock
  • Product Sales
  • Featured Product

If you set the same to something else for example Product Price or Product Available Date then it does not seem to be working.

"Default product sort order" also decide which products to be displayed when you click on Prev or Next product link.

You may find this helpful if your site is not at all displaying Product Navigation (even after enabling product navigation option in VM Config) and to understand how exactly it works. Default product sort order" field can be found in VM Configuration page under Product Order Settings tab.

Milbo, I am sure there is some problem in the neighbor products array model. Please take a look at it. 

Stonedfury

Well Jumbo this is why I will continue to pay you for templates and support! That fixed the problem however shows that there is a much bigger problem.
No such thing as a stupid question, only a stupid answer. I won't ask if I know the answer or found it using the search as you suggested.

empixmultimedia

this fix work for "Product Sort Order Settings" set to "ordering" in VM2 ver 2.018a
file: administrator/components/com_virtuemart/models/product.php (row: 1258)

         if ($this->filter_order == "pc.ordering")               // added
            $q .= ' and pc.ordering ' . $op . ' ' . $product->ordering .' ';   // added
         else                                    // added
            $q .= ' and `slug` ' . $op . ' "' . $product->slug . '" ';
         
         if ($app->isSite ()) {

            if (is_array ($virtuemart_shoppergroup_ids)) {
               $sgrgroups = array();
               foreach ($virtuemart_shoppergroup_ids as $key => $virtuemart_shoppergroup_id) {
                  $sgrgroups[] = 'psgr.`virtuemart_shoppergroup_id`= "' . (int)$virtuemart_shoppergroup_id . '" ';
               }
               $sgrgroups[] = 'psgr.`virtuemart_shoppergroup_id` IS NULL ';
               $q .= " AND ( " . implode (' OR ', $sgrgroups) . " ) ";
            }
         }
      //   $q .= ' AND (`psgr`.`virtuemart_shoppergroup_id` IS NULL OR `psgr`.`virtuemart_shoppergroup_id`= "'..'"  ';
         if ($onlyPublished) {
            $q .= ' AND p.`published`= 1';
         }
         if(!empty($this->orderByString)){
            $orderBy = $this->orderByString;
         } else {
            $orderBy = ' ORDER BY '.$this->filter_order.' ';   // <-- remove `
         }
         $q .=  $orderBy . $direction . ' LIMIT 0,' . (int)$max;

Stonedfury

Can I get a bit more specific details. Is this a find and replace or an add?

I copied your //add and your //<--remove and it still doesnt work. Why is this topic marked as solved?

Here is the file. What did I miss?
//}
/////////////////////////////////////////
///////// Added from http://forum.virtuemart.net/index.php?topic=96784.15;topicseen
         if ($this->filter_order == "pc.ordering")               // added
            $q .= ' and pc.ordering ' . $op . ' ' . $product->ordering .' ';   // added
         else                                    // added
/////////////// end the addition
$q .= ' and `slug` ' . $op . ' "' . $product->slug . '" ';
if ($app->isSite ()) {

if (is_array ($virtuemart_shoppergroup_ids)) {
$sgrgroups = array();
foreach ($virtuemart_shoppergroup_ids as $key => $virtuemart_shoppergroup_id) {
$sgrgroups[] = 'psgr.`virtuemart_shoppergroup_id`= "' . (int)$virtuemart_shoppergroup_id . '" ';
}
$sgrgroups[] = 'psgr.`virtuemart_shoppergroup_id` IS NULL ';
$q .= " AND ( " . implode (' OR ', $sgrgroups) . " ) ";
}
}
// $q .= ' AND (`psgr`.`virtuemart_shoppergroup_id` IS NULL OR `psgr`.`virtuemart_shoppergroup_id`= "'..'"  ';
if ($onlyPublished) {
$q .= ' AND p.`published`= 1';
}

if(!empty($this->orderByString)){
$orderBy = $this->orderByString;
} else {
// Original script $orderBy = ' ORDER BY `'.$this->filter_order.'` ';
     $orderBy = ' ORDER BY '.$this->filter_order.' ';   // <-- remove `
}
$q .=  $orderBy . $direction . ' LIMIT 0,' . (int)$max;
No such thing as a stupid question, only a stupid answer. I won't ask if I know the answer or found it using the search as you suggested.

jthrongard

#25
I'm running into the exact same problem - Default order is set to Ordering and MUST remain that way.  Product navigation doesn't work properly.  Same as everyone elses.  Version is 2.0.20b.

Edit - I found a temp solution:http://forum.virtuemart.net/index.php?topic=111450.0

However this isn't a fix. This problem is NOT solved as it requires editting a core file.  Please fix in next update.
Small Business Joomla! Website Design - Simple CMS Design
http://www.simplecmsdesign.com

Stonedfury

That doesn't seem like a real fix either. :( Ill wait to see if they fix it. I wont hold my breath but I will cross my fingers.
No such thing as a stupid question, only a stupid answer. I won't ask if I know the answer or found it using the search as you suggested.

Milbo

The fix is already in the svn and the solution is already in another post,.. lol.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

johnwasneverhere

Umm, jeez thanks for your help milbo! Lol. How bout a link to where it is fixed so I don't have to search for another hour through dozens of unanswered threads on the same topic? Lol not

AH

Johnjeez

Milbo has said that you should get the lates svn, 2.0.21C I believe.

If you dont want to update then extract the relevant code and replace in your version
Regards
A

Joomla 3.10.11
php 8.0