VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: sunnysbulbs on July 04, 2012, 19:11:20 PM

Title: (fixed) Link to product details from category header
Post by: sunnysbulbs on July 04, 2012, 19:11:20 PM
Need a little PHP help. In \html\com_virtuemart\category\default.php I have the following..

<div class="width55 floatcenter">
          <h2>
            <!-- <?php echo JHTML::link($product->link$product->product_name); ?>-->
            <?php echo $product->product_name?>
          </h2>


I think that piece of code is what generates the product name as a header in the virtuemart category view. What I would like to do is also make that header link to the actual product page. Thought this was the solution... http://docs.joomla.org/JHtml::link/1.6 but couldn't work out how to use '$url'

Any help is greatly appreciated!

Corey

Joomla 2.5/Virtuemart 2.0.6

In \html\com_virtuemart\category\default.php the following from...

<div class="width55 floatcenter">
          <h2>
            <!-- <?php echo JHTML::link($product->link$product->product_name); ?>-->
            <?php echo $product->product_name?>
          </h2>


to..

<?php echo JHTML::link(JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$product->virtuemart_product_id.'&virtuemart_category_id='.$product->virtuemart_category_id), $product->product_name, array('title' => $product->product_name)); ?>
Title: Re: Link to product details from category header
Post by: srajca on July 04, 2012, 20:50:43 PM
I think by default that is a feature of virtuemart
try un-commenting the code - use the one below
<div class="width55 floatcenter">
          <h2>
            <?php echo JHTML::link($product->link$product->product_name); ?>
            <?php echo $product->product_name?>
          </h2>

or try this one if the one above will generate two headings
<div class="width55 floatcenter">
          <h2>
            <?php echo JHTML::link($product->link$product->product_name); ?>
           </h2>



i have this one I changed the heading<h6><?php echo JHTML::link($product->link$product->product_name); ?></h6>

Title: Re: (fixed) Link to product details from category header
Post by: sunnysbulbs on July 04, 2012, 20:53:25 PM
Thanks for the quick reply. I did the following and it works for sure.

In \html\com_virtuemart\category\default.php the following from...

<div class="width55 floatcenter">
          <h2>
            <!-- <?php echo JHTML::link($product->link$product->product_name); ?>-->
            <?php echo $product->product_name?>
          </h2>


to..

<?php echo JHTML::link(JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$product->virtuemart_product_id.'&virtuemart_category_id='.$product->virtuemart_category_id), $product->product_name, array('title' => $product->product_name)); ?>
Title: [SOLVED] Link to product details from category header
Post by: srajca on July 04, 2012, 20:55:57 PM
perfect glad you figured it out