Using the VitueMart 1.1 Popup (vmPopupLink function) - Joomla & VirtueMart Tips & How To's

The VirtueMart vmPopupLink function can come in handy when you need a simple information popup in your shop. An example could be a link to your data protection policy at registration time or on your checkout pages.

Home Joomla VirtueMart Tips Using the VitueMart 1.1 Popup (vmPopupLink function)

Fri

10

Apr

Using the VitueMart 1.1 Popup (vmPopupLink function)
  • Joomla 1.5
  • VirtueMart 1.1

The VirtueMart vmPopupLink function can come in handy when you need a simple information popup in your shop.
An example could be a link to your data protection policy at registration time or on your product pages.


VirtueMart vmPopupLink VirtueMart vmPopupLink is a built-in native function which is used to call simple page popups with the minimum of coding

It is is found in
joomla_root/administrator/components/com_virtuemart/classes/htmlTools.class.php
 
and can be called in your pages or templates by
vmPopupLink( $link, $text, $popupWidth=xxx, $popupHeight=xxx, $target='_blank', $title='', $windowAttributes='' )
 

The parameters are as follows -
  • $link is the url you wish to link to. This can be on your local website or external.
    If you want to call just the content of a page (without your headers, navigation and footers) then use the "index2" form in your url. e.g.
     
    $link=$mosConfig_live_site .'/index2.php?option=com_content&Itemid=74&id=49&lang=de&view=article'; 
     
  • $text is the link text that you will see on your page. This can also include images.
    Also in a multi language site you can take the text from your language files e.g. $VM_LANG->_('DATA_POLICY') A code example could be so -
     
    $text = '<img src="'.$mosConfig_live_site .'/images/padlock2.png"><b>('.$VM_LANG->_('DATA_POLICY').')</b>'; 
     
  • $popupWidth & $popupHeight are the size of the desired popup in pixels (px not needed).
     
    $popupWidth=400;
     
    $popupHeight=250; 
     
  • $target would normally be _blank, so $target='_blank';
  • $title is the link title attribute and can also be taken from the language files. e.g.
     
    $title=$VM_LANG->_('DATA_POLICY');
     
  • $windowAttributes can also be included such as -
    $location='location=yes,screenX=600,screenY=600';


So putting it all together we could insert the following code in our flypage template.
 
<td colspan="3"><?php
  $link = $mosConfig_live_site .'/index2.php?option=com_content&Itemid=50&id=50&view=article ';
            $text = '<img src="'.$mosConfig_live_site .'/images/joomla/padlock2.png"><b>('.$VM_LANG->_('DATA_POLICY').')</b>';
            $title = $VM_LANG->_('DATA_POLICY');
            $popupWidth=400;
            $popupHeight=250;
            echo vmPopupLink( $link, $text,$popupWidth,$popupHeight,'_blank', $title, 'location=yes,screenX=600,screenY=600' );
?></td>
 

There is also a short format for writing the code where the parameters are fixed.
N.B. The parameters must be entered in the order shown.
 
<td colspan="3"><?php
  echo vmPopupLink( $mosConfig_live_site .'/index2.php?option=com_content&Itemid=50&id=50&view=article ', '<img src="'.$mosConfig_live_site .'/images/joomla/padlock2.png"><b>('.$VM_LANG->_('DATA_POLICY').')</b>',400,250,'_blank', $VM_LANG->_('DATA_POLICY'), 'location=yes,screenX=600,screenY=600' );
              ?></td>
 

Which produces this on our product pages -
VirtueMart vmpopuplink data protection
Last Updated on Wednesday, 22 April 2009 11:42
 
VirtueMart
Your Cart is currently empty.

Latest Joomla & VirtueMart Tips

See all tips & examples



Using the VitueMart 1.1 Popup (vmPopupLink function)|Joomla & VirtueMart Tips & How To's



The VirtueMart vmPopupLink function can come in handy when you need a simple information popup in your shop. An example could be a link to your data protection policy at registration time or on your checkout pages.


pre, vmpopuplink, data, link, policy, xml, title, html, lang, virtuemart, joomla, site, text, mosconfig, images, php, com, live, src, blank, png, popupwidth, popupheight, img, content, location, div, code, index, itemid, option, padlock, article, screeny, parameters, yes, language, screenx, view, target


guru

We use cookies to improve our website and your experience when using it. Cookies used for the essential operation of the site have already been set.
To find out more about the cookies we use and how to delete them, see our privacy policy.

I accept cookies from this site.