Jump to content

Ошибка в модуле statssales и возможное решение


Recommended Posts

версия PrestShop 1.1.0.5
версия Statssales 1.0

В модуле Statssales для вывода графиков по умолчанию подписи выводятся на французком языке. Уж не знаю для чего это сделано, но тупо подставляется в sql запрос id_lang=2
Решается так в modules/statssales.php :
БЫЛО 1:

   public function hookAdminStatsModules($params)
   {
       $totals = $this->getTotals();
       $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
       $result = Db::getInstance()->ExecuteS('
       SELECT osl.`name`, COUNT(oh.`id_order`) as total
       FROM `'._DB_PREFIX_.'order_state` os
       LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = 2)
...



СТАЛО 1:

   public function hookAdminStatsModules($params)
   {
       $id_lang = $params['cookie']->id_lang;
       $totals = $this->getTotals();
       $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
       $result = Db::getInstance()->ExecuteS('
       SELECT osl.`name`, COUNT(oh.`id_order`) as total
       FROM `'._DB_PREFIX_.'order_state` os
       LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.$id_lang.')
...



БЫЛО 2:

   private function getStatesData()
   {
       $result = Db::getInstance()->ExecuteS('
       SELECT osl.`name`, COUNT(oh.`id_order`) as total
       FROM `'._DB_PREFIX_.'order_state` os
       LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = 2)
...



СТАЛО 2:

   private function getStatesData()
   {
       global $cookie;
       $id_lang = (isset($cookie->id_lang) ? intval($cookie->id_lang) : Configuration::get('PS_LANG_DEFAULT'));
       $result = Db::getInstance()->ExecuteS('
       SELECT osl.`name`, COUNT(oh.`id_order`) as total
       FROM `'._DB_PREFIX_.'order_state` os
       LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.$id_lang.')
...

Link to comment
Share on other sites

  • 1 month later...
×
×
  • Create New...