Jump to content

How to get selected shop id ?


raymond69

Recommended Posts

Hi, please excuse me in advance for my english I'm french guy .

 

I have a multishop store and I'm currently trying to get the id of the shop that I selected in my BO from a module. The problem is that, when I use that method Shop::getContextShopID() it always return me the id of the shop I logged in on the BO instead of the id of the shop I selected.

 

Could you please help me ?

 

Thanks in advance !

Link to comment
Share on other sites

Hello vekia,

 

Inside my module folder I have a php script which is executed from an ajax call, I use the code inside this script.

 

Here is the code that I have in my script : 

<?php

	header("Access-Control-Allow-Origin: *");

	require_once(dirname(__FILE__).'/../../config/config.inc.php');
	require_once(dirname(__FILE__).'/../../config/settings.inc.php');


	//echo Shop::getContextShopID(true);

	$id_shop = (int)Context::getContext()->shop->id;

	echo $id_shop;

	die();

?>

Thanks in advance !

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...