devsoft Posted April 26, 2012 Share Posted April 26, 2012 (edited) Hello I want to get current store id (in admin panel) via ajax call. This one works but not via ajax I always getting 1. $id_shop = (int)Context::getContext()->shop->id; How this should be done in correct way. Edited May 4, 2012 by devsoft (see edit history) Link to comment Share on other sites More sharing options...
Rohit Singhal Posted January 7, 2013 Share Posted January 7, 2013 This check url and then will always return you 1 if you are using yourwebsite.com/admin, it will return other than 1 iff you are using multistorename.yourwebsite.com/admin. I faced the same problem so I used the cookie object. Link to comment Share on other sites More sharing options...
Paul C Posted April 17, 2013 Share Posted April 17, 2013 (edited) I assume that there's no way you can send it along with the call, since the admin screen you're running javascript on will be able to correctly identify the store? Edited April 17, 2013 by Paul C (see edit history) Link to comment Share on other sites More sharing options...
ItalianBoutiqueShoes Posted January 8, 2015 Share Posted January 8, 2015 Same problem. Did you find a solution for it? Link to comment Share on other sites More sharing options...
JoelWebsites Posted July 24, 2015 Share Posted July 24, 2015 Same problem does anyone have a fix for this? Link to comment Share on other sites More sharing options...
vekia Posted July 24, 2015 Share Posted July 24, 2015 you've got this in ajax calls?you included all necessary libraries to php file ? Link to comment Share on other sites More sharing options...
JoelWebsites Posted July 24, 2015 Share Posted July 24, 2015 I am trying to use this in the file controllers/admin/AdminSpecificPriceRuleController.php inside the public function __construct() { } function Link to comment Share on other sites More sharing options...
JoelWebsites Posted July 24, 2015 Share Posted July 24, 2015 (edited) public function __construct() { $this->bootstrap = true; $this->table = 'specific_price_rule'; $this->className = 'SpecificPriceRule'; $this->lang = false; $this->list_reduction_type = array( 'percentage' => $this->l('Percentage'), 'amount' => $this->l('Amount') ); $this->addRowAction('edit'); $this->addRowAction('delete'); $this->context = Context::getContext(); $this->_select = 's.name shop_name,s.id_shop id_shop, cu.name currency_name, cl.name country_name, gl.name group_name'; $this->_join = 'LEFT JOIN '._DB_PREFIX_.'shop s ON (s.id_shop = a.id_shop) LEFT JOIN '._DB_PREFIX_.'currency cu ON (cu.id_currency = a.id_currency) LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = a.id_country AND cl.id_lang='.(int)$this->context->language->id.') LEFT JOIN '._DB_PREFIX_.'group_lang gl ON (gl.id_group = a.id_group AND gl.id_lang='.(int)$this->context->language->id.')'; $this->_where = 'AND a.id_shop IN ("'.(int)Context::getContext().'") '; Edited July 24, 2015 by JoelWebsites (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts