1

I have setup my site (Magento 1.9 CE) to use SSL. This was done in the configuration (System > Configuration > Web > Secure) and with Apache redirects.

When browsing the site, the browser (Chrome) marks Contact Us and Product View pages to have insecure content.

Both of these are related to the submit form. Upon closer inspection of the template files:

/template/contacts/form.phtml

<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post">

/template/catalog/product/view.phtml

<form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>

While I realize I could simply change the form actions with getUrl(), I was wondering if there is a right way to fix this considering this was core code.

4

Create custom module and add

Config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Fishpig_CartSecure />
    </modules>
    <frontend>
        <secure_url>
            <checkout_cart_add>/checkout/cart/add</checkout_cart_add>
            <contacts>/contacts</contacts>
        </secure_url>
    </frontend>
</config>

See Secure HTTPS Magento Shopping Cart

1

One easy way to do this is to change your Unsure Base URL to HTTPS as well but that will make the whole site use HTTPS, not just the two pages that you mentioned.

1

Magento uses unsecure url for product & contacts pages

If you want to have secure urls for a module then need to add below code in the config.xml for that module:

<secure_url>
    <mymodule>/mymodule/</mymodule>
</secure_url>

For example, for contacts

<frontend>
    <routers>
        <contacts>
            <use>standard</use>
            <args>
                <module>Mage_Contacts</module>
                <frontName>contacts</frontName>
            </args>
        </contacts>
    </routers>
    <!-- add this code -->
    <secure_url>
        <contacts>/contacts</contacts>
    </secure_url>
    <!-- end -->
...

for catalog config.xml

<frontend>
    <secure_url>
        <catalog_product>/catalog/product</catalog_product>
    </secure_url>

Look at this example: Fishpig: Secure Https Magento Cart

  • But the product and contacts are not modules. – Jason McCreary Nov 4 '14 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.