VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: mrmysterious on November 28, 2017, 00:46:17 AM

Title: Remove the "back to category" link
Post by: mrmysterious on November 28, 2017, 00:46:17 AM
Hello friends,

I would like to get rid of the link that allows the customer to get to the category view.
The idea is:

On my startpage I provide a menu that leads the customer directly to product details view and there is no need to get back to a category again (as I am selling only 1 product).
I've looked everywhere but can't find out where this link comes from.

Here the picture of product details and in yellow I have marked what has to vanish:

(http://fs5.directupload.net/images/171128/gssbzn7h.png) (http://www.directupload.net)
Title: Re: Remove the "back to category" link
Post by: Jörgen on November 28, 2017, 08:37:57 AM
Hello

Create a new layout for /views/productdetails/default.php
Copy this file or edit Your default.php in Your template directory. Rename the file to, for example, no-return-link.php 

templates/your-template/html/com_virtuemart/productdetails/no-return-link.php

Look for these lines:
<?php // Back To Category Button
if ($this->product->virtuemart_category_id) {
$catURL =  JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$this->product->virtuemart_category_idFALSE);
$categoryName vmText::_($this->product->category_name) ;
} else {
$catURL =  JRoute::_('index.php?option=com_virtuemart');
$categoryName vmText::_('COM_VIRTUEMART_SHOP_HOME') ;
}
?>

<div class="back-to-category">
    <a href="<?php echo $catURL ?>" class="product-details" title="<?php echo $categoryName ?>"><?php echo vmText::sprintf('COM_VIRTUEMART_CATEGORY_BACK_TO',$categoryName?></a>
</div>


Either comment these lines out or erase them.

Then You can choose this product layout under the configuration for Your product category.


Regards

Jörgen @ Kreativ Fotografi
Title: Re: Remove the "back to category" link
Post by: mrmysterious on November 28, 2017, 21:41:06 PM
Thank you so much - it worked fine when deleting the lines.

First when I commented them out the link stayed visible with the comment signs visible too: /*....*/.
Very strange.

Title: Re: Remove the "back to category" link
Post by: Ghost on November 29, 2017, 07:48:33 AM
Quote from: mrmysterious on November 28, 2017, 21:41:06 PM

First when I commented them out the link stayed visible with the comment signs visible too: /*....*/.
Very strange.
You must have added comments outside of PHP tags.
Title: Re: Remove the "back to category" link
Post by: Jörgen on November 29, 2017, 07:50:03 AM
Hello
You probably put the comment in a HTML area not the PHP enclosed area, example

<?php
/* 
  $this_code_is_gone = TRUE) ;
*/
?>




/*
<?php
 $this_code_is_still_functional 
TRUE;
?>

*/


regards

Jörgen @ Kreativ Fotografi