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

Bug fix for fancybox add to cart button in https page

Started by harrstar, October 01, 2013, 03:39:21 AM

Previous topic - Next topic

harrstar

Hi,

I am using vm 2.0.22a on joomla 2.5.14.

The fancybox for the add to cart function from product detail view was not working on secure (https) pages, the popup was not showing. All browsers complained about cross referencing from https://... to http://... for the fancybox call. After some digging I found the culprit in /administrator/components/com_virtuemart/helpers/config.php on line 1136 :

      $jsVars .= "vmSiteurl = '". JURI::root( ) ."' ;\n" ;

needs to be changed into

      $jsVars .= "vmSiteurl = '". JURI::root(true ) ."/' ;\n" ;

The first line returns the absolute url to the site like :

                http://www.example.com/

whereas the second line returns

                /

which makes it a relative path from root.

It needs to be either a relative path or the absolute url should switch from http:// to https:// which it currently does not.

This little fix solved the problem and the add to cart popup is now working on https and http.

Uwe

               
Joomla 2.5.25 and vm 2.6.10

Milbo

Your fix generated for me as expected

vmSiteurl = 'http://vm2mp.stuprecht//' ;


ah lol overlooked the true in your statement. This is right, it gives back only the path. The question is how your patch works with subdomains.

But I think the real solution is to change the instance JURI to give  back an https link.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Milbo

I added now this

if(VmConfig::get('useSSL',false)){
$jsVars .= "vmSiteurl = '". $uri->root( true ) ."/' ;\n" ;
} else {
$jsVars .= "vmSiteurl = '". $uri->root( ) ."' ;\n" ;
}

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

harrstar

Hi Milbo,

Yes, I concur, the joomla function is what really needs to be changed. I like your fix for it though.

On a side note, why is vm not switching back to http if outside the sensitive area?

Uwe
Joomla 2.5.25 and vm 2.6.10