David475 Posted October 31, 2013 Share Posted October 31, 2013 (edited) hi i trying to change the default language in ebay module for english this is the EbayCountrySpec.php <?php if (!in_array('Ebay', get_declared_classes())) require_once(dirname(__FILE__).'/../ebay.php'); class EbayCountrySpec { public $country; public $accepted_isos = array('it', 'fr', 'gb', 'es'); private $country_data = array( 'it' => array( 'site_id' => 101, 'language' => 'it_IT', 'currency' => 'EUR', 'site_name' => 'Italy', 'site_extension' => 'it', 'img_stats' => null ), 'gb' => array( 'site_id' => 3, 'language' => 'en_GB', 'currency' => 'GBP', 'site_name' => 'UK', 'site_extension' => 'co.uk', 'img_stats' => null ), 'es' => array( 'site_id' => 186, 'language' => 'es_ES', 'currency' => 'EUR', 'site_name' => 'Spain', 'site_extension' => 'es', 'img_stats' => null ), 'fr' => array( 'site_id' => 71, 'language' => 'fr_FR', 'currency' => 'EUR', 'site_name' => 'France', 'site_extension' => 'fr', 'img_stats' => 'views/img/ebay_stats.png' ) ); public function __construct(Country $country = null) { if ($country != null) $this->country = $country; else $this->country = $this->_getCountry(); } public function getSiteID() { return $this->_getCountryData('site_id'); } public function getLanguage() { return $this->_getCountryData('language'); } public function getCurrency() { return $this->_getCountryData('currency'); } public function getSiteName() { return $this->_getCountryData('site_name'); } public function getSiteExtension() { return $this->_getCountryData('site_extension'); } public function getImgStats() { return $this->_getCountryData('img_stats'); } public function getIsoCode() { if (!$this->country) return null; return $this->country->iso_code; } public function getIdLang() { $id_lang = Language::getIdByIso($this->getIsoCode()); if (!$id_lang) //Fix for UK $id_lang = Configuration::get('PS_LANG_DEFAULT'); return (int)$id_lang; } private function _getCountryData($data) { $iso_code = strtolower($this->country->iso_code); if (isset($this->country_data[$iso_code])) return $this->country_data[$iso_code][$data]; return $this->country_data['fr'][$data]; } /** * Tools Methods * * Sends back true or false **/ public function checkCountry() { if (in_array(strtolower($this->country->iso_code), $this->accepted_isos)) return true; return false; } /** * Tools Methods * * Set country * **/ private function _getCountry() { // If eBay module has already been called once, use the default country if (!is_object($this->country)) $this->country = new Country((int)Configuration::get('EBAY_COUNTRY_DEFAULT')); // Else use PrestaShop Default country if (in_array(strtolower($this->country->iso_code), $this->accepted_isos)) return $this->country; $this->country = new Country((int)Configuration::get('PS_COUNTRY_DEFAULT')); if (in_array(strtolower($this->country->iso_code), $this->accepted_isos)) Configuration::updateValue('EBAY_COUNTRY_DEFAULT', $this->country->id, false, 0, 0); return $this->country; } } help will be appreciated. thanks Edited October 31, 2013 by David475 (see edit history) Link to comment Share on other sites More sharing options...
Prestalia Posted November 8, 2013 Share Posted November 8, 2013 language of what? this code is for ebay when you add a product Link to comment Share on other sites More sharing options...
David475 Posted November 8, 2013 Author Share Posted November 8, 2013 i like to change the language of the description in english Link to comment Share on other sites More sharing options...
irrelevant Posted November 15, 2013 Share Posted November 15, 2013 Did this not work ? 1 Link to comment Share on other sites More sharing options...
David475 Posted November 17, 2013 Author Share Posted November 17, 2013 Did this not work ? in this version the getIdLang() is in a function and when i edited it freezes my store. The default lang in the shop is english ( but activated with spanish, italian, french and portuguese) and the default country is set to Spain. any idea? Link to comment Share on other sites More sharing options...
Rosner55 Posted December 21, 2013 Share Posted December 21, 2013 (edited) I am happy to find this post very useful for me, as it contains lot of information. I always prefer to read the quality content and this thing I found in you post. Thanks for sharing. ___________________________________ http://www.writersdrive.com/PlagiarismChecker.html Edited June 18, 2014 by Rosner55 (see edit history) 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