VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: ioncap on March 01, 2016, 15:26:42 PM

Title: VM3 - Editing product navigation
Post by: ioncap on March 01, 2016, 15:26:42 PM
Hello again dear people!

joomla! version: 3.4.1
Virtuemart version: 3.0.8


I have a fresh new problem, so let's dive in the details:
Virtuemart has some awesome user functionality build in, like for instance the product navigation (previous product, next product).
example (http://bonucci.de/index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=259&virtuemart_category_id=16&Itemid=200&lang=nl)
Pretty cool right? well the layout looks lame, but that ain't the point at this moment. What i am trying to accomplish is this same navigation for categories.
I have tried several things, searched all over the place, made edits in the source files but sadly, none of that helped not even a little bit.
Most of the time i spend editing the product navigation, to get it working with categories, i found the place to implement it, though haven't got it working.

Original product navigation:

<?php
    
// Product Navigation
    
if (VmConfig::get('product_navigation'1)) {
   
?>

        <div class="product-neighbours">
       <?php
       
if (!empty($this->product->neighbours ['previous'][0])) {
      
$prev_link JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' $this->product->neighbours ['previous'][0] ['virtuemart_product_id'] . '&virtuemart_category_id=' $this->product->virtuemart_category_idFALSE);
      echo 
JHtml::_('link'$prev_link$this->product->neighbours ['previous'][0]
         [
'product_name'], array('rel'=>'prev''class' => 'previous-page','data-dynamic-update' => '1'));
       }
       if (!empty(
$this->product->neighbours ['next'][0])) {
      
$next_link JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' $this->product->neighbours ['next'][0] ['virtuemart_product_id'] . '&virtuemart_category_id=' $this->product->virtuemart_category_idFALSE);
      echo 
JHtml::_('link'$next_link$this->product->neighbours ['next'][0] ['product_name'], array('rel'=>'next','class' => 'next-page','data-dynamic-update' => '1'));
       }
       
?>

       <div class="clear"></div>
        </div>
    <?php // Product Navigation END
    
?>



Maybe this is answered before, though i haven't found any topic/post concerning this problem.
Anyone any ideas?

Kind regards,
-Ioncap
Title: Re: Category neighbours
Post by: jenkinhill on March 01, 2016, 17:23:49 PM
Quote from: ioncap on March 01, 2016, 15:26:42 PM
joomla! version: 3.4.1
Virtuemart version: 3.0.8

Both versions are insecure and should not be used on a live site unless you wish to invite hackers. See http://forum.virtuemart.net/index.php?topic=118683.0

Much better to play with a current VM version than an old one. Latest stable release is VM3.0.12  and VM3.0.13.4 is probably stable enough for a live site.
Title: Re: Category neighbours
Post by: ioncap on March 02, 2016, 08:40:08 AM
Quote from: jenkinhill on March 01, 2016, 17:23:49 PM
Quote from: ioncap on March 01, 2016, 15:26:42 PM
joomla! version: 3.4.1
Virtuemart version: 3.0.8

Both versions are insecure and should not be used on a live site unless you wish to invite hackers. See http://forum.virtuemart.net/index.php?topic=118683.0

Much better to play with a current VM version than an old one. Latest stable release is VM3.0.12  and VM3.0.13.4 is probably stable enough for a live site.

Hello dear Jenkinhil!

Thank you kindly for your time to reply and reading this, and for the heads-up.
Sadly enough it wont be possible (nothing is impossible though) to update VM and Joomla to a newer and more secure version.
This has something to do with the previous developer of this site, who made a lot of hard-coded changes (same as i am doing now).

The client has a lot of specific changes in mind, and one of his demands would be not to update during this process.
This may sound stupid, or even stubborn on a whole new level, and i agree on this. Though this website needs to be done before the end of this week (yeah, this situation is just great).

Well thanks again for your reply, but i would like to ask again if there is some way to implement this idea for category navigation.

Kind regards and i hope you enjoy your vacation!
-Ioncap
Title: Re: VM3 - Editing product navigation
Post by: Ghost on March 02, 2016, 12:08:03 PM
I don't think categories have neighbors. Thus the code is invalid. See getNeighborProducts function in /administrator/components/com_virtuemart/models/product.php to see how neighbor products work. There is no equivalent for categories.

If you just want to show next/previous category without any specific ordering or filtering, it shouldn't be hard to do though.
Title: Re: VM3 - Editing product navigation
Post by: ioncap on March 02, 2016, 12:21:21 PM
Quote from: Ghost on March 02, 2016, 12:08:03 PM
I don't think categories have neighbors. Thus the code is invalid. See getNeighborProducts function in /administrator/components/com_virtuemart/models/product.php to see how neighbor products work. There is no equivalent for categories.

If you just want to show next/previous category without any specific ordering or filtering, it shouldn't be hard to do though.

Dear Ghost,

Thank you kindly for your reply, i will directly take a look at the file and functions.

Kind regards,
-Ioncap
Title: Re: VM3 - Editing product navigation
Post by: ioncap on March 02, 2016, 13:58:42 PM
For people who are interested in following this topic furthermore or maybe perhaps helping if possible: http://forum.virtuemart.net/index.php?topic=133326.0 (http://forum.virtuemart.net/index.php?topic=133326.0)
Title: Re: Category neighbours
Post by: ioncap on March 03, 2016, 09:31:27 AM
Quote from: jenkinhill on March 01, 2016, 17:23:49 PM
Quote from: ioncap on March 01, 2016, 15:26:42 PM
joomla! version: 3.4.1
Virtuemart version: 3.0.8

Both versions are insecure and should not be used on a live site unless you wish to invite hackers. See http://forum.virtuemart.net/index.php?topic=118683.0

Much better to play with a current VM version than an old one. Latest stable release is VM3.0.12  and VM3.0.13.4 is probably stable enough for a live site.

I updated Joomla and VirtueMart:
J: 3.4.8
VM: 3.0.13.6