2.0.9 b Product Navigation problem when adding One product to many Categories

Started by John2400, August 22, 2012, 11:35:30 AM

Previous topic - Next topic

bytelord

didn't give a try on your solution. mine is working, is just uses a session to keep track the last category_id if you navigate from the category.
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

Milbo

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

bytelord

heh,

may be john test it, i don't have products more than once in parent categories any more ... :)
ok, i will try it, but may be the next 2-3 days because in a few hours I'm travelling (vacation time ... at last)  ;)
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

John2400

Hi,

Ok Milbo /team -  - I can see the code - point me to exactly where this needs to go - what folder - where?

bytelord

Hey john,

You can use the code i post http://forum.virtuemart.net/index.php?topic=106713.msg356430#msg356430 that only changes your override vm template, i explain how.

Milbo's suggested to edit a core file (official solution but untested):

Update: the file location: joomla_folder\administrator\components\com_virtuemart\models\product.php  (i think the line is different for v209b line 1142)

QuoteWhy you just not use shopFunctionsF::getLastVisitedCategoryId(); ? and hey, why do you not consider to change the core, if you can assume that it will be integrated.
My solution is product model line 1145
$q .= '   WHERE `virtuemart_category_id` = ' . (int)$product->virtuemart_category_id;

change to

if ($app->isSite ()) {
   if (!class_exists ('shopFunctionsF')) require(JPATH_VM_SITE . DS . 'helpers' . DS . 'shopFunctionsF.php');
   $q .= '   WHERE `virtuemart_category_id` = ' . shopFunctionsF::getLastVisitedCategoryId();
} else {
   $q .= '   WHERE `virtuemart_category_id` = ' . (int)$product->virtuemart_category_id;
}
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

bytelord

Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

encreplus

Works with me ....

Stefan

Ian Dalkin

Hi folks, I feel a bit nervous in this gathering of eagles but I'm having trouble with this also at a development site at www.furnitureconnections.com.au  With products in a number of categories, the navigation link provided as per the screenshot attached continues to throw errors.  I'm confused about whether any of the discussions above are 'core' or 'hack' so I think for the moment it would be simpler to remove the navigation altogether and have users rely on the back button in their browser.  I'm not sure which part of the code shows it though.

UPDATE:

In the course of jumping up and down and banging my head against a wall, I noticed that by restoring the template setting to "default joomla" that navigation works as expected.  I'm still testing and will update if I find an exception but for the moment, please ignore the request outlined above.  For interest's sake, I had the template set to the default template I'm using on my site, which is a Shape5 responsive template.

[attachment cleanup by admin]
If you're skating on thin ice you might as well dance!

artalphak

Hello all.

I have implemented and tested the code supplied by Milbo and when a product is in multiple categories and you click forward and backward we are now staying within the category of products.

The only thing I can't get to work is the custom ordering.
When product are ordered in a custom order in the admin I can't get them to display in the same order in the neighbours navigation. The ordering is constantly being displayed alphabetically.

Is there some line of code that can be changed so the ordering reflects what is in the admin?

Note: the ordering in the category page is correct as per the custom admin ordering.

regards Karl