rosuandreimihai Posted October 16, 2015 Share Posted October 16, 2015 I am trying to override a core controller protected function within PrestaShop 1.6.1. The controller is AddressController.phpThe override controller looks like: class AddressController extends AddressControllerCore { /** * Assign template vars related to countries display */ protected function assignCountries() { $this->id_country = (int)Tools::getCountry($this->_address); // Generate countries list if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) { $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true); } else { $countries = Country::getCountries($this->context->language->id, true); } // @todo use helper $list = ''; $product_by_country = Configuration::get('TOOLPRODUCTCOUNTRY_PRICE'); foreach ($countries as $country) { if($product_by_country==1){ if (isset(Context::getContext()->cookie->productcountry_delivery)) { $selected = ((int)$country['id_country'] === Context::getContext()->cookie->productcountry_delivery) ? ' selected="selected"' : ''; } else { $selected = ((int)$country['id_country'] === $this->id_country) ? ' selected="selected"' : ''; } } else { $selected = ((int)$country['id_country'] === $this->id_country) ? ' selected="selected"' : ''; } $list .= '<option value="'.(int)$country['id_country'].'"'.$selected.'>'.htmlentities($country['name'], ENT_COMPAT, 'UTF-8').'</option>'; } // Assign vars $this->context->smarty->assign(array( 'countries_list' => $list, 'countries' => $countries, 'sl_country' => (int)$this->id_country, )); } } Basically, I want to show in the checkout steps as default country another one than selected in PrestaShop BO for the `$('#id_country')` drop down list. The country desired is chosen before the checkout process and is stored as `productcountry_delivery`.The problem is that this code is not taken into consideration by Prestashop, as if it wouldn't exist.I have removed the class_index.php from cache folder to force a recompile but yet again with no succesCould someone help me figure this out?Thank you! Link to comment Share on other sites More sharing options...
Rolige Posted October 16, 2015 Share Posted October 16, 2015 Maybe the override is working correctly, but I remember that countries are stored in a JavaScript variable (not sure), maybe that's why you can't see any change. Link to comment Share on other sites More sharing options...
rosuandreimihai Posted October 16, 2015 Author Share Posted October 16, 2015 No, I also tried to place a die() command at the begin of the function and nothing.. Link to comment Share on other sites More sharing options...
hatak Posted October 16, 2015 Share Posted October 16, 2015 clear cache manualy cache/smarty/cache/ and cache/smarty/compile - clear even u don't use the cache Link to comment Share on other sites More sharing options...
rosuandreimihai Posted October 16, 2015 Author Share Posted October 16, 2015 Nope, that didn't worked.. I cleared the cache as mentioned but still with no effect The problem is that I use in the same time another override for another controller and that one works flowless.. There is something happening with this one and I cann't figure it out.. 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