aszele Posted April 17, 2013 Share Posted April 17, 2013 I have to filter a list of customer-linked data to reflect which shop is selected in the back office (adapting a module we purchased to be multi-shop compliant), but I cannot seem to retrieve the actual shop selected no matter what. Both of the following methods always return a value of 1 regardless of which shop is selected: $this->context->shop->id Shop::getContextShopID() According to the http://www.prestashop.com/forums/topic/166687-get-current-store-id-in-admin-panel/ both of those seem to be generated based on the url you are using to access the back office. What is the proper/standard method for filtering a customer list by shop? Link to comment Share on other sites More sharing options...
JoelWebsites Posted July 24, 2015 Share Posted July 24, 2015 I am experiencing the same issue did you fix this issue? Link to comment Share on other sites More sharing options...
Esnyper Posted September 30, 2015 Share Posted September 30, 2015 UP! Link to comment Share on other sites More sharing options...
TiaNex Shopping Posted October 24, 2015 Share Posted October 24, 2015 the same problem, when use Context::getContext()->shop->id in a ajax.php file of a module, it return 1 not the right shop id 8. Link to comment Share on other sites More sharing options...
Alphaloc Posted February 4, 2016 Share Posted February 4, 2016 (edited) please ignore :-) Edited February 4, 2016 by Alphaloc (see edit history) Link to comment Share on other sites More sharing options...
Alphaloc Posted February 5, 2016 Share Posted February 5, 2016 Yes, I realized and corrected my mistake before you clicked reply. Reason I didn't check the original post again is that I use Shop::getContextShopID() all the time, without issue. Just checked it again and it works fine, giving the correct shop id depending on the shop selected, at least for 1.6.1.x Link to comment Share on other sites More sharing options...
arsenalol Posted May 17, 2016 Share Posted May 17, 2016 {$cart->id_shop} ID of shop (multistore feature) Link to comment Share on other sites More sharing options...
trueaquaponics@gmail Posted June 7, 2016 Share Posted June 7, 2016 The following weird stuff works on PrestaShop 1.6. It turns out that the shop id and whether you are in global context (id_shop = 0) can be retrieved from the Cookie object. By accessing the cookie (Context::getContext()->cookie->getAll()) you can then read the shopContext. It is an integer prefixed by s-, so with the following we can retrieve and print the shop context: $cookie = Context::getContext()->cookie->getAll(); ddd((int)substr($cookie['shopContext'], 2, count($cookie['shopContext']))); Please understand I am a newbie and need a little bit of help getting started with doing this. Can you give me a few short steps on where to input this information so that I do not make things worse. Thank you so much for your time. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now