Author Topic: How to fix relative image url for custom field "image" in html email? VM2.0  (Read 3770 times)


  • Jr. Member
  • **
  • Posts: 68
I see relative url on custom field option (field type image) in the customers order email and in admin's.
How to fix so there is a absolute url - so image can be seen?
Color: [broken image] Grey

do not know how to fix it in file:
Code: [Select]
<td align="left" ><?php echo JHTML::link$root.$prow->url$prow->product_name).$prow->customfields?></td>



  • Contributing Developer
  • Jr. Member
  • *
  • Posts: 86
    • One Page Checkout for Virtuemart 2
Hello, i guess it can be changed this way inside the php tags:

echo '<a href="'.JURI::base().'/'.JRoute::_($root.$prow->url).'">'.$prow->product_name.'</a>'.$prow->customfields;

i am not sure now if JURI::base returns / at the end or not at the moment. This also must be triggered from a default html layout as some poor sef extensions don't handle the url correctly when in other layouts.
Your customized checkout solution for Virtuemart


  • Jr. Member
  • **
  • Posts: 68
Hi stAn99

Thanks, I tried it out but I still only get relative url.

I only use Joomla SEF as my aceSEF component not work well with VM2 (as they state that VM runs outside the router ... or something like that...)
I guess that might be why the JURI::base().'/ is not drawn in.

And funny thing is that the vendor logo have absolute path, but guess devs missed somebody adding an image to their product would not show in email.
I hope Dev might have an input.

HMTL FORM EMAIL (last with modified code):

<div class="vm-customfield-cart"> <span class="product-field-type-M">Farve : <img src="/images/stories/virtuemart/product/resized/japansk_crepe_lavendel_80x128.jpg" alt="japansk_crepe_lavendel.jpg"  /><span class="vm-img-desc">Lavendel</span></span></span></div>            
<span class="product-field-type-M">
Farve :
<img src="/images/stories/virtuemart/product/resized/japansk_crepe_lavendel_80x128.jpg" alt="japansk_crepe_lavendel.jpg"  />
<span class="vm-img-desc">Lavendel</span></span></span></div>

[attachment cleanup by admin]

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4329
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
The problem is that the function use always the relative path.
You cannot change something on a simple way.

In internal use , this is preferred, but sure in mail or RSS feed this can be a problem
We look to provide the best solution and not a simple hack on this place.
Thanks for your report.


  • Jr. Member
  • **
  • Posts: 68
Thanks Electrocity
for looking at it.
I understand the complexity.

So for now I just go with
Give my custom field image a "Displayed image title" in Media Files.
This way the customer can see the image and title on the frontend (productpage and  cart)
Then in mails I make a override of :

Placing inline styling in the upper part of the html
Code: [Select]
.vm-customfield-cart img{
display:none !important;}</style>

This way eliminating the display of the broken images. Leaving only the "Displayed image title" to be seen for admin and customer.
So the mail looks prof.

SIDE NOTE:::::::::::::::: VM2.0 | J1.5.25
Unfortunaly I still have the problem of:
Warning: key() [function.key]: Passed variable is not an array or object in /home/dan23191/public_html/dev/administrator/components/com_virtuemart/plugins/vmcustomplugin.php on line 253

Warning: key() [function.key]: Passed variable is not an array or object in /home/dan23191/public_html/dev/administrator/components/com_virtuemart/plugins/vmcustomplugin.php on line 253

in admin's -> view order
and in customer's "View this order online"

I know this is fixed in VM2.0.1 - but as there is other issues with that pre-release (especially in the email / order & Custom fields section) I have to stay on VM2.0.
So I also remove all reference to the link "View this order online" and the shopadmin then must rely on mails to know which colour variant was chosen.

EDIT NOTE:::::::::::::::: VM2.0 | J1.5.25
This above code suggestion only reference to VM2.0 NOT the later sub-releases!