News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

HELP...Linking Category Image to a Product Page is not working....

Started by bubu636, April 10, 2012, 08:56:10 AM

Previous topic - Next topic

bubu636

Hello,

I want to link the category image to a product page. I have read similar posts and category fields for templating but I still don't now why what I did is not working....

I disabled image popup function in category page. But I want the image to link to the product page so....
------------------------
I deleted below lines
------------------------
<?php /** @todo make image popup */ echo $product->images[0]->displayMediaThumb('class="browseProductImage" border="0" title="'.$product->product_name.'" ',false,'class="modal"');?>

-------------------------
and replaced with this below.

<?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->images[0]->displayMediaThumb
('class="browseProductImage" border="0"',false)); ?>

What did I do wrong here?

Thank you for your time.

PRO

what file did you edit?

and are you using a template override?

bubu636

Thank you for the reply.

I am using view/category/tmpl/default.php
I found the pop up image code so I took the whole lines out and replaced with the lines ...actually from one of your post. I am using default, no override.

PRO

Switch This

<?php /** @todo make image popup */
                     echo $product->images[0]->displayMediaThumb('class="browseProductImage" border="0" title="'.$product->product_name.'" ',true,'class="modal"');
                  ?>



with this

<?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->images[0]->displayMediaThumb('class="catImage" border="0"',false));
                  ?>


I that doesnt work, you have a template override in your template /html/ folder


bubu636

Thank you! It worked beautifully. How do I keep this change?  I am sharing one template with Joomla web pages and VM store pages. I created an override file in language file but I did not do same with rest of the php files. I have modified default.php for cart, product-detail, category etc. If I update VM, do I loose all the changes?

My current settings:

  • Shopfront :   Use joomla default
  • Category Templage: Use joomla default
  • Category Layout: default
  • Product layout: default
  • Activate CSS styles & Javascripts: All the boxes are checked

I just stat leaning VM. Thank you.

adrianpaun

You have to create a folder into youre joomla template:

/templates/your_template/html/com_virtuemart/

after that you should copy all default.php files from: components/com_virtuemart/views/.../default.php

where i put ... it means you have to create folders to: category, productdetailed, etc, etc, etc in /templates/your_template/html/com_virtuemart/

Good luck.

bubu636

I am going to try right now!
What should I do with the css file? If I don't want to copy and paste the css in my template.css, can I still I added it separately? Then, do I call the css in my joomla main html template?
Thank you!!!

adrianpaun

yes, you could add it separately in you're template/css/file.css

bun in this case you have to make sure you add the file.css into you're template index.php file

bubu636

Hi Everyone,

Thank you for your replies! I followed the instructions and it looks good except Cart, My account, Edit Address page etc.... It says "The choosen template couldnt found on the filesystem: (My Joomla Template Name)" Is it because I copied only modified files in HTML folder?

Since I am a nubie, will you check if these settings are OK for template override?

VM Configuration:
Shopfront Template>> Selected (My Joomla Template Name)
Category Template>> Selected (My Joomla Template Name)
Category Layout>> Selected default
Product Layout>> Selected default
Layout for your home page>> Selected default
Using the VirtueMart CSS>> Off

VM Product Categories:
Category Template>> Selected (My Joomla Template Name)
Category Browse Page>> Selected default
Default Product Details Page>> Selected No overrride

VM Products:
Product details Page>> Selected No override

adrianpaun

for cart, detailedproduct, etc, you have to copy all the php files in the new directory in html/com/virtuemart.

bubu636

Hi,

I got an error when I went to Cart page...."The chosen template couldnt found on the filesystem: (my template name)" but when I changed Select the default template for your shop from my template name to Use Joomla default , the error went away. I am not sure if I am applying a right setting but it worked-:)

The problem is that the category menu on the left sidebar won't display in Cart, Address Edit etc. pages. I think it was there before I tried this override template...How can I display it again?

...I am a bit overwhelmed.

sbouloc

Hello all,

I have template override so I replaced this:

<?php /** @todo make image popup */
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->images[0]->displayMediaThumb'class="featuredProductImage" border="0"',false,'class="modal"' ) );
?>


with this:
<?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->images[0]->displayMediaThumb('class="catImage" border="0"',false));
?>


in /templates/gk_bikestore/html/com_virtuemart/category/default.php
but no changes are made in frontend. The image still doesn't point to the category.

I use J2.5.6 and Virtuemart 2.0.8e

Please advise.

Thank you.

devmogs

Hello,

I have the exact same problem as 'sbouloc'.

JOOMLA: 2.5.6
VIRTUEMART: 2.0.8e
TEMPLATE: gk_bikestore
MULTILANG. : fr_FR, en_GB, es_ES


in "../templates/gk_bikestore/html/com_virtuemart/category/default.php"

I replaced
<?php /** @todo make image popup */ echo $product->images[0]->displayMediaThumb('class="browseProductImage" border="0" title="'.$product->product_name.'" ',true,'class="modal"'); ?> 

with this:
<?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->images[0]->displayMediaThumb('class="catImage" border="0"',false)); ?>



No changes are reflected in the frontend.
The product image and product name don't show, and together with the 'Product details' button still don't point to the product detail page.

The variables are empty. the first two return '0' and the last one nothing:
<?php echo '<br/>virtuemart_product_id='.$product->virtuemart_product_id '
<br/>virtuemart_category_id='
.$product->virtuemart_category_id '
<br/>img src: ' 
$product->images[0]->file_url_thumb
?>


I have noticed that as well as the 'virtuemart_products' table there are 'virtuemart_products_fr_fr', 'virtuemart_products_en_gb' and 'virtuemart_products_es_es' tables.
I have checked the sql query but it seems that it's grabbing properly the  data from 'virtuemart_products' table joining them with the language specific tables 'virtuemart_products_xx_xx':
file: "../administrator/components/com_virtuemart/models"
$q = 'SELECT `product_name`,`product_sku`,`product_s_desc` FROM `#__virtuemart_products_' . VMLANG . '` as l JOIN `#__virtuemart_products` AS p using (`virtuemart_product_id`) WHERE `virtuemart_product_id`=' . (int)$field->custom_value;


I checked the 'gk_bikestore' template creator forum but they offer the same indication as mentionned earlier.

I'm running out of ideas. Anybody would have any idea/pointer?

Thanks in advance.

devmogs

Hi,

Just to let other readers know that I fix the problem following this forum thread:
"Re: Falang and VirtueMart conflict?" @ "http://forum.virtuemart.net/index.php?topic=97880.msg356585#msg356585".

Hope this helps.

Best regards,
Chris.