Пример #1
0
 private function displaySettingsForm()
 {
     if (!Configuration::get('yotpo_rich_snippet_cache_created')) {
         $created = YotpoSnippetCache::createDB();
         Configuration::updateValue('yotpo_rich_snippet_cache_created', 1, $created);
     }
     global $smarty;
     $smarty->assign(array('yotpo_action' => $_SERVER['REQUEST_URI'], 'yotpo_appKey' => Tools::getValue('yotpo_app_key', Configuration::get('yotpo_app_key')), 'yotpo_oauthToken' => Tools::getValue('yotpo_oauth_token', Configuration::get('yotpo_oauth_token')), 'yotpo_widgetLocation' => Configuration::get('yotpo_widget_location'), 'yotpo_showPastOrdersButton' => Configuration::get('yotpo_past_orders') != 1 ? true : false, 'yotpo_tabName' => Configuration::get('yotpo_widget_tab_name'), 'yotpo_bottomLineEnabled' => Configuration::get('yotpo_bottom_line_enabled'), 'yotpo_bottomLineLocation' => Configuration::get('yotpo_bottom_line_location'), 'yotpo_widget_language_code' => Configuration::get('yotpo_language'), 'yotpo_language_as_site' => Configuration::get('yotpo_language_as_site'), 'yotpo_rich_snippets' => Configuration::get('yotpo_rich_snippets')));
     $settings_template = $this->display(__FILE__, 'tpl/settingsForm.tpl');
     if (strpos($settings_template, 'yotpo_map_enabled') != false || strpos($settings_template, 'yotpo_language_as_site') == false || strpos($settings_template, 'yotpo_rich_snippets') == false) {
         if (method_exists($smarty, 'clearCompiledTemplate')) {
             $smarty->clearCompiledTemplate(_PS_MODULE_DIR_ . $this->name . '/tpl/settingsForm.tpl');
             $settings_template = $this->display(__FILE__, 'tpl/settingsForm.tpl');
         } elseif (method_exists($smarty, 'clear_compiled_tpl')) {
             $smarty->clear_compiled_tpl(_PS_MODULE_DIR_ . $this->name . '/tpl/settingsForm.tpl');
             $settings_template = $this->display(__FILE__, 'tpl/settingsForm.tpl');
         } elseif (isset($smarty->force_compile)) {
             $value = $smarty->force_compile;
             $smarty->force_compile = true;
             $settings_template = $this->display(__FILE__, 'tpl/settingsForm.tpl');
             $smarty->force_compile = $value;
         }
     }
     $this->_html .= $settings_template;
 }
Пример #2
0
 private function displaySettingsForm()
 {
     $db_version = Configuration::get('yotpo_db_version');
     if (is_bool($db_version) && !$db_version) {
         if (!Configuration::get('yotpo_rich_snippet_cache_created')) {
             YotpoSnippetCache::createDB();
             Configuration::updateValue('yotpo_rich_snippet_cache_created', 1);
         } else {
             $this->registerHook('yotpoProductAvarageScore');
             $this->registerHook('yotpoProductReviewCount');
             YotpoSnippetCache::updateDB();
             Configuration::updateValue('yotpo_db_version', $this->db_version);
         }
     }
     $smarty = $this->context->smarty;
     $all_statuses = OrderState::getOrderStates($this->getLanguageId());
     //no configuration found -- use default
     if (Configuration::get('yotpo_map_status') == false) {
         Configuration::updateValue('yotpo_map_status', serialize($this->getAcceptedMapStatuses()), false);
     }
     if (method_exists('Tools', "unSerialize")) {
         $selected_statuses = Tools::unSerialize(Configuration::get('yotpo_map_status'));
     } else {
         $selected_statuses = @unserialize(Configuration::get('yotpo_map_status'));
     }
     foreach ($all_statuses as &$status) {
         $status['selected'] = in_array($status['id_order_state'], $selected_statuses) ? '1' : '0';
     }
     $smarty->assign(array('yotpo_action' => $_SERVER['REQUEST_URI'], 'yotpo_appKey' => Tools::getValue('yotpo_app_key', Configuration::get('yotpo_app_key')), 'yotpo_oauthToken' => Tools::getValue('yotpo_oauth_token', Configuration::get('yotpo_oauth_token')), 'yotpo_widgetLocation' => Configuration::get('yotpo_widget_location'), 'yotpo_showPastOrdersButton' => Configuration::get('yotpo_past_orders') != 1 ? true : false, 'yotpo_tabName' => Configuration::get('yotpo_widget_tab_name'), 'yotpo_bottomLineEnabled' => Configuration::get('yotpo_bottom_line_enabled'), 'yotpo_bottomLineLocation' => Configuration::get('yotpo_bottom_line_location'), 'yotpo_widget_language_code' => Configuration::get('yotpo_language'), 'yotpo_language_as_site' => Configuration::get('yotpo_language_as_site'), 'yotpo_rich_snippets' => Configuration::get('yotpo_rich_snippets'), 'yotpo_all_statuses' => $all_statuses));
     $settings_template = $this->display(__FILE__, 'views/templates/admin/settingsForm.tpl');
     if (strpos($settings_template, 'yotpo_map_enabled') != false || strpos($settings_template, 'yotpo_language_as_site') == false || strpos($settings_template, 'yotpo_rich_snippets') == false) {
         $settings_template = $this->getNonCachedTemplate('views/templates/admin/settingsForm.tpl');
     }
     $this->_html .= $settings_template;
 }