public function hookAdvancedPaymentOptions($param)
 {
     $legacyOptions = Hook::exec('displayPaymentEU', array(), null, true);
     $newOptions = array();
     Media::addJsDef(array('aeuc_tos_err_str' => Tools::htmlentitiesUTF8($this->l('You must agree to our Terms of Service before going any further!', 'ps_legalcompliance'))));
     Media::addJsDef(array('aeuc_submit_err_str' => Tools::htmlentitiesUTF8($this->l('Something went wrong. If the problem persists, please contact us.', 'ps_legalcompliance'))));
     Media::addJsDef(array('aeuc_no_pay_err_str' => Tools::htmlentitiesUTF8($this->l('Select a payment option first.', 'ps_legalcompliance'))));
     Media::addJsDef(array('aeuc_virt_prod_err_str' => Tools::htmlentitiesUTF8($this->l('Please check the "Revocation of virtual products" box first!', 'ps_legalcompliance'))));
     if ($legacyOptions) {
         foreach ($legacyOptions as $module_name => $legacyOption) {
             if (!$legacyOption) {
                 continue;
             }
             foreach (PaymentOption::convertLegacyOption($legacyOption) as $option) {
                 $option->setModuleName($module_name);
                 $to_be_cleaned = $option->getForm();
                 if ($to_be_cleaned) {
                     $cleaned = str_replace('@hiddenSubmit', '', $to_be_cleaned);
                     $option->setForm($cleaned);
                 }
                 $newOptions[] = $option;
             }
         }
     }
     return $newOptions;
 }
 public function hookDisplayHeader()
 {
     if ($this->algolia->isConfigurationValid() === false) {
         return false;
     }
     require_once dirname(__FILE__) . '/classes/AlgoliaSearch.php';
     require_once dirname(__FILE__) . '/classes/AlgoliaSync.php';
     /* Generate Algolia front controller link for search form */
     $search_url = Context::getContext()->link->getModuleLink('algolia', 'search');
     $this->context->smarty->assign('algolia_search_url', $search_url);
     /* Add JS values for Algolia scripts */
     $algolia_search = new AlgoliaSearch();
     $algolia_sync = new AlgoliaSync();
     $language = Context::getContext()->language;
     $algolia_sync_settings = $algolia_sync->getSettings($language->id);
     Media::addJsDef(array('algolia_application_id' => $algolia_search->getApplicationID(), 'algolia_index_name' => $algolia_search->getIndexName(), 'algolia_search_iso_code' => $language->iso_code, 'algolia_search_only_api_key' => $algolia_search->getSearchOnlyAPIKey(), 'algolia_search_url' => $search_url, 'algolia_attributes_to_index' => $algolia_sync_settings['attributesToIndex'], 'algolia_attributes_for_faceting' => $algolia_sync_settings['attributesForFaceting']));
     /* Add CSS & JS files required for Algolia search */
     $this->context->controller->addJS($this->_path . '/js/typeahead.bundle.js');
     $this->context->controller->addJS($this->_path . '/js/hogan-3.0.1.js');
     $this->context->controller->addJS($this->_path . '/js/algoliasearch.min.js');
     $this->context->controller->addCSS($this->_path . '/css/algolia.css');
     /**
      * Load the appropriate JS search script
      * Depending on the search method
      */
     if (Configuration::get('ALGOLIA_SEARCH_TYPE') == Algolia::Facet_Search) {
         $this->context->controller->addJS($this->_path . '/js/algolia_facet_search.js');
     } elseif (Configuration::get('ALGOLIA_SEARCH_TYPE') == Algolia::Simple_Search) {
         $this->context->controller->addJS($this->_path . '/js/algolia_simple_search.js');
     }
 }
Ejemplo n.º 3
0
 public function setMedia()
 {
     parent::setMedia();
     Media::addJsDef(array('admin_fronteditor_ajax_url' => $this->context->link->getAdminLink('IqitFronteditor')));
     $this->addCSS(array(_MODULE_DIR_ . 'iqitcontentcreator/css/bfronteditor.css'));
     $this->addJS(array(_MODULE_DIR_ . 'iqitcontentcreator/js/bfronteditor.js'));
 }
 public function initContent()
 {
     parent::initContent();
     if (Configuration::get('PS_EU_PAYMENT_API')) {
         $instance = new EU_Legal();
         Media::addJsDef(array('deliveryNowValue' => $this->product->delivery_now, 'deliveryLaterValue' => $this->product->delivery_later, 'deliveryNoStockValue' => $instance->l('This product is no longer in stock')));
     }
 }
Ejemplo n.º 5
0
 public function hookHeader($params)
 {
     if (!$this->_appid || !$this->_appkey) {
         return;
     }
     Media::addJsDef(array('facebook_appid' => $this->_appid, 'facebook_scope' => $this->_appscope));
     $this->context->controller->addJs($this->_path . 'views/js/login.js', 'all');
     $this->context->controller->addCss($this->_path . 'views/css/login.css', 'all');
 }
Ejemplo n.º 6
0
 public function hookHeader($params)
 {
     if (!$this->_client_id || !$this->_client_secret) {
         return;
     }
     Media::addJsDef(array('google_appid' => $this->_client_id, 'google_scope' => $this->_client_scope));
     $this->context->controller->addJs($this->_path . 'views/js/login.js', 'all');
     $this->context->controller->addCss($this->_path . 'views/css/login.css', 'all');
 }
Ejemplo n.º 7
0
 public function hookTop($params)
 {
     $key = $this->getCacheId('blocksearch-top' . (!isset($params['hook_mobile']) || !$params['hook_mobile'] ? '' : '-hook_mobile'));
     if (Tools::getValue('search_query') || !$this->isCached('blocksearch-top.tpl', $key)) {
         $this->calculHookCommon($params);
         $this->smarty->assign(array('blocksearch_type' => 'top', 'search_query' => (string) Tools::getValue('search_query')));
     }
     Media::addJsDef(array('blocksearch_type' => 'top'));
     return $this->display(__FILE__, 'blocksearch-top.tpl', Tools::getValue('search_query') ? null : $key);
 }
Ejemplo n.º 8
0
 public function hookDisplayHeader($params)
 {
     if (Configuration::get('PS_CATALOG_MODE')) {
         return;
     }
     $this->context->controller->addCss($this->_path . 'css/iqitcountdown.css', 'all');
     $this->context->controller->addJS($this->_path . 'js/count.js');
     $this->context->controller->addJS($this->_path . 'js/iqitcountdown.js');
     Media::addJsDef(array('countdownEnabled' => true));
 }
Ejemplo n.º 9
0
 public function hookDisplayHome($params)
 {
     if (!$this->isCached('lasttweets.tpl', $this->getCacheId())) {
         global $smarty;
         $smarty->assign('username', Configuration::get('PS_TWITTER_USERNAME'));
         $smarty->assign('this_path', $this->_path);
     }
     Media::addJsDef(array('twitter_widgetid' => Configuration::get('PS_TWITTER_ID')));
     Media::addJsDef(array('twitter_numberoftweets' => Configuration::get('PS_TWITTER_NB')));
     return $this->display(__FILE__, 'lasttweets.tpl', $this->getCacheId());
 }
Ejemplo n.º 10
0
 public function setMedia()
 {
     $this->addJquery();
     $this->addjqueryPlugin('validate');
     $this->addJS(_PS_JS_DIR_ . 'jquery/plugins/validate/localization/messages_' . $this->context->language->iso_code . '.js');
     $this->addCSS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/css/admin-theme.css', 'all', 0);
     $this->addCSS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/css/overrides.css', 'all', PHP_INT_MAX);
     $this->addJS(_PS_JS_DIR_ . 'vendor/spin.js');
     $this->addJS(_PS_JS_DIR_ . 'vendor/ladda.js');
     Media::addJsDef(array('img_dir' => _PS_IMG_));
     Media::addJsDefL('one_error', $this->l('There is one error.', null, true, false));
     Media::addJsDefL('more_errors', $this->l('There are several errors.', null, true, false));
     Hook::exec('actionAdminLoginControllerSetMedia');
 }
Ejemplo n.º 11
0
 public function setMedia()
 {
     parent::setMedia();
     $this->context->controller->addJS($this->module->getLocalPath() . 'js/back.js');
     $this->context->controller->addCSS($this->module->getLocalPath() . 'css/back.css');
     $this->context->controller->addJS($this->module->getLocalPath() . 'js/fontawesome-iconpicker.min.js');
     $this->context->controller->addCSS($this->module->getLocalPath() . 'css/fontawesome-iconpicker.min.css');
     $this->context->controller->addJS($this->module->getLocalPath() . 'js/spectrum.js');
     $this->context->controller->addCSS($this->module->getLocalPath() . 'css/spectrum.css');
     $this->context->controller->addCSS($this->module->getLocalPath() . 'css/fronteditor.css');
     $this->context->controller->addJS($this->module->getLocalPath() . 'js/fronteditor.js');
     Media::addJsDef(array('iqit_frontcreator' => true));
     $this->context->controller->addJqueryUI('ui.sortable');
     $this->context->controller->addJqueryPlugin('autocomplete');
 }
Ejemplo n.º 12
0
 protected function getOptionFields()
 {
     $forms = array();
     $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
     $carriers = Carrier::getCarriers($this->context->language->id, true);
     $modules = Module::getModulesOnDisk(true);
     $forms = array('payment' => array('title' => $this->l('Average bank fees per payment method'), 'id' => 'payment'), 'carriers' => array('title' => $this->l('Average shipping fees per shipping method'), 'id' => 'carriers'), 'other' => array('title' => $this->l('Other settings'), 'id' => 'other'));
     foreach ($forms as &$form) {
         $form['icon'] = 'tab-preferences';
         $form['fields'] = array();
         $form['submit'] = array('title' => $this->l('Save'));
     }
     foreach ($modules as $module) {
         if (isset($module->tab) && $module->tab == 'payments_gateways' && $module->id) {
             $moduleClass = Module::getInstanceByName($module->name);
             if (!$moduleClass->isEnabledForShopContext()) {
                 continue;
             }
             $forms['payment']['fields']['CONF_' . strtoupper($module->name) . '_FIXED'] = array('title' => $module->displayName, 'desc' => sprintf($this->l('Choose a fixed fee for each order placed in %1$s with %2$s.'), $currency->iso_code, $module->displayName), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => $currency->iso_code);
             $forms['payment']['fields']['CONF_' . strtoupper($module->name) . '_VAR'] = array('title' => $module->displayName, 'desc' => sprintf($this->l('Choose a variable fee for each order placed in %1$s with %2$s. It will be applied on the total paid with taxes.'), $currency->iso_code, $module->displayName), 'validation' => 'isPercentage', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
             if (Currency::isMultiCurrencyActivated()) {
                 $forms['payment']['fields']['CONF_' . strtoupper($module->name) . '_FIXED_FOREIGN'] = array('title' => $module->displayName, 'desc' => sprintf($this->l('Choose a fixed fee for each order placed with a foreign currency with %s.'), $module->displayName), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => $currency->iso_code);
                 $forms['payment']['fields']['CONF_' . strtoupper($module->name) . '_VAR_FOREIGN'] = array('title' => $module->displayName, 'desc' => sprintf($this->l('Choose a variable fee for each order placed with a foreign currency with %s. It will be applied on the total paid with taxes.'), $module->displayName), 'validation' => 'isPercentage', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
             }
         }
     }
     foreach ($carriers as $carrier) {
         $forms['carriers']['fields']['CONF_' . strtoupper($carrier['id_reference']) . '_SHIP'] = array('title' => $carrier['name'], 'desc' => sprintf($this->l('For the carrier named %s, indicate the domestic delivery costs  in percentage of the price charged to customers.'), $carrier['name']), 'validation' => 'isPercentage', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
         $forms['carriers']['fields']['CONF_' . strtoupper($carrier['id_reference']) . '_SHIP_OVERSEAS'] = array('title' => $carrier['name'], 'desc' => sprintf($this->l('For the carrier named %s, indicate the overseas delivery costs in percentage of the price charged to customers.'), $carrier['name']), 'validation' => 'isPercentage', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
     }
     $forms['carriers']['description'] = $this->l('Method: Indicate the percentage of your carrier margin. For example, if you charge $10 of shipping fees to your customer for each shipment, but you really pay $4 to this carrier, then you should indicate "40" in the percentage field.');
     $forms['other']['fields']['CONF_AVERAGE_PRODUCT_MARGIN'] = array('title' => $this->l('Average gross margin percentage'), 'desc' => $this->l('You should calculate this percentage as follows: ((total sales revenue) - (cost of goods sold)) / (total sales revenue) * 100. This value is only used to calculate the Dashboard approximate gross margin, if you do not specify the wholesale price for each product.'), 'validation' => 'isPercentage', 'cast' => 'intval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
     $forms['other']['fields']['CONF_ORDER_FIXED'] = array('title' => $this->l('Other fees per order'), 'desc' => $this->l('You should calculate this value by making the sum of all of your additional costs per order.'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => $currency->iso_code);
     Media::addJsDef(array('dashboard_ajax_url' => $this->context->link->getAdminLink('AdminDashboard'), 'read_more' => ''));
     return $forms;
 }
Ejemplo n.º 13
0
 public function hookDisplayHeader($params)
 {
     if (Configuration::get('PH_BLOG_LOAD_BXSLIDER')) {
         $this->context->controller->addCSS($this->_path . 'css/jquery.bxslider.css');
     }
     if (Configuration::get('PH_BLOG_LOAD_FONT_AWESOME')) {
         $this->context->controller->addCSS($this->_path . 'css/font-awesome.css');
     }
     $this->context->controller->addCSS($this->_path . 'css/ph_simpleblog.css');
     $this->context->controller->addCSS($this->_path . 'css/custom.css');
     if ($this->is_16 === false) {
         $this->context->controller->addCSS($this->_path . 'css/ph_simpleblog-15.css');
     }
     if (Configuration::get('PH_BLOG_LOAD_FITVIDS')) {
         $this->context->controller->addJS($this->_path . 'js/jquery.fitvids.js');
     }
     if (Configuration::get('PH_BLOG_LOAD_BXSLIDER')) {
         $this->context->controller->addJS($this->_path . 'js/jquery.bxslider.min.js');
     }
     $this->context->controller->addJS($this->_path . 'js/ph_simpleblog.js');
     $this->context->controller->addJqueryPlugin(array('bxslider', 'fancybox'));
     if (Configuration::get('PH_BLOG_MASONRY_LAYOUT') && Configuration::get('PH_BLOG_LOAD_MASONRY')) {
         $this->context->controller->addJS($this->_path . 'js/isotope.pkgd.min.js');
         $this->context->controller->addJS($this->_path . 'js/ph_simpleblog_masonry.js');
     }
     if (Tools::getValue('module') && Tools::getValue('module') == 'ph_simpleblog' && Tools::getValue('controller') == 'single') {
         $controller = Context::getContext()->controller;
         $this->context->smarty->assign(array('post_title' => $controller->simpleblog_post_name, 'post_description' => $controller->simpleblog_post_description, 'post_image' => $controller->simpleblog_post_thumbnail));
         Media::addJsDef(array('ph_sharing_name' => addcslashes($controller->simpleblog_post_name, "'"), 'ph_sharing_url' => addcslashes($controller->simpleblog_post_url, "'"), 'ph_sharing_img' => addcslashes($controller->simpleblog_post_thumbnail, "'")));
         return $this->display(__FILE__, 'header.tpl');
     }
 }
Ejemplo n.º 14
0
 public function hookHeader()
 {
     $this->context->controller->addJQueryUI('ui.slider');
     $this->context->controller->addJqueryPlugin('cooki-plugin');
     $this->context->controller->addJS($this->_path . '/views/js/convermax.js');
     $this->context->controller->addCSS($this->_path . '/views/css/convermax.css');
     if (get_class($this->context->controller) == 'ConvermaxSearchModuleFrontController') {
         $this->context->controller->addJS($this->_path . '/views/js/convermax-search.js');
     }
     $cm_search_url = $this->context->link->getModuleLink('convermax', 'search');
     $this->context->smarty->assign('cm_search_url', $cm_search_url);
     Media::addJsDef(array('cm_url' => Configuration::get('CONVERMAX_URL')));
     Media::addJsDef(array('cm_search_url' => $cm_search_url));
     $home_category = Configuration::get('PS_HOME_CATEGORY');
     $id_category = (int) Tools::getValue('id_category', Tools::getValue('id_category_layered', $home_category));
     if ($id_category != $home_category) {
         Media::addJsDef(array('cm_category' => true));
         $this->context->controller->addJS($this->_path . '/views/js/convermax-search.js');
     }
 }
Ejemplo n.º 15
0
 public function setMedia()
 {
     //Bootstrap
     $this->addCSS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/css/' . $this->bo_css, 'all', 0);
     $this->addJquery();
     $this->addjQueryPlugin(array('scrollTo', 'alerts', 'chosen', 'autosize', 'fancybox'));
     $this->addjQueryPlugin('growl', null, false);
     $this->addJqueryUI(array('ui.slider', 'ui.datepicker'));
     Media::addJsDef(array('host_mode' => defined('_PS_HOST_MODE_') && _PS_HOST_MODE_));
     $this->addJS(array(_PS_JS_DIR_ . 'admin.js?v=' . _PS_VERSION_, _PS_JS_DIR_ . 'tools.js?v=' . _PS_VERSION_, _PS_JS_DIR_ . 'jquery/plugins/timepicker/jquery-ui-timepicker-addon.js'));
     //loads specific javascripts for the admin theme
     $this->addJS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/js/vendor/bootstrap.min.js');
     $this->addJS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/js/vendor/modernizr.min.js');
     $this->addJS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/js/modernizr-loads.js');
     $this->addJS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/js/vendor/moment-with-langs.min.js');
     if (!$this->lite_display) {
         $this->addJS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/js/help.js');
     }
     if (!Tools::getValue('submitFormAjax')) {
         $this->addJS(_PS_JS_DIR_ . 'admin/notifications.js');
     }
     if (defined('_PS_HOST_MODE_') && _PS_HOST_MODE_) {
         $this->addJS('https://cdn.statuspage.io/se-v2.js');
         Media::addJsDefL('status_operational', $this->l('Operational', null, true, false));
         Media::addJsDefL('status_degraded_performance', $this->l('Degraded Performance', null, true, false));
         Media::addJsDefL('status_partial_outage', $this->l('Partial Outage', null, true, false));
         Media::addJsDefL('status_major_outage', $this->l('Major Outage', null, true, false));
         Media::addJsDef(array('host_cluster' => defined('_PS_HOST_CLUSTER_') ? _PS_HOST_CLUSTER_ : 'fr1'));
     }
     // Execute Hook AdminController SetMedia
     Hook::exec('actionAdminControllerSetMedia');
     // Specific Admin Theme
     $this->addCSS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/css/overrides.css', 'all', PHP_INT_MAX);
 }
 /**
  * Renders menu item add/edit form
  *
  * @return string
  */
 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Edit/Add page top menu item')), 'input' => array(array('name' => 'type', 'type' => 'select', 'label' => $this->l('Item type'), 'desc' => $this->l('Select menu item type. This can be a link to an page (object) in PrestaShop, a tree of objects (categories), lists (manufacturers, suppliers), or custom links.'), 'cast' => 'strval', 'default_value' => CTTopMenuItem::TYPE_CUSTOM_LINK, 'options' => array('id' => 'id', 'name' => 'name', 'query' => $this->menuItemTypes)), array('name' => 'entity_id', 'type' => 'text', 'label' => $this->l('Entity ID'), 'desc' => $this->l('Enter the ID of the selected item (object) type. For example, enter product ID or category ID.'), 'hint' => $this->l('Must be an integer greater than 0 and must exists in the shop.')), array('name' => 'tree_max_depth', 'type' => 'text', 'label' => $this->l('Tree Max Depth'), 'desc' => $this->l('For category trees, enter maximum depth of that tree. For example, you may want to display only level 2 categories in the drop down menu.'), 'cast' => 'intval', 'hint' => $this->l('Enter 0 for no limit.')), array('name' => 'name', 'type' => 'text', 'lang' => true, 'label' => $this->l('Name'), 'desc' => $this->l('Enter the menu item name for your custom link or override the link name of PrestaShop objects which are objects names.'), 'cast' => 'strval'), array('name' => 'url', 'type' => 'text', 'lang' => true, 'label' => $this->l('URL'), 'desc' => $this->l('Enter a URL for your custom link or override the menu item URL of PrestaShop object menu item.'), 'cast' => 'strval', 'hint' => $this->l('Can be either absolute or relative URL.')), array('name' => 'title', 'type' => 'text', 'lang' => true, 'label' => $this->l('Hover Title'), 'desc' => $this->l('Will be displayed on mouse hover over the menu item.'), 'cast' => 'strval'), array('name' => 'icon', 'type' => 'text', 'label' => $this->l('Icon'), 'desc' => sprintf($this->l('You may use icons together with the menu item name. Refer to %s for font icon codes.'), '<a href="https://fortawesome.github.io/Font-Awesome/icons/" target="_blank">Font Awesome</a>'), 'cast' => 'strval', 'hint' => $this->l('Do not enter the fa- or icon- part of the class name.')), array('name' => 'class', 'type' => 'text', 'label' => $this->l('CSS Class'), 'desc' => $this->l('You may add some extra CSS classes to this menu item to give it exclusive styling.'), 'cast' => 'strval'), array('type' => 'switch', 'label' => $this->l('No Follow'), 'name' => 'no_follow', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'no_follow_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'no_follow_off', 'value' => 0, 'label' => $this->l('No'))), 'desc' => $this->l('If enabled, the menu item link will have rel="nofollow" attribute.')), array('type' => 'switch', 'label' => $this->l('Active'), 'name' => 'active', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('No'))), 'desc' => $this->l('If disabled, menu item will not be displayed.'))), 'submit' => array('title' => $this->l('Save')));
     $this->addCSS($this->module->getLocalPath() . 'views/css/vendor/typeaheadjs.css');
     $this->addJS($this->module->getLocalPath() . 'views/js/vendor/typeahead.bundle.min.js');
     $this->addJS($this->module->getLocalPath() . 'views/js/bo.js');
     $iconListFilePath = _MODULE_DIR_ . $this->module->name . '/views/json/icons.json';
     if (file_exists(_PS_THEME_DIR_ . 'modules/' . $this->module->name . '/views/json/icons.json')) {
         $iconListFilePath = _THEME_DIR_ . 'modules/' . $this->module->name . '/views/json/icons.json';
     }
     $classListFilePath = _MODULE_DIR_ . $this->module->name . '/views/json/classes.json';
     if (file_exists(_PS_THEME_DIR_ . 'modules/' . $this->module->name . '/views/json/classes.json')) {
         $classListFilePath = _THEME_DIR_ . 'modules/' . $this->module->name . '/views/json/classes.json';
     }
     Media::addJsDef(array('cttopmenu' => array('icon_list_filepath' => $iconListFilePath, 'class_list_filepath' => $classListFilePath, 'menu_item_types' => $this->menuItemTypes)));
     // @TODO Always show?
     if (Shop::isFeatureActive()) {
         $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association'), 'name' => 'checkBoxShopAsso');
     }
     return parent::renderForm();
 }
Ejemplo n.º 17
0
 public function hookDisplayCompareExtraInformation($params)
 {
     Media::addJsDef(array('sharing_name' => addcslashes($this->l('Product comparison'), "'"), 'sharing_url' => addcslashes($this->context->link->getPageLink('products-comparison', null, $this->context->language->id, array('compare_product_list' => Tools::getValue('compare_product_list'))), "'"), 'sharing_img' => addcslashes(_PS_IMG_DIR_ . Configuration::get('PS_LOGO_MAIL', null, null, $this->context->shop->id), "'")));
     if (!$this->isCached('socialsharing_compare.tpl', $this->getCacheId('socialsharing_compare'))) {
         $this->context->smarty->assign(array('PS_SC_TWITTER' => Configuration::get('PS_SC_TWITTER'), 'PS_SC_GOOGLE' => Configuration::get('PS_SC_GOOGLE'), 'PS_SC_FACEBOOK' => Configuration::get('PS_SC_FACEBOOK'), 'PS_SC_PINTEREST' => Configuration::get('PS_SC_PINTEREST')));
     }
     return $this->display(__FILE__, 'socialsharing_compare.tpl', $this->getCacheId('socialsharing_compare'));
 }
 public function renderView()
 {
     if (Tools::getValue('widgetaction')) {
         $wobj = $this->profile->loadWidgetObject(Tools::getValue('type'), $this);
         if ($wobj) {
             $template = $this->createTemplate('widget_action_content.tpl');
             $content = $wobj->renderAdminContent();
             $template->assign(array('content' => $content, 'test' => ''));
         } else {
             $template = $this->createTemplate('widegt_error.tpl');
         }
         return $template->fetch();
     } else {
         if ($this->ajax) {
             $method = 'ajaxDo' . Tools::ucfirst(trim(Tools::getValue('action')));
             if (method_exists($this, $method)) {
                 echo $this->{$method}();
             }
             exit;
         } else {
             $link = $this->context->link;
             $template = $this->createTemplate('editor.tpl');
             $profiles = $this->profile->getList();
             $layoutjson = '';
             if ($this->profile->layout) {
                 $layoutjson = str_replace('\'', '\\\'', trim($this->profile->layout));
             }
             $output = array();
             $profiles = $this->profile->getList();
             foreach ($profiles as $row) {
                 $output[] = array('name' => $row['name'] ? $row['name'] : $this->l('No Name'), 'id' => $row['id_pagebuilderprofile'], 'isdefault' => $row['isdefault']);
             }
             $sfxclss = PsPagebuilderHelper::detectSfxClasses();
             Media::addJsDef(array('PS_PAGEbuilder_URL' => $link->getAdminLink('AdminPspagebuilderProfile'), 'PTS_PAGEBUILDER_FILE_URI' => _PAGEBUILDER_IMAGE_URL_, 'PTS_PAGEBUILDER_FILE_MANAGEMENT' => $link->getAdminLink('AdminPspagebuilderImage'), 'widgetform' => $link->getAdminLink('AdminPspagebuilderProfile') . '&ajax=true', 'listwidgets' => $link->getAdminLink('AdminPspagebuilderProfile') . '&ajax=true', 'widgetdata' => ''));
             $template->assign(array('savelayout' => $link->getAdminLink('AdminPspagebuilderProfile') . '&savelayout=true', 'id_pagebuilderprofile' => $this->profile->id, 'showed' => 1, 'profile' => $this->profile, 'moduleInShop' => $this->profile->checkProfileInShop(), 'profiles' => $output, 'profile_link' => $link->getAdminLink('AdminPspagebuilderProfile'), 'layoutjson' => $layoutjson, 'sfxclss' => $sfxclss));
             return $template->fetch();
         }
     }
 }
 public function hookOverrideTOSDisplay($param)
 {
     $has_tos_override_opt = (bool) Configuration::get('AEUC_LABEL_REVOCATION_TOS');
     $cms_repository = $this->entity_manager->getRepository('CMS');
     // Check first if LEGAL_REVOCATION CMS Role is set
     $cms_role_repository = $this->entity_manager->getRepository('CMSRole');
     $cms_page_associated = $cms_role_repository->findOneByName(Advancedeucompliance::LEGAL_REVOCATION);
     // Check if cart has virtual product
     $has_virtual_product = (bool) Configuration::get('AEUC_LABEL_REVOCATION_VP') && $this->hasCartVirtualProduct($this->context->cart);
     Media::addJsDef(array('aeuc_has_virtual_products' => (bool) $has_virtual_product, 'aeuc_virt_prod_err_str' => Tools::htmlentitiesUTF8($this->l('Please check "Revocation of virtual products" box first !', 'advancedeucompliance'))));
     if ($has_tos_override_opt || (bool) Configuration::get('AEUC_LABEL_REVOCATION_VP')) {
         $this->context->controller->addJS($this->_path . 'views/js/fo_aeuc_tnc.js', true);
     }
     $checkedTos = false;
     $link_conditions = '';
     $link_revocations = '';
     // Get IDs of CMS pages required
     $cms_conditions_id = (int) Configuration::get('PS_CONDITIONS_CMS_ID');
     $cms_revocation_id = (int) $cms_page_associated->id_cms;
     // Get misc vars
     $id_lang = (int) $this->context->language->id;
     $id_shop = (int) $this->context->shop->id;
     $is_ssl_enabled = (bool) Configuration::get('PS_SSL_ENABLED');
     $checkedTos = $this->context->cart->checkedTos ? true : false;
     // Get CMS OBJs
     $cms_conditions = $cms_repository->i10nFindOneById($cms_conditions_id, $id_lang, $id_shop);
     $link_conditions = $this->context->link->getCMSLink($cms_conditions, $cms_conditions->link_rewrite, $is_ssl_enabled);
     if (!strpos($link_conditions, '?')) {
         $link_conditions .= '?content_only=1';
     } else {
         $link_conditions .= '&content_only=1';
     }
     if ($has_tos_override_opt === true) {
         $cms_revocations = $cms_repository->i10nFindOneById($cms_revocation_id, $id_lang, $id_shop);
         // Get links to revocation page
         $link_revocations = $this->context->link->getCMSLink($cms_revocations, $cms_revocations->link_rewrite, $is_ssl_enabled);
         if (!strpos($link_revocations, '?')) {
             $link_revocations .= '?content_only=1';
         } else {
             $link_revocations .= '&content_only=1';
         }
     }
     $this->context->smarty->assign(array('has_tos_override_opt' => $has_tos_override_opt, 'checkedTOS' => $checkedTos, 'link_conditions' => $link_conditions, 'link_revocations' => $link_revocations, 'has_virtual_product' => $has_virtual_product));
     return $this->display(__FILE__, 'hookOverrideTOSDisplay.tpl');
 }
 public function hookOrderConfirmation($params)
 {
     $conversion_label = Configuration::get('ADWORDS_ORDER_CONVERSION_LABEL');
     if (empty($conversion_label)) {
         return;
     }
     $order = new Order((int) Tools::getValue('id_order'));
     $currency = new Currency($order->id_currency);
     $value = number_format($order->getOrdersTotalPaid(), 2);
     Media::addJsDef(array('google_conversion_value' => $value, 'google_conversion_currency' => $currency->iso_code));
     $this->context->smarty->assign(array('gadwords_conversion_value' => $value, 'gadwords_conversion_currency' => $currency->iso_code));
     return $this->hookConversion($params, $conversion_label);
 }
Ejemplo n.º 21
0
 /**
  *
  */
 public function showWidgetsSetting()
 {
     $this->context->controller->addCss(__PS_BASE_URI__ . 'modules/psmegamenu/views/css/admin/widget.css');
     if (Tools::isSubmit('deletepsmegamenu') && Tools::getValue('id_widget')) {
         $model = new PsMegamenuWidget(Tools::getValue('id_widget'));
         $model->deleteItem(Tools::getValue('id_widget'));
         $this->clearCache();
         Tools::redirectAdmin($this->base_config_url);
     }
     $form = '';
     $widget_selected = '';
     $id = (int) Tools::getValue('id_widget');
     $key = (int) Tools::getValue('key');
     $fb_widget_action = $this->base_config_url . '&widgets=1&wtype=' . Tools::getValue('wtype');
     Media::addJsDef(array('fb_widget_action' => $fb_widget_action));
     if (Tools::getValue('key_widget')) {
         $key = Tools::getValue('key_widget');
     }
     if (Tools::getValue('id_widget')) {
         $model = new PsMegamenuWidget($id);
     } else {
         $model = $this->widget;
     }
     $model->loadEngines();
     $model->id_shop = Context::getContext()->shop->id;
     $types = $model->getTypes();
     $resul_html = array('error' => '', 'confirm' => '');
     if (Tools::isSubmit('widgets') && Tools::isSubmit('savepsmegamenu') && Tools::isSubmit('widget_name') && Tools::isSubmit('widget_type') && Tools::getValue('widget_type') && Tools::getValue('widget_name')) {
         $posts = Tools::getAllValues();
         foreach ($posts as $key => $value) {
             $posts[$key] = str_replace('"', '\'', str_replace('\\n\\r', ' ', trim($value)));
         }
         $data = array('id' => $id, 'params' => $this->mscript->encode(serialize($posts)), 'type' => Tools::getValue('widget_type'), 'name' => Tools::getValue('widget_name'));
         foreach ($data as $k => $v) {
             $model->{$k} = $v;
         }
         if ($model->id) {
             if ($model->update()) {
                 $url = $this->base_config_url . '&widgets=1&id_widget=' . Tools::getValue('id_widget') . '&updatepsmegamenu';
                 Tools::redirectAdmin($url);
                 $resul_html['confirm'] = $this->l('Save Widget Setting, Done');
             } else {
                 $resul_html['error'] = $this->l('Can not update widget');
             }
         } else {
             $model->key_widget = time();
             if ($model->add()) {
                 $url = $this->base_config_url . '&widgets=1&id_widget=' . Tools::getValue('id_widget') . '&updatepsmegamenu';
                 Tools::redirectAdmin($url);
                 $resul_html['confirm'] = $this->l('Add New Widget, Done');
             } else {
                 $resul_html['error'] = $this->l('Can not add new widget');
             }
         }
         $id = $model->id;
         $this->clearCache();
     }
     if ($key) {
         $widget_data = $model->getWidetByKey($key);
     } else {
         $widget_data = $model->getWidetById($id);
     }
     $id = (int) $widget_data['id'];
     $widget_selected = array();
     $widget_selected = trim(Tools::strtolower(Tools::getValue('wtype')));
     if ($widget_data['type']) {
         $widget_selected = $widget_data['type'];
     }
     $form = $model->getForm($widget_selected, $widget_data);
     $this->context->smarty->assign('resulHtml', $resul_html);
     $this->context->smarty->assign('form', $form);
     $this->context->smarty->assign('types', $types);
     $this->context->smarty->assign('widget_selected', $widget_selected);
     $this->context->smarty->assign('fb_widget_action', $fb_widget_action);
     $this->context->smarty->assign('backtolist_action', $this->base_config_url . '&widgets=1');
     return $this->display(__FILE__, 'views/templates/admin/widget.tpl');
 }
Ejemplo n.º 22
0
 /**
  * renderForm contains all necessary initialization needed for all tabs
  *
  * @return void
  */
 public function renderList()
 {
     //this code for typo
     $typo = Tools::getValue('typo');
     if ($typo) {
         //check css file in theme
         if (file_exists(_PS_THEME_DIR_ . 'css/modules/pssliderlayer/views/css/typo.css')) {
             $typoDir = _THEME_DIR_ . 'css/' . str_replace('//', '/', 'modules/pssliderlayer') . '/views/css/typo.css';
         } else {
             $typoDir = __PS_BASE_URI__ . str_replace('//', '/', 'modules/pssliderlayer') . '/views/css/typo.css';
         }
         $this->addCss($typoDir, 'all');
         $this->addJS(__PS_BASE_URI__ . 'modules/pssliderlayer/views/js/admin/jquery-ui-1.10.3.custom.min.js');
         $content = Tools::file_get_contents($this->context->link->getMediaLink($typoDir));
         preg_match_all('#\\.tp-caption\\.(\\w+)\\s*{\\s*#', $content, $matches);
         if (isset($matches[1])) {
             $captions = $matches[1];
         }
         $tpl = $this->createTemplate('typo.tpl');
         $tpl->assign(array('typoDir' => $typoDir, 'captions' => $captions, 'field' => Tools::getValue('field')));
         return $tpl->fetch();
     }
     //this code for select or upload IMG
     $tpl = $this->createTemplate('imagemanager.tpl');
     $sortBy = Tools::getValue('sortBy');
     $reloadSliderImage = Tools::getValue('reloadSliderImage');
     $images = $this->getImageList($sortBy);
     $tpl->assign(array('images' => $images, 'reloadSliderImage' => $reloadSliderImage));
     if ($reloadSliderImage) {
         die(Tools::jsonEncode($tpl->fetch()));
     }
     $image_uploader = new HelperImageUploader('file');
     $image_uploader->setSavePath($this->img_path);
     $image_uploader->setMultiple(true)->setUseAjax(true)->setUrl(Context::getContext()->link->getAdminLink('AdminPsSliderLayer') . '&ajax=1&action=addSliderImage');
     Media::addJsDef(array('imgManUrl' => Context::getContext()->link->getAdminLink('AdminPsSliderLayer')));
     $tpl->assign(array('countImages' => count($images), 'images' => $images, 'max_image_size' => $this->max_image_size / 1024 / 1024, 'image_uploader' => $image_uploader->render(), 'imgManUrl' => Context::getContext()->link->getAdminLink('AdminPsSliderLayer'), 'token' => $this->token, 'imgUploadDir' => $this->img_path));
     return $tpl->fetch();
 }
Ejemplo n.º 23
0
 public function hookHeader($params)
 {
     if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
         header('X-UA-Compatible: IE=edge,chrome=1');
     }
     $font_headings_type = Configuration::get($this->configName . '_font_headings_type');
     $font_headings_link = str_replace(array('http://', 'https://'), '', Configuration::get($this->configName . '_font_headings_link'));
     $font_txt_type = Configuration::get($this->configName . '_font_txt_type');
     $font_txt_link = str_replace(array('http://', 'https://'), '', Configuration::get($this->configName . '_font_txt_link'));
     $fonts = array();
     if ($font_txt_type == 2) {
         if ($font_headings_type == 1) {
             $fonts[0] = $font_headings_link;
         }
     } else {
         if ($font_txt_type == 1) {
             $fonts[1] = $font_txt_link;
         }
         if ($font_headings_type == 1) {
             $fonts[0] = $font_headings_link;
         }
     }
     $id_shop = (int) $this->context->shop->id;
     $preloader = Configuration::get($this->configName . '_preloader');
     $lazyload = Configuration::get($this->configName . '_carousel_load');
     $product_tabs = Configuration::get($this->configName . '_product_tabs');
     $header_style = Configuration::get($this->configName . '_header_style');
     $cart_style = Configuration::get($this->configName . '_cart_style');
     if ($header_style == 2) {
         $cart_style = 1;
     }
     $inc = 0;
     if (Context::getContext()->theme->hasLeftColumn($this->context->controller->php_self)) {
         $inc++;
     }
     if (Context::getContext()->theme->hasRightColumn($this->context->controller->php_self)) {
         $inc++;
     }
     $theme_settings = array('ajax_popup' => Configuration::get($this->configName . '_ajax_popup'), 'yotpo_stars' => Configuration::get($this->configName . '_yotpo_stars'), 'preloader' => $preloader, 'header_style' => $header_style, 'cart_style' => $cart_style, 'retina_logo' => Configuration::get($this->configName . '_retina_logo'), 'is_rtl' => $this->context->language->is_rtl, 'top_width' => Configuration::get($this->configName . '_top_width'), 'footer_width' => Configuration::get($this->configName . '_footer_width'), 'f_wrap_width' => Configuration::get($this->configName . '_f_wrap_width'), 'left_on_phones' => Configuration::get($this->configName . '_left_on_phones'), 'breadcrumb_width' => Configuration::get($this->configName . '_breadcrumb_width'), 'product_right_block' => Configuration::get($this->configName . '_product_right_block'), 'accesories_position' => Configuration::get($this->configName . '_accesories_position'), 'product_tabs' => $product_tabs, 'productlist_view' => Configuration::get($this->configName . '_productlist_view'), 'show_desc' => Configuration::get($this->configName . '_show_desc'), 'desc_style' => Configuration::get($this->configName . '_desc_style'), 'show_subcategories' => Configuration::get($this->configName . '_show_subcategories'), 'footer_img_src' => file_exists('modules/themeeditor/img/footer_logo_' . (int) $id_shop . '.jpg'), 'image_path' => $this->_path . 'img/footer_logo_' . (int) $id_shop . '.jpg', 'font_include' => $fonts, 'grid_size_lg' => Configuration::get($this->configName . '_grid_size_lg') - $inc, 'grid_size_md' => Configuration::get($this->configName . '_grid_size_md') - $inc, 'grid_size_sm' => Configuration::get($this->configName . '_grid_size_sm') - $inc, 'grid_size_ms' => Configuration::get($this->configName . '_grid_size_ms') - $inc, 'grid_size_xs' => Configuration::get($this->configName . '_grid_size_xs') - $inc, 'subcats_grid_size_md' => Configuration::get($this->configName . '_subcats_grid_size_md'), 'subcats_grid_size_sm' => Configuration::get($this->configName . '_subcats_grid_size_sm'), 'subcats_grid_size_xs' => Configuration::get($this->configName . '_subcats_grid_size_xs'), 'product_left_size' => Configuration::get($this->configName . '_product_left_size'), 'product_center_size' => Configuration::get($this->configName . '_product_center_size'), 'headings_center' => Configuration::get($this->configName . '_headings_center'), 'logo_width' => Configuration::get($this->configName . '_logo_width'), 'logo_position' => Configuration::get($this->configName . '_logo_position'), 'footer1_status' => Configuration::get($this->configName . '_footer1_status'), 'second_footer' => Configuration::get($this->configName . '_second_footer'), 'iqit_lazy_load' => $lazyload, 'carousel_style' => Configuration::get($this->configName . '_carousel_style'), 'top_bar' => Configuration::get($this->configName . '_top_bar'), 'copyright_text' => Configuration::get($this->configName . '_copyright_text', $this->context->language->id));
     Media::addJsDef(array('iqit_carousel_auto' => (bool) Configuration::get($this->configName . '_carousel_auto')));
     if ($lazyload) {
         Media::addJsDef(array('iqit_carousel_load' => 'ondemand'));
         Media::addJsDef(array('iqit_lazy_load' => true));
     } else {
         Media::addJsDef(array('iqit_carousel_load' => 'progressive'));
         Media::addJsDef(array('iqit_lazy_load' => false));
     }
     if ($header_style == 1) {
         Media::addJsDef(array('iqit_sidebarh' => true));
         $this->context->controller->addCSS($this->_path . 'css/options/hsidebar.css', 'all');
         $this->context->controller->addJS($this->_path . 'js/front/sidebarh.js');
     } elseif ($header_style == 2) {
         $this->context->controller->addCSS($this->_path . 'css/options/inlineh.css', 'all');
         Media::addJsDef(array('iqit_sidebarh' => false));
         Media::addJsDef(array('iqit_inlineh' => true));
     } else {
         Media::addJsDef(array('iqit_sidebarh' => false));
     }
     if (Configuration::get($this->configName . '_show_qty_field')) {
         Media::addJsDef(array('iqit_qtycart' => true));
     }
     if ($cart_style == 1) {
         $this->context->controller->addCSS($this->_path . 'css/options/acart.css', 'all');
     }
     if (Configuration::get($this->configName . '_product_hover') == 1) {
         $this->context->controller->addCSS($this->_path . 'css/options/hover.css', 'all');
     }
     if (!Configuration::get($this->configName . '_big_responsive')) {
         $this->context->controller->addCSS($this->_path . 'css/options/remove_lg.css', 'all');
     }
     if ($preloader) {
         $this->context->controller->addJS($this->_path . 'js/front/preloader.js');
         $this->context->controller->addCSS($this->_path . 'css/options/preloader.css', 'all');
         Media::addJsDef(array('isPreloaderEnabled' => true));
     } else {
         Media::addJsDef(array('isPreloaderEnabled' => false));
     }
     $this->context->controller->addJS($this->_path . 'js/front/script.js');
     $this->context->smarty->assign('warehouse_vars', $theme_settings);
     if (Shop::getContext() == Shop::CONTEXT_GROUP) {
         $this->context->controller->addCSS($this->_path . 'css/themeeditor_g_' . (int) $this->context->shop->getContextShopGroupID() . '.css', 'all');
     } elseif (Shop::getContext() == Shop::CONTEXT_SHOP) {
         $this->context->controller->addCSS($this->_path . 'css/themeeditor_s_' . (int) $this->context->shop->getContextShopID() . '.css', 'all');
     }
     $this->context->controller->addCSS($this->_path . 'css/yourcss.css', 'all');
     if (Shop::getContext() == Shop::CONTEXT_GROUP) {
         $this->context->controller->addJS($this->_path . 'js/front/themeeditor_g_' . (int) $this->context->shop->getContextShopGroupID() . '.js');
     } elseif (Shop::getContext() == Shop::CONTEXT_SHOP) {
         $this->context->controller->addJS($this->_path . 'js/front/themeeditor_s_' . (int) $this->context->shop->getContextShopID() . '.js');
     }
 }
Ejemplo n.º 24
0
 protected function assignGeneralPurposeVariables()
 {
     $templateVars = array('currency' => $this->getTemplateVarCurrency(), 'customer' => $this->getTemplateVarCustomer(), 'language' => $this->objectPresenter->present($this->context->language), 'page' => $this->getTemplateVarPage(), 'shop' => $this->getTemplateVarShop(), 'urls' => $this->getTemplateVarUrls(), 'configuration' => $this->getTemplateVarConfiguration(), 'field_required' => $this->context->customer->validateFieldsRequiredDatabase(), 'breadcrumb' => $this->getBreadcrumb(), 'link' => $this->context->link, 'time' => time(), 'static_token' => Tools::getToken(false), 'token' => Tools::getToken());
     $this->context->smarty->assign($templateVars);
     Media::addJsDef(array('prestashop' => $templateVars));
 }
Ejemplo n.º 25
0
    public function renderForm()
    {
        $limit = 40;
        $this->toolbar_btn['save-and-stay'] = array('href' => '#', 'desc' => $this->l('Save and Stay'));
        /** @var CartRule $current_object */
        $current_object = $this->loadObject(true);
        // All the filter are prefilled with the correct information
        $customer_filter = '';
        if (Validate::isUnsignedId($current_object->id_customer) && ($customer = new Customer($current_object->id_customer)) && Validate::isLoadedObject($customer)) {
            $customer_filter = $customer->firstname . ' ' . $customer->lastname . ' (' . $customer->email . ')';
        }
        $gift_product_filter = '';
        if (Validate::isUnsignedId($current_object->gift_product) && ($product = new Product($current_object->gift_product, false, $this->context->language->id)) && Validate::isLoadedObject($product)) {
            $gift_product_filter = !empty($product->reference) ? $product->reference : $product->name;
        }
        $reduction_product_filter = '';
        if (Validate::isUnsignedId($current_object->reduction_product) && ($product = new Product($current_object->reduction_product, false, $this->context->language->id)) && Validate::isLoadedObject($product)) {
            $reduction_product_filter = !empty($product->reference) ? $product->reference : $product->name;
        }
        $product_rule_groups = $this->getProductRuleGroupsDisplay($current_object);
        $attribute_groups = AttributeGroup::getAttributesGroups($this->context->language->id);
        $currencies = Currency::getCurrencies(false, true, true);
        $languages = Language::getLanguages();
        $countries = $current_object->getAssociatedRestrictions('country', true, true);
        $groups = $current_object->getAssociatedRestrictions('group', false, true);
        $shops = $current_object->getAssociatedRestrictions('shop', false, false);
        $cart_rules = $current_object->getAssociatedRestrictions('cart_rule', false, true, 0, $limit);
        $carriers = $current_object->getAssociatedRestrictions('carrier', true, false);
        foreach ($carriers as &$carriers2) {
            foreach ($carriers2 as &$carrier) {
                foreach ($carrier as $field => &$value) {
                    if ($field == 'name' && $value == '0') {
                        $value = Configuration::get('PS_SHOP_NAME');
                    }
                }
            }
        }
        $gift_product_select = '';
        $gift_product_attribute_select = '';
        if ((int) $current_object->gift_product) {
            $search_products = $this->searchProducts($gift_product_filter);
            if (isset($search_products['products']) && is_array($search_products['products'])) {
                foreach ($search_products['products'] as $product) {
                    $gift_product_select .= '
					<option value="' . $product['id_product'] . '" ' . ($product['id_product'] == $current_object->gift_product ? 'selected="selected"' : '') . '>
						' . $product['name'] . (count($product['combinations']) == 0 ? ' - ' . $product['formatted_price'] : '') . '
					</option>';
                    if (count($product['combinations'])) {
                        $gift_product_attribute_select .= '<select class="control-form id_product_attribute" id="ipa_' . $product['id_product'] . '" name="ipa_' . $product['id_product'] . '">';
                        foreach ($product['combinations'] as $combination) {
                            $gift_product_attribute_select .= '
							<option ' . ($combination['id_product_attribute'] == $current_object->gift_product_attribute ? 'selected="selected"' : '') . ' value="' . $combination['id_product_attribute'] . '">
								' . $combination['attributes'] . ' - ' . $combination['formatted_price'] . '
							</option>';
                        }
                        $gift_product_attribute_select .= '</select>';
                    }
                }
            }
        }
        $product = new Product($current_object->gift_product);
        $this->context->smarty->assign(array('show_toolbar' => true, 'toolbar_btn' => $this->toolbar_btn, 'toolbar_scroll' => $this->toolbar_scroll, 'title' => array($this->l('Payment: '), $this->l('Cart Rules')), 'defaultDateFrom' => date('Y-m-d H:00:00'), 'defaultDateTo' => date('Y-m-d H:00:00', strtotime('+1 month')), 'customerFilter' => $customer_filter, 'giftProductFilter' => $gift_product_filter, 'gift_product_select' => $gift_product_select, 'gift_product_attribute_select' => $gift_product_attribute_select, 'reductionProductFilter' => $reduction_product_filter, 'defaultCurrency' => Configuration::get('PS_CURRENCY_DEFAULT'), 'id_lang_default' => Configuration::get('PS_LANG_DEFAULT'), 'languages' => $languages, 'currencies' => $currencies, 'countries' => $countries, 'carriers' => $carriers, 'groups' => $groups, 'shops' => $shops, 'cart_rules' => $cart_rules, 'product_rule_groups' => $product_rule_groups, 'product_rule_groups_counter' => count($product_rule_groups), 'attribute_groups' => $attribute_groups, 'currentIndex' => self::$currentIndex, 'currentToken' => $this->token, 'currentObject' => $current_object, 'currentTab' => $this, 'hasAttribute' => $product->hasAttributes()));
        Media::addJsDef(array('baseHref' => $this->context->link->getAdminLink('AdminCartRules') . '&ajaxMode=1&ajax=1&id_cart_rule=' . (int) Tools::getValue('id_cart_rule') . '&action=loadCartRules&limit=' . (int) $limit . '&count=0'));
        $this->content .= $this->createTemplate('form.tpl')->fetch();
        $this->addJqueryUI('ui.datepicker');
        $this->addJqueryPlugin(array('jscroll', 'typewatch'));
        return parent::renderForm();
    }
Ejemplo n.º 26
0
 /**
  * slider Editor
  */
 public function renderSliderForm()
 {
     $layerAnimation = array(array('id' => 'fade', 'name' => $this->l('Fade')), array('id' => 'sft', 'name' => $this->l('Short from Top')), array('id' => 'sfb', 'name' => $this->l('Short from Bottom')), array('id' => 'sfr', 'name' => $this->l('Short from Right')), array('id' => 'sfl', 'name' => $this->l('Short from Left')), array('id' => 'lft', 'name' => $this->l('Long from Top')), array('id' => 'lfb', 'name' => $this->l('Long from Bottom')), array('id' => 'lfr', 'name' => $this->l('Long from Right')), array('id' => 'lfl', 'name' => $this->l('Long from Left')), array('id' => 'randomrotate', 'name' => $this->l('Random Rotate')));
     $layers = array();
     if ($this->_currentSlider->layersparams) {
         $layers = array();
         //echo "<pre>";print_r($this->_currentSlider->layersparams);die;
         foreach ($this->_currentSlider->layersparams as $key => $val) {
             $layer = Tools::jsonDecode(PsSliderSlide::base64Decode($val), true);
             //$layer = $std->layers;
             if ($layer) {
                 //					foreach ($layer as $k => &$l)
                 foreach ($layer as &$l) {
                     if (isset($l['layer_caption'])) {
                         $l['layer_caption'] = addslashes(str_replace("'", '&apos;', html_entity_decode(str_replace(array('\\n', '\\r', '\\t'), '', utf8_decode($l['layer_caption'])), ENT_QUOTES, 'UTF-8')));
                     }
                 }
             }
             $layers[] = array('langID' => $key, 'content' => Tools::jsonEncode($layer));
         }
     }
     //echo "<pre>";print_r($layers);die;
     $slideImg = $this->_currentSlider->image;
     $sliderBack = array();
     if ($this->_currentSlider->video) {
         foreach ($this->_currentSlider->video as $key => $val) {
             $video = Tools::jsonDecode(PsSliderSlide::base64Decode($val), true);
             $sliderBack[$key] = '';
             if (isset($video['background_color'])) {
                 $sliderBack[$key] = $video['background_color'];
             }
         }
     }
     //echo "<pre>";print_r($sliderBack);die;
     Media::addJsDef(array('ajaxfilelink' => Context::getContext()->link->getAdminLink('AdminPsSliderLayer'), 'psBaseModuleUri' => $this->img_url, 'SURLIMAGE' => Context::getContext()->link->getAdminLink('AdminPsSliderLayer')));
     $this->context->smarty->assign(array('link' => $this->context->link, 'slideImg' => $slideImg, 'sliderBack' => $sliderBack, 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id, 'layerAnimation' => $layerAnimation, 'sliderGroup' => $this->groupData, 'layers' => $layers, 'ajaxfilelink' => Context::getContext()->link->getAdminLink('AdminPsSliderLayer'), 'formLink' => _MODULE_DIR_ . $this->name . '/ajax_' . $this->name . '.php?secure_key=' . $this->secure_key . '&action=submitslider', 'psBaseModuleUri' => $this->img_url, 'previewLink' => Context::getContext()->link->getModuleLink($this->name, 'preview', array('secure_key' => $this->secure_key)), 'msecure_key' => $this->secure_key, 'id_group' => Tools::getValue('id_group'), 'id_slide' => $this->_currentSlider->id, 'delay' => PsSliderSlide::showDelay((int) Tools::getValue('id_slide'), $this->_sliderData['delay'], $this->groupData['delay'])));
     return $this->display(__FILE__, 'slider_editor.tpl');
 }
Ejemplo n.º 27
0
 public function hookDisplayFooter($params)
 {
     if (Configuration::get($this->config_name . '_pages') && $this->context->controller->php_self != 'index') {
         return;
     }
     if (!isset($_COOKIE['iqitpopup_' . (int) Configuration::get($this->config_name . '_newval')])) {
         if (!$this->isCached('iqitpopup.tpl', $this->getCacheId())) {
             $this->smarty->assign(array('txt' => Configuration::get($this->config_name . '_content', $this->context->language->id), 'newsletter' => Configuration::get($this->config_name . '_newsletter')));
         }
         Media::addJsDef(array('iqitpopup_time' => (int) Configuration::get($this->config_name . '_cookie')));
         Media::addJsDef(array('iqitpopup_name' => 'iqitpopup_' . (int) Configuration::get($this->config_name . '_newval')));
         return $this->display(__FILE__, 'iqitpopup.tpl', $this->getCacheId());
     }
     return false;
 }
 public function postProcess()
 {
     Media::addJsDef(array('algolia_search_controller' => true));
     $this->context->smarty->assign('algolia_query', urlencode(Tools::getValue('q')));
     return $this->setTemplate('search.tpl');
 }
Ejemplo n.º 29
0
 public function hookTop($params)
 {
     Media::addJsDef(array('blocksearch_type' => 'top'));
     Media::addJsDef(array('PS_CATALOG_MODE' => (bool) Configuration::get('PS_CATALOG_MODE')));
     if (Configuration::get('iqitsearch_hook')) {
         if (Tools::getValue('search_query') || !$this->isCached('blocksearch-top_mod.tpl', $this->getCacheId())) {
             $this->calculHookCommon($params);
             $this->smarty->assign(array('blocksearch_type' => 'top', 'iqitsearch_text' => Configuration::get('iqitsearch_text', $this->context->language->id), 'iqitsearch_shower' => Configuration::get('iqitsearch_shower'), 'search_query' => (string) Tools::getValue('search_query')));
         }
     } else {
         if (Tools::getValue('search_query') || !$this->isCached('blocksearch-top_mod.tpl', $this->getCacheId())) {
             $this->smarty->assign(array('iqitsearch_text' => Configuration::get('iqitsearch_text', $this->context->language->id), 'blocksearch_empty' => true));
         }
     }
     return $this->display(__FILE__, 'blocksearch-top_mod.tpl', Tools::getValue('search_query') ? null : $this->getCacheId());
 }
Ejemplo n.º 30
0
 public function hookHeader($params)
 {
     Media::addJsDef(array('fsl_login_url' => $this->context->link->getModuleLink($this->name, 'login'), 'fsl_revoke_url' => $this->context->link->getModuleLink($this->name, 'revoke'), 'customer_logged' => $this->context->customer->isLogged()));
     $this->context->smarty->assign(array('customer_logged' => $this->context->customer->isLogged()));
     foreach ($this->socialNetworkList as $key => $value) {
         $value->hookHeader($params);
     }
     $this->context->controller->addJs($this->_path . 'views/js/login.js', 'all');
     $this->context->controller->addCss($this->_path . 'views/css/login.css', 'all');
     $this->context->controller->addCss($this->_path . 'views/css/bootstrap-social.css', 'all');
     $this->context->controller->addjQueryPlugin(array('fancybox'));
 }