Alperian
Alperian

Reputation: 119

Joomla! Virtuemart2 Change product details link to open in new browser window

is there any way to open the product details from category view in a new browser window? The current code for the button is:

<p>
<?php // Product Details Button
echo JHTML::link ($product->link, JText::_ ('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => $product->product_name, 'class' => 'product-details'));
?>
</p>

I am using Joomla! 2.5.11 and VM 2.0.22a

Upvotes: 0

Views: 947

Answers (2)

Alperian
Alperian

Reputation: 119

I have changed the following code overriding com_virtuemart/views/category/default.php:

    <?php // Product Details Button
    echo JHTML::link ($product->link, JText::_ ('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => $product->product_name, 'class' => 'product-details')); ?>

To:

    <?php $url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->virtuemart_product_id . '&virtuemart_category_id=' . $product->virtuemart_category_id . '&tmpl=component'); ?>

...and for the text link:

    <a class="product-details" href="<?php echo $product->link ?>" target="_blank"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DETAILS') ?></a>

Upvotes: 0

shairya
shairya

Reputation: 183

In addition to title and class, you can pass third parameter to the array:

array('title' => $product->product_name, 'class' => 'product-details', 'target' => '_blank')

Upvotes: 2

Related Questions