Jump to content

A code to access PrestaShop from LAN IPs


Tuni-Soft

Recommended Posts

Hello,

 

I needed to test a prestashop module across multiple devices and had to change PS Shop domain everytime I reconnect and the local server ip changes

 

I don't have a fixed LAN IP option, I had to change Shop domain everytime to something like 192.168.1.X, I added this code to index.php

 

To be added before the existing lines in index.php on the root

 

require_once(dirname(__FILE__).'/config/settings.inc.php');
$link = mysql_connect(_DB_SERVER_,_DB_USER_,_DB_PASSWD_);
mysql_selectdb(_DB_NAME_);


$host = mysql_real_escape_string($_SERVER['HTTP_HOST']);
$query = 'UPDATE '._DB_PREFIX_.'shop_url set domain="'.$host.'", domain_ssl="'.$host.'"';
mysql_query($query);

I hope this code helps somebody

If you know about a better method to change the domain dynamically, please post it

 

Thank you

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...