Hey Forum,
as the topic headline states, i would like to know how to add a "Go to product" button for each of the "Related Products". I've a few different things like:
<?php // Product Details Button
echo JHTML::link($product->link, JText::_('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => $product->product_name,'class' => 'product-details'));
?>
and
<a href="<?php echo JHTML::link($product->link); ?>" class="product-details-button"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DETAILS'); ?></a>
which of nothing worked.. :(
What should i add to get this working?
//Ihateit
Mod edit: impatient bump message removed. http://forum.virtuemart.net/index.php?board=114.0
Hello,
I can give one method for default_relatedproducts.php but without category link on the path
<?php
$url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $field->custom_value);
echo JHTML::link ($url, JText::_ ('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => '', 'class' => 'product-details'));
?>
May be someone lese have a better idea.
Regards
default_relatedproducts.php
after
foreach ($this->product->customfieldsRelatedProducts as $field) {
add
$field->display = str_replace( '</a>', '<br/>Go to Product</a>', $field->display );
Thanks a lot guys! Used bytelords suggestion, and it works flawlessly :-)
Another thing, i would like to move the name of the product above the image, instead of under. Where do i change this?
//Anders J.
In the default_relatedproducts.php there is a line saying "echo $field->display", displaying the image-link and productname-link under the image. But i dont know where do edit these info. Because i cant make the productname-link be shown above the image.
It is really starting to irritate me :-D Have searched the web thin, trying to find it...
//Anders J.
Quote from: PRO on November 20, 2012, 19:14:30 PM
default_relatedproducts.php
after
foreach ($this->product->customfieldsRelatedProducts as $field) {
add
$field->display = str_replace( '</a>', '<br/>Go to Product</a>', $field->display );
thank you for your nicecode
I want to replay the product name in Related prouducts. how i can? I want inserct <div> tag before the product name. I have test with this code but It not ok.
$field->display = str_replace( $this->product->product_name,'<div class="productname">'.$this->product->product_name.'</div>', $field->display );
Have any one help me.
fastest, what exact you trying to do?
make it look better?
I use this
<?php $field->display = str_replace( '" />', '" /><br/>', $field->display ); ?><?php echo $field->display; ?>
Quote from: PRO on May 17, 2013, 17:34:26 PM
fastest, what exact you trying to do?
make it look better?
I use this
<?php $field->display = str_replace( '" />', '" /><br/>', $field->display ); ?><?php echo $field->display; ?>
Thank you for your code, it look better true