Forced SSL sometimes not working

  • Posts: 43
  • Thank you received: 2
10 years 10 months ago #140268

-- HikaShop version -- : 2.2.3
-- Joomla version -- : 3.2.1
-- PHP version -- : 5.3.3

I guess this is not a problem but a bug because I have tested it explicitly. Let me explain the settings:

1) Hikashop > System > Configuration > Checkout > Force SSL on checkout = YES
2) Setup a module using "Mini Cart = YES " and "Show proceed button in the cart = YES"
3) Place the module with all pages, include pages that outside the Hika shop (eg: Zoo, Jomsocial, etc)

Problem:
I found when I click the [CHECKOUT] button in the Mini-cart Moudle, especially while displaying screens outside Hika Shop, the SSL (https://) won't show up in some occasion.

I have tested it explicitly with menu "Meta Data > Secure = Ignore or Off" (on other pages) but the problem persist sometimes without any pattern (sometimes https:// show up and sometimes not), even with the "Force SSL on checkout = YES"

Please advise if this is any kinds of setup problem or bugs as this may greatly affect customer experience, because if https:// sometimes not show up with checkout, customer feel unsecure.

Thanks.

Last edit: 10 years 10 months ago by drmad.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 10 months ago #140283

Hi,

I've seen that once because the server didn't set the information of whether the page was requested with SSL or not in the PHP superglobals properly and thus HikaShop didn't know what to do in some cases.

An alternative solution is to set the "force a menu on checkout" option to a particular menu item and then force SSL on that menu item like explained here: www.ostraining.com/blog/joomla/how-to-en...ertain-joomla-pages/

Please Log in or Create an account to join the conversation.

  • Posts: 43
  • Thank you received: 2
10 years 10 months ago #140301

Hi Hikashop,

Your suggestion could be one solution but in Joomla 3.x, they have provide Menuitem> Metadata > Security = YES to force a page / menu item to be loaded in https (SSL). However, even I have created a menu item for "Checkout", the same is not guarantee in https:// while going thru the [CHECKOUT] button with the minicart module.

Actually I do not want to add any 3rd party SSL redirection module with my site, especially I've seen a lot replies from the post your recommended me to read, said some of them CRASH their site after installing that components.

Please advise if any workaround within Hikashop (like, force the URL to https:// while passing thru URL via minicart) or it's something I can wait with Hikashop update?

Last edit: 10 years 10 months ago by drmad.

Please Log in or Create an account to join the conversation.

  • Posts: 43
  • Thank you received: 2
10 years 10 months ago #140302

I have just done a small test: this problem only exist WHEN the minicart=YES. Is there any programming issue with minicart=yes while handling https:// url? or loading the Force SSL on checkout = YES parameter?

Last edit: 10 years 10 months ago by drmad.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 10 months ago #140542

Hi,

If you have the same issue with Joomla's ssl then there is definitely something wrong with the server.

Yes, if it works with the mini cart turned off, then you could just edit the file "cart" of the view "product" via the menu Display>Views and modify the code of the button to use the same URL as the normal cart or even more simply use https directly for the link on that line:

echo $this->cart->displayButton(JText::_('PROCEED_TO_CHECKOUT'),'checkout',$this->params,hikashop_completeLink('checkout'.$url_itemid),'window.location=\''.hikashop_completeLink('checkout'.$url_itemid).'\';return false;');
You could do that with that code instead:
echo $this->cart->displayButton(JText::_('PROCEED_TO_CHECKOUT'),'checkout',$this->params,str_replace('http://', 'https://',hikashop_completeLink('checkout'.$url_itemid)),'window.location=\''.str_replace('http://', 'https://',hikashop_completeLink('checkout'.$url_itemid)).'\';return false;');

Please Log in or Create an account to join the conversation.

  • Posts: 43
  • Thank you received: 2
10 years 10 months ago #140591

Hi Nicolas,

I tried the customization with the 'Display > Views', (My template), Products, cart ... (on Line 119), however, the problem still there. Do you know what is the reason that may cause the problem? (eg: Falang (Multi-lang environment)?) or possibly the .htaccess file?

Actually I am still quite wonder why MINICART=NO and it works normally all the time.
but when MINICART=YES and it will fail loading https sometimes.

Last edit: 10 years 10 months ago by drmad.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 10 months ago #140614

Hi,

It's probably because something else on your website/server acts differently when the request is a POST or a GET. In the mini cart mode, the URL of the button does a GET request to the server while with the normal cart, the whole cart form is sent to the server as a POST.

That customization will change the http URL of the button to https, that way, the system doesn't have to know whether it should redirect to https or not during the checkout since it will already be in https. If you still have the problem, it thus means that either the modification is not for the correct code or not the correct template. You should see https on the button link of the cart once that modification is applied.

Please Log in or Create an account to join the conversation.

  • Posts: 43
  • Thank you received: 2
10 years 10 months ago #140635

Thanks Nicolas,

Can you confirm this is the correct item: 'Display > Views', (My template), Products, cart ... (on Line 119)' ?

I found the URL of the button does not modify after the view override:
<input type="submit" class="btn button hikashop_cart_input_button" name="checkout" value="結帳" onclick="var field=document.getElementById('hikashop_product_quantity_field_1');window.location='/main/zh/component/hikashop/checkout';return false;">
(the both http:// and https:// and www.mydomain.com did not appear, the html code just use the relative url)

but, the MINICART=NO part, the button changed with the modification :~) , I guess I found the incorrect code:
<input type="hidden" name="url" value="http%3A%2F%2Fwww.mydomain.com%2Fmain%2Fzh%2Fmarketplace%2Fhome">

Anyway, I found this possible part and don't know how to modify...

(same file, line 104)
<a class="hikashop_small_cart_checkout_link" href="<?php echo hikashop_completeLink('checkout'.$url_itemid); ?>">
(same file, line 126)
<a class="hikashop_small_cart_checkout_link" href="<?php echo hikashop_completeLink('cart&task=showcart&cart_id='.$cart_id.'&cart_type='.$cart_type.$url_itemid); ?>">
(same file, line 372)
[color=#004400]if($this->params->get('show_cart_proceed',1)) echo $this->cart->displayButton(JText::_('PROCEED_TO_CHECKOUT'),'checkout',$this->params,hikashop_completeLink('checkout'.$url_itemid),'');[/color]

Further, is there anyway to modify MINICART=YES to use POST method for the URL? and, what is the reason behind to use difference url method for the request? Thanks a lot.

Last edit: 10 years 10 months ago by drmad.

Please Log in or Create an account to join the conversation.

  • Posts: 43
  • Thank you received: 2
10 years 10 months ago #140638

Line 119 also
echo $this->cart->displayButton(JText::_('PROCEED_TO_CHECKOUT'),'checkout',$this->params,str_replace('http://', 'https://',hikashop_completeLink('checkout'.$url_itemid)),'window.location=\''.str_replace('http://', 'https://',hikashop_completeLink('checkout'.$url_itemid)).'\';return false;');
I guess we cannot just replace http:// with https:// because the link originally doesn't contain 'http://' but a relative link.

Last edit: 10 years 10 months ago by drmad.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 10 months ago #140710

Ok, then use that code instead and that should do it:

echo $this->cart->displayButton(JText::_('PROCEED_TO_CHECKOUT'),'checkout',$this->params,str_replace('window.location=\'/main/', 'window.location=\'https://www.mywebsite.com/main/',hikashop_completeLink('checkout'.$url_itemid)),'window.location=\''.str_replace('window.location=\'/main/', 'window.location=\'https://www.mywebsite.com/main/',hikashop_completeLink('checkout'.$url_itemid)).'\';return false;');

The following user(s) said Thank You: drmad

Please Log in or Create an account to join the conversation.

Time to create page: 0.079 seconds
Powered by Kunena Forum