Ejemplo n.º 1
0
 /**
  * Read config options
  *
  * @param mixed $force Force OPTIONAL
  *
  * @return \XLite\Core\CommonCell
  */
 public function readConfig($force = false)
 {
     if (!isset($this->config) || $force) {
         $config = \XLite\Core\Database::getRepo('XLite\\Model\\Config')->getAllOptions($force);
         if ($config && $config->General && $config->General->default_admin_language) {
             parent::setDefaultLanguage($config->General->default_admin_language);
         }
         // Add human readable store country and state names for Company options
         if (isset($config->Company)) {
             $config->Company->locationCountry = \XLite\Core\Database::getRepo('XLite\\Model\\Country')->find($config->Company->location_country);
             $hasStates = $config->Company->locationCountry && $config->Company->locationCountry->hasStates();
             $config->Company->locationState = \XLite\Core\Database::getRepo('XLite\\Model\\State')->findById($hasStates ? $config->Company->location_state : -1, $config->Company->location_custom_state);
         }
         // Add human readable default country name for General options
         if (isset($config->General)) {
             $config->General->defaultCountry = \XLite\Core\Database::getRepo('XLite\\Model\\Country')->find($config->Shipping->anonymous_country);
         }
         $this->config = $config;
     }
     return $this->config;
 }