VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: GJC Web Design on December 29, 2016, 23:15:32 PM

Title: non https in Add To Cart popup forced https sites
Post by: GJC Web Design on December 29, 2016, 23:15:32 PM
Have seen & fixed this on 4 sites today

J3.5.6/VM3.0.16 & 18

On a clean browser on sites with Joomla forced Global https  when you Add to Cart from anywhere the popup pops, the cart module ajax updates (shows product)
then you click the Go to Cart link and the cart is empty .. completely repeatable

If you close the popup and use the link from the Cart module to Go To Cart all OK

After browsing away from the empty cart and later adding all is OK - also the "lost" product reappears as the correct session is used

The https isn't present in the $this->cart_link in padded.php

ATM I fix by creating a hidden Cart menu and hard coding that in padded.php with https
Title: Re: non https in Add To Cart popup forced https sites
Post by: xtech86 on December 30, 2016, 11:55:13 AM
Hello,

How are you implementing HTTPS on the site? Just via Joomla!? or via Joomla! and Htaccess?

Implementing it via Htaccess is always recommended.
Title: Re: non https in Add To Cart popup forced https sites
Post by: Studio 42 on December 30, 2016, 13:35:06 PM
Use jroute in padded to add sef link and it work.
jRoute::_('index.php&option=com_virtuemart&view=cart');
I always dont understand why this was full removed, and not an option, many vm user complain because customer have no sef link on going to the cart from modal.
Title: Re: non https in Add To Cart popup forced https sites
Post by: GJC Web Design on December 30, 2016, 16:02:50 PM
Hi S42,

using JRoute::_('index.php&option=com_virtuemart&view=cart'); still doesn't pick up the hidden cart menu slug

I get in the popup  ->  /index.php&option=com_virtuemart&view=cart

in the cart module go to cart link

/cart

even adding the correct Itemid I just get  /index.php&option=com_virtuemart&view=cart&Itemid=226


Title: Re: non https in Add To Cart popup forced https sites
Post by: Studio 42 on December 31, 2016, 00:13:14 AM
I think that the router have a bug, this should always work and worked always for me.
Is this in the last beta only?
Title: Re: non https in Add To Cart popup forced https sites
Post by: GJC Web Design on December 31, 2016, 00:34:35 AM
vm3.0.18 ...  if I get some time will try and look further
Title: Re: non https in Add To Cart popup forced https sites
Post by: Jumbo! on December 31, 2016, 08:50:38 AM
Quote from: GJC Web Design on December 30, 2016, 16:02:50 PM
using JRoute::_('index.php&option=com_virtuemart&view=cart'); still doesn't pick up the hidden cart menu slug

I get in the popup  ->  /index.php&option=com_virtuemart&view=cart
Are you sure you are correctly overriding - components/com_virtuemart/views/cart/tmpl/padded.php

It works great for me.

To ensure it always generate a https url you can use -

<?php echo JRoute::_('index.php&option=com_virtuemart&view=cart'truetrue); ?>
Title: Re: non https in Add To Cart popup forced https sites
Post by: emedina on January 04, 2017, 21:20:12 PM
why don't you redirect all http requets with .htaccess and don't use overrides?
Title: Re: non https in Add To Cart popup forced https sites
Post by: Milbo on January 04, 2017, 22:03:16 PM
Quote from: Studio 42 on December 30, 2016, 13:35:06 PM
I always dont understand why this was full removed, and not an option, many vm user complain because customer have no sef link on going to the cart from modal.


if(VmConfig::get('sef_for_cart_links', false)){
$this->continue_link = JRoute::_('index.php?option=com_virtuemart&view=category' . $categoryStr.$ItemidStr);
$this->cart_link = JRoute::_('index.php?option=com_virtuemart&view=cart');
}

There is an option, ...
Title: Re: non https in Add To Cart popup forced https sites
Post by: Studio 42 on January 05, 2017, 01:52:18 AM
Quote from: Milbo on January 04, 2017, 22:03:16 PM
Quote from: Studio 42 on December 30, 2016, 13:35:06 PM
I always dont understand why this was full removed, and not an option, many vm user complain because customer have no sef link on going to the cart from modal.


if(VmConfig::get('sef_for_cart_links', false)){
$this->continue_link = JRoute::_('index.php?option=com_virtuemart&view=category' . $categoryStr.$ItemidStr);
$this->cart_link = JRoute::_('index.php?option=com_virtuemart&view=cart');
}

There is an option, ...
NICE, you make many vm user happy ;)
Title: Re: non https in Add To Cart popup forced https sites
Post by: Milbo on January 05, 2017, 15:01:28 PM
and updated to $this->cart_link = JRoute::_('index.php?option=com_virtuemart&view=cart',false,$this->useSSL);

Yeh and when someone wanna help, he writes a patch so that the hidden option becomes visible.
Title: Re: non https in Add To Cart popup forced https sites
Post by: Jumbo! on January 05, 2017, 18:12:57 PM
Milbo,

It should be -

$this->cart_link = JRoute::_('index.php?option=com_virtuemart&view=cart', true, $this->useSSL);

The 2nd parameter should be true to generate a 100% valid html. It is directly used as a hyperlink in html. Therefore special characters should be escaped.