Add to cart is showing Mixed Content error on Mapped site

We are using multisite. We have already set site url with https and we have mapped our subsite with our domain +++++com.com and we have set this mapping with https.
We are using Marketpress on the mapped https site and the Add to cart is not working and it is showing Mixed content Error for jquery file.
I think this Ajax is made by marketpress plugin so can you please let me know is there any setting in this plugin to set this with https.

  • Adam Czajczyk

    Hello antonimike,

    I hope you're well today and thank you for your question!

    I checked your site and while I can confirm the issue there, I also found that there were some similar issues in the past. They should already be fixed but it's possible that something has changed since then.

    I've reported this and our developers will look into the issue in order to find a reason and a solution. Please stay tuned and watch this thread for further information from us.

    Kind regards,
    Adam

  • Lindeni Mahlalela

    Hello antonimike

    I hope you are doing great today. I am sorry for the inconvenience you are having regarding this issue and I hope we resolve it soon.

    I have accessed and checked the settings for the website having issues and everything looks fine on the settings for now but I am still looking. I need to check your WordPress config file and htaccess file to see if there is anything I can find there but I do not have your FTP login details so would you please share your FTP login details by submitting via our secure contact form as follows: First choose "I have a different question" then in the subject line type "Attn: Lindeni Mahlalela" then in the message box include:

    - FTP Login details (FTP Host, Port, Username and Password)
    - WordPress Super admin login ( username and password) in case support access expires
    - Database login details (link to database login, username and password ) - this is usually phpMyAdmin. We need this to check if there aren't any url's in the database that may cause this.
    - Optonally: cPanel login details (login url, username and password) - you can only provide this and we will be able to access both FTP and Database
    - Link back to this thread for details.

    In the meantime, if you have the following line in wp-config.php:

    define('FORCE_SSL_ADMIN', true);

    Try to remove it or change it to:

    define('FORCE_SSL_ADMIN', true);

    Also try to temporarily disable all directives that force SSL in your wp-config and any such rewrite rules in .htaccess file. After that, please test and let us know the results. If you have no such rules or configurations, please proceed to send the FTP login details so we can have a look and see if there is anything we can do to help.

    I hope to hear back from you soon.

    Have a nice day.
    Mahlamusa

  • antonimike

    Hello Mahlamusa

    As per your request we have send the details via secure contact form. Also we have checked our wp-config.php file in that we does not have define('FORCE_SSL_ADMIN', true);

    Also without ssl we can not work as it is IMP for security. So can you please look in to the plugin code because when we inspect the form of add to cart then we can see form attribute data-ajax-url and its value is with http that we need to be https. This is main issue and because of this we are getting Mixed Content issue. Also we have checked all ajax call like remove item from cart or change country drop-down in checkout page get made with http instead of https.

    So please look in to this ASAP and please give us proper solution.

    Also please check in to Store Setting->Quick Setup on pixxecom admin and click on continue then in payement gateway section we are getting following Fatal Error.

    Fatal error: Cannot unset string offsets in /home/bpobpo76/public_html/myfunnelhost.com/wp-content/plugins/marketpress/includes/admin/class-mp-setup-wizard.php on line 722

    Please look in to this and update us ASAP.

    Thank You.

  • Lindeni Mahlalela

    Hello antonimike

    I hope you are doing great today. Thank you so much for the information you sent through.

    I was able to have a look again to see what was happening. I was able to find a few small things that could cause the reported issue, in addition I have checked the code of the plugin and made one small change that made this to work afterwards.

    So here is what I have done:

    1. In the pixx-ecom site, in "Appearance > Customize > Custom CSS/JS" there was some CSS code placed in a <style> tag which was placed inside a <script> tag and the <script> like so:

    This caused a JavaScript error which was logged in the console as "Unexpected character <" at line XYZ, this JavaScript error is likely to break any other JavaScript code. So I moved the CSS from the Custom JS box to the Custom Code box:

    After this, the JavaScript error disappeared from the console.

    2. In the plugin's code, I have located the code that generates the url for the "Add to Cart" form. In the file: 'marketpress/includes/common/template-functions.php' I have modified the function 'mp_get_ajax_url()' so that it looks like this in shot:

    function mp_get_ajax_url( $path = 'admin-ajax.php' ) {
    	$ajax_url = admin_url( $path );
    	//code removed
    	if( defined( 'DOMAINMAP_BASEFILE' ) ) {
    		//code left out
    		$schema = is_ssl() ? 'https://' : 'http://';
    	 if( is_ssl() && force_ssl_admin() ) {
    	         $schema = 'https://';
    	 }
    		 $ajax_url = $schema . $domain . '/wp-admin/' . $path;
    	}
    	return $ajax_url;
    }

    Basically what I changed "$schema = 'http://';" to "$schema = 'https://';" inside the block. So what this means now is that if Domain Mapping is active and the site is using SSL and admin SSL is forced then set the scheme to HTTPS which makes the 'data-ajax-url' have https:// instead of http://.

    After doing this, I tested and the "Add to Cart" functionality worked only I was stuck at checkout not being able to "Submit Order", this was simply because there was no Payment Gateway selected.

    3. I selected the "Manual Payments" from the page "Store Settings > Payments". After saving the settings for this I was able to proceed to checkout and place an order. This also solves the error you mentioned in your last post about the error you get when on the Quick Setup wizard, I checked the code on the specified line, it is because the code code tries to remove a gateway from a list of gateways while the list is empty, that is why it throws the error. Choosing at least one Gateway solves this problem.

    I hope this is helpful but please let us know if you are having any further issues with regards to this and we will be able to help in any way possible.

    Have a nice day.
    Mahlamusa

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.