public function getModuleAssign($module_name = '', $name_hook = '')
 {
     //$module_id = 7 ; $id_hook = 21 ;
     if (!$module_name || !$name_hook) {
         return;
     }
     $module = Module::getInstanceByName($module_name);
     $module_id = $module->id;
     $id_hook = Hook::getIdByName($name_hook);
     $hook_name = $name_hook;
     if (!$module) {
         return;
     }
     $module_name = $module->name;
     if (Validate::isLoadedObject($module) && $module->id) {
         $array = array();
         $array['id_hook'] = $id_hook;
         $array['module'] = $module_name;
         $array['id_module'] = $module->id;
         if (_PS_VERSION_ < "1.5") {
             return self::lofHookExec($hook_name, array(), $module->id, $array);
         } else {
             $hook_name = substr($hook_name, 7, strlen($hook_name));
             return self::renderModuleByHookV15($hook_name, array(), $module->id, $array);
         }
     }
     return '';
 }
Example #2
0
    public function renderForm($data)
    {
        $helper = $this->getFormHelper();
        $id_shop = Context::getContext()->shop->id;
        if (isset($data['params']['hookmodule'])) {
            $hid = Hook::getIdByName($data['params']['hookmodule']);
            if ($hid) {
                $hms = Hook::getModulesFromHook($hid);
                foreach ($hms as $hm) {
                    if ($data['params']['loadmodule'] == $hm['name']) {
                        $id_module = $hm['id_module'];
                        $module = Module::getInstanceById($id_module);
                        if (Validate::isLoadedObject($module)) {
                            !$module->unregisterHook((int) $hid, array($id_shop));
                        }
                    }
                }
            }
        }
        $modules = Module::getModulesInstalled(0);
        $output = array();
        $hooks = array('displayHome', 'displayLeftColumn', 'displayRightColumn', 'displayTop', 'displayHeaderRight', 'displaySlideshow', 'topNavigation', 'displayMainmenu', 'displayPromoteTop', 'displayRightColumn', 'displayLeftColumn', 'displayHome', 'displayFooter', 'displayBottom', 'displayContentBottom', 'displayFootNav', 'displayFooterTop', 'displayMapLocal', 'displayFooterBottom');
        foreach ($hooks as $hook) {
            $output[] = array('name' => $hook, 'id' => $hook);
        }
        $this->fields_form[1]['form'] = array('legend' => array('title' => $this->l('Widget Form.')), 'input' => array(array('type' => 'select', 'label' => $this->l('Select A Module'), 'name' => 'loadmodule', 'options' => array('query' => $modules, 'id' => 'name', 'name' => 'name'), 'default' => '1', 'desc' => $this->l('Select A Module is used as widget. the hook of this module was unhooked.')), array('type' => 'select', 'label' => $this->l('Select A Hook'), 'name' => 'hookmodule', 'options' => array('query' => $output, 'id' => 'name', 'name' => 'name'), 'default' => '1', 'desc' => $this->l('Select A hook is used to render module\'s content. the hook of this module was unhooked. 
						You could not rollback it\'s position. So you need asign it in position management of prestashop.'))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
        $default_lang = (int) Configuration::get('PS_LANG_DEFAULT');
        $a = $this->getConfigFieldsValues($data);
        $helper->tpl_vars = array('fields_value' => $a, 'languages' => Context::getContext()->controller->getLanguages(), 'id_language' => $default_lang);
        return $helper->generateForm($this->fields_form);
    }
Example #3
0
    private function ModuleHookExec($moduleName, $hook_name)
    {
        $output = '';
        $moduleInstance = Module::getInstanceByName($moduleName);
        if (Validate::isLoadedObject($moduleInstance) && $moduleInstance->id) {
            $altern = 0;
            $id_hook = Hook::getIdByName($hook_name);
            $retro_hook_name = Hook::getRetroHookName($hook_name);
            $disable_non_native_modules = (bool) Configuration::get('PS_DISABLE_NON_NATIVE_MODULE');
            if ($disable_non_native_modules && Hook::$native_module && count(Hook::$native_module) && !in_array($moduleInstance->name, self::$native_module)) {
                return '';
            }
            //check disable module
            $device = (int) $this->context->getDevice();
            if (Db::getInstance()->getValue('
			SELECT COUNT(`id_module`) FROM ' . _DB_PREFIX_ . 'module_shop
			WHERE enable_device & ' . (int) $device . ' AND id_module=' . (int) $moduleInstance->id . Shop::addSqlRestriction()) == 0) {
                return '';
            }
            // Check permissions
            $exceptions = $moduleInstance->getExceptions($id_hook);
            $controller = Dispatcher::getInstance()->getController();
            $controller_obj = Context::getContext()->controller;
            //check if current controller is a module controller
            if (isset($controller_obj->module) && Validate::isLoadedObject($controller_obj->module)) {
                $controller = 'module-' . $controller_obj->module->name . '-' . $controller;
            }
            if (in_array($controller, $exceptions)) {
                return '';
            }
            //retro compat of controller names
            $matching_name = array('authentication' => 'auth', 'productscomparison' => 'compare');
            if (isset($matching_name[$controller]) && in_array($matching_name[$controller], $exceptions)) {
                return '';
            }
            if (Validate::isLoadedObject($this->context->employee) && !$moduleInstance->getPermission('view', $this->context->employee)) {
                return '';
            }
            if (!isset($hook_args['cookie']) or !$hook_args['cookie']) {
                $hook_args['cookie'] = $this->context->cookie;
            }
            if (!isset($hook_args['cart']) or !$hook_args['cart']) {
                $hook_args['cart'] = $this->context->cart;
            }
            $hook_callable = is_callable(array($moduleInstance, 'hook' . $hook_name));
            $hook_retro_callable = is_callable(array($moduleInstance, 'hook' . $retro_hook_name));
            if (($hook_callable || $hook_retro_callable) && Module::preCall($moduleInstance->name)) {
                $hook_args['altern'] = ++$altern;
                // Call hook method
                if ($hook_callable) {
                    $display = $moduleInstance->{'hook' . $hook_name}($hook_args);
                } elseif ($hook_retro_callable) {
                    $display = $moduleInstance->{'hook' . $retro_hook_name}($hook_args);
                }
                $output .= $display;
            }
        }
        return $output;
    }
function upgrade_module_2_5_8($module)
{
    $hook_to_remove_id = Hook::getIdByName('advancedPaymentApi');
    if ($hook_to_remove_id) {
        $module->unregisterHook((int) $hook_to_remove_id);
    }
    return true;
}
Example #5
0
 public function install()
 {
     self::$obj_ts_common->install();
     $return = parent::install() && $this->registerHook('displayBackOfficeHeader') && $this->registerHook('orderConfirmation') && $this->registerHook('newOrder') && $this->registerHook('actionOrderStatusPostUpdate') && $this->registerHook('Footer') && $this->registerHook('paymentTop') && $this->registerHook('orderConfirmation');
     $id_hook = _PS_VERSION_ < '1.5' ? Hook::get('payment') : Hook::getIdByName('payment');
     $this->updatePosition($id_hook, 0, 1);
     return $return;
 }
function upgrade_module_1_1($module)
{
    $hook_to_remove_id = Hook::getIdByName('displayAfterBodyOpeningTag');
    if ($hook_to_remove_id) {
        $module->unregisterHook((int) $hook_to_remove_id);
    }
    return Configuration::deleteByName('NW_CONFIRMATION_OPTIN');
}
function upgrade_module_3_0_0($module)
{
    $result = true;
    $hook_to_remove_ids = [Hook::getIdByName('displayPaymentEU'), Hook::getIdByName('payment')];
    foreach ($hook_to_remove_ids as $hook_to_remove_id) {
        $result &= $module->unregisterHook((int) $hook_to_remove_id);
    }
    $result &= $module->registerHook('paymentOptions');
    return $result;
}
Example #8
0
 public function install()
 {
     $homeHookID = $this->isPrestaShop15x ? $this->isPrestaShop16x ? Hook::getIdByName('displayTopColumn') : Hook::getIdByName('displayHome') : Hook::get('home');
     $headerHookID = $this->isPrestaShop15x ? Hook::getIdByName('displayHeader') : Hook::get('header');
     if (!parent::install() or !$this->registerHook($this->isPrestaShop15x ? 'displayHeader' : 'header') or !$this->registerHook($this->isPrestaShop15x ? 'displayFooterProduct' : 'productFooter') or !$this->registerHook($this->isPrestaShop15x ? 'displayFooter' : 'footer') or !$this->installDB() or !$this->fixCSS() or !$this->registerHook($this->isPrestaShop15x ? $this->isPrestaShop16x ? 'displayTopColumn' : 'displayHome' : 'home') or !$this->updatePosition($homeHookID, 0, 1) or !$this->createImageFolder('magicscroll') or !$this->updatePosition($headerHookID, 0, 1)) {
         return false;
     }
     $this->sendStat('install');
     return true;
 }
function upgrade_module_1_5_1($module)
{
    if (Hook::getIdByName('displayPaymentEu')) {
        return true;
    }
    $new_hook = new Hook();
    $new_hook->name = 'displayPaymentEu';
    $new_hook->title = 'Display EU payment options (helper)';
    $new_hook->description = 'Hook to display payment options';
    $new_hook->position = true;
    $new_hook->live_edit = false;
    return (bool) $new_hook->add() && (bool) $module->registerModulesBackwardCompatHook();
}
 private function checkOwnerHooks()
 {
     $hookspos = array('displayTop', 'displayHeaderRight', 'displaySlideshow', 'topNavigation', 'displayPromoteTop', 'displayRightColumn', 'displayLeftColumn', 'displayHome', 'displayFooter', 'displayBottom', 'displayContentBottom', 'displayFootNav', 'displayFooterTop', 'displayFooterBottom');
     foreach ($hookspos as $hook) {
         if (Hook::getIdByName($hook)) {
         } else {
             $new_hook = new Hook();
             $new_hook->name = pSQL($hook);
             $new_hook->title = pSQL($hook);
             $new_hook->add();
         }
     }
     return true;
 }
 private function _postProcess()
 {
     if (Tools::isSubmit('submitBlockCategories')) {
         $pref = $_POST['pref'];
         $old_values = self::getPreferences();
         $new_values = array_merge(self::$default_values, $pref);
         Configuration::updateValue('PSBLOG_CATEGORIES_CONF', base64_encode(serialize($new_values)));
         if ($new_values['block_categories_position'] != $old_values['block_categories_position']) {
             $old_hook_id = Hook::getIdByName($old_values['block_categories_position']);
             $this->unregisterHook($old_hook_id);
             $this->registerHook($new_values['block_categories_position']);
         }
         $this->_html .= '<div class="conf confirm">' . $this->l('Settings updated') . '</div>';
     }
 }
 /**
  *  Looks for a StockManager in the modules list.
  *
  *  @return StockManagerInterface
  */
 public static function execHookStockManagerFactory()
 {
     $modules_infos = Hook::getModulesFromHook(Hook::getIdByName('stockManager'));
     $stock_manager = false;
     foreach ($modules_infos as $module_infos) {
         $module_instance = Module::getInstanceByName($module_infos['name']);
         if (is_callable(array($module_instance, 'hookStockManager'))) {
             $stock_manager = $module_instance->hookStockManager();
         }
         if ($stock_manager) {
             break;
         }
     }
     return $stock_manager;
 }
 /**
  * Check for a tax manager able to handle this type of address in the module list
  *
  * @param Address $address
  * @param string $type
  *
  * @return TaxManager
  */
 public static function execHookTaxManagerFactory(Address $address, $type)
 {
     $modules_infos = Hook::getModulesFromHook(Hook::getIdByName('taxManager'));
     $tax_manager = false;
     foreach ($modules_infos as $module_infos) {
         $module_instance = Module::getInstanceByName($module_infos['name']);
         if (is_callable(array($module_instance, 'hookTaxManager'))) {
             $tax_manager = $module_instance->hookTaxManager(array('address' => $address, 'params' => $type));
         }
         if ($tax_manager) {
             break;
         }
     }
     return $tax_manager;
 }
Example #14
0
 public function moveRightColumn($position)
 {
     if (_PS_VERSION_ < '1.5') {
         $hookRight = (int) Hook::get('rightColumn');
     } else {
         $hookRight = (int) Hook::getIdByName('rightColumn');
     }
     $moduleInstance = Module::getInstanceByName($this->name);
     if (_PS_VERSION_ < '1.5') {
         $moduleInfo = Hook::getModuleFromHook($hookRight, $moduleInstance->id);
     } else {
         $moduleInfo = Hook::getModulesFromHook($hookRight, $moduleInstance->id);
     }
     if (isset($moduleInfo['position']) && (int) $moduleInfo['position'] > (int) $position || isset($moduleInfo['m.position']) && (int) $moduleInfo['m.position'] > (int) $position) {
         return $moduleInstance->updatePosition($hookRight, 0, (int) $position);
     }
     return $moduleInstance->updatePosition($hookRight, 1, (int) $position);
 }
Example #15
0
 public function remove_hook_by_hookname($handle)
 {
     $fonts = $this->get_all_hooks();
     if (!empty($fonts)) {
         foreach ($fonts as $key => $font) {
             if ($font['hookname'] == $handle) {
                 unset($fonts[$key]);
                 //start unregister hook
                 $mod_obj = Module::getInstanceByName('revsliderprestashop');
                 $id_hook = Hook::getIdByName($handle);
                 $mod_obj->unregisterHook($id_hook);
                 //End unregister hook
                 $do = sdsconfig::setval('sds_rev_hooks', $fonts);
                 return true;
             }
         }
     }
     return __('Hook not found! Wrong Hook given.', REVSLIDER_TEXTDOMAIN);
 }
 public function install()
 {
     $this->clearCache();
     if (!parent::install() || !$this->registerHook('displayHome') || !$this->registerHook('header')) {
         return false;
     }
     $res = $this->createTables();
     if ($res) {
         $this->installSamples();
     }
     $hookspos = array('displayTop', 'displayHeaderRight', 'displaySlideshow', 'topNavigation', 'displayPromoteTop', 'displayRightColumn', 'displayLeftColumn', 'displayHome', 'displayFooter', 'displayBottom', 'displayContentBottom', 'displayFootNav', 'displayFooterTop', 'displayFooterBottom');
     foreach ($hookspos as $hook) {
         if (!Hook::getIdByName($hook)) {
             $new_hook = new Hook();
             $new_hook->name = pSQL($hook);
             $new_hook->title = pSQL($hook);
             $new_hook->add();
         }
     }
     return true;
 }
Example #17
0
function upgrade_module_1_4($object, $install = false)
{
    // First uninstall old override
    try {
        $object->uninstallOldOverrides();
    } catch (Exception $e) {
        $object->add_error(sprintf(Tools::displayError('Unable to uninstall old override: %s'), $e->getMessage()));
        //$this->uninstallOverrides(); remove this line because if module a install an override, then module b install same override, this line will remove override of module a (if you find a bug related to this line please don't forget what i say before)
        return false;
    }
    // Install overrides
    try {
        $object->installOverrides();
    } catch (Exception $e) {
        $object->add_error(sprintf(Tools::displayError('Unable to install override: %s'), $e->getMessage()));
        //$this->uninstallOverrides(); remove this line because if module a install an override, then module b install same override, this line will remove override of module a (if you find a bug related to this line please don't forget what i say before)
        return false;
    }
    if (!Hook::getIdByName('actionBeforeAddOrder')) {
        $hook = new Hook();
        $hook->name = 'actionBeforeAddOrder';
        $hook->title = 'New orders before order is added';
        $hook->description = 'Custom hook for PaymentModule ValidateOrder function';
        $hook->position = true;
        $hook->live_edit = false;
        $hook->add();
    }
    $id_new_hook = Hook::getIdByName('actionBeforeAddOrder');
    $id_old_hook = Hook::getIdByName('actionValidateOrder');
    $mod_new_hook = Hook::getModulesFromHook($id_new_hook, $object->id);
    $mod_old_hook = Hook::getModulesFromHook($id_old_hook, $object->id);
    if (empty($mod_new_hook)) {
        $object->registerHook('actionBeforeAddOrder');
    }
    if (!empty($mod_old_hook)) {
        $object->unregisterHook('actionValidateOrder');
    }
    return true;
}
Example #18
0
 public function install()
 {
     if (!parent::install() || !$this->registerHook('displayHeader') || !$this->registerHook('displayFooter')) {
         return false;
     }
     $langs = Language::getLanguages(false);
     $des = array();
     foreach ($langs as $lang) {
         $des[$lang['id_lang']] = '';
     }
     Configuration::updateValue($this->getConfigName('height'), 500);
     Configuration::updateValue($this->getConfigName('description'), $des, true);
     $hookspos = array('displayTop', 'displayHeaderRight', 'displaySlideshow', 'topNavigation', 'displayPromoteTop', 'displayRightColumn', 'displayLeftColumn', 'displayHome', 'displayFooter', 'displayBottom', 'displayContentBottom', 'displayFootNav', 'displayFooterTop', 'displayMapLocal', 'displayFooterBottom');
     foreach ($hookspos as $hook) {
         if (!Hook::getIdByName($hook)) {
             $new_hook = new Hook();
             $new_hook->name = pSQL($hook);
             $new_hook->title = pSQL($hook);
             $new_hook->add();
         }
     }
     return true;
 }
Example #19
0
 public function processThemeInstall()
 {
     if (Shop::isFeatureActive() && !Tools::getIsset('checkBoxShopAsso_theme')) {
         $this->errors[] = $this->l('You must choose at least one shop.');
         $this->display = 'ChooseThemeModule';
         return;
     }
     $theme = new Theme((int) Tools::getValue('id_theme'));
     $shops = array(Configuration::get('PS_SHOP_DEFAULT'));
     if (Tools::isSubmit('checkBoxShopAsso_theme')) {
         $shops = Tools::getValue('checkBoxShopAsso_theme');
     }
     $xml = false;
     if (file_exists(_PS_ROOT_DIR_ . '/config/xml/themes/' . $theme->directory . '.xml')) {
         $xml = simplexml_load_file(_PS_ROOT_DIR_ . '/config/xml/themes/' . $theme->directory . '.xml');
     } elseif (file_exists(_PS_ROOT_DIR_ . '/config/xml/themes/default.xml')) {
         $xml = simplexml_load_file(_PS_ROOT_DIR_ . '/config/xml/themes/default.xml');
     }
     if ($xml) {
         $module_hook = array();
         foreach ($xml->modules->hooks->hook as $row) {
             $name = strval($row['module']);
             $exceptions = isset($row['exceptions']) ? explode(',', strval($row['exceptions'])) : array();
             if (Hook::getIdByName(strval($row['hook']))) {
                 $module_hook[$name]['hook'][] = array('hook' => strval($row['hook']), 'position' => strval($row['position']), 'exceptions' => $exceptions);
             }
         }
         $this->img_error = $this->updateImages($xml);
         $this->modules_errors = array();
         foreach ($shops as $id_shop) {
             foreach ($_POST as $key => $value) {
                 if (strncmp($key, 'to_install', strlen('to_install')) == 0) {
                     $module = Module::getInstanceByName($value);
                     if ($module) {
                         $is_installed_success = true;
                         if (!Module::isInstalled($module->name)) {
                             $is_installed_success = $module->install();
                         }
                         if ($is_installed_success) {
                             if (!Module::isEnabled($module->name)) {
                                 $module->enable();
                             }
                             if ((int) $module->id > 0 && isset($module_hook[$module->name])) {
                                 $this->hookModule($module->id, $module_hook[$module->name], $id_shop);
                             }
                         } else {
                             $this->modules_errors[] = array('module_name' => $module->name, 'errors' => $module->getErrors());
                         }
                         unset($module_hook[$module->name]);
                     }
                 } else {
                     if (strncmp($key, 'to_enable', strlen('to_enable')) == 0) {
                         $module = Module::getInstanceByName($value);
                         if ($module) {
                             $is_installed_success = true;
                             if (!Module::isInstalled($module->name)) {
                                 $is_installed_success = $module->install();
                             }
                             if ($is_installed_success) {
                                 if (!Module::isEnabled($module->name)) {
                                     $module->enable();
                                 }
                                 if ((int) $module->id > 0 && isset($module_hook[$module->name])) {
                                     $this->hookModule($module->id, $module_hook[$module->name], $id_shop);
                                 }
                             } else {
                                 $this->modules_errors[] = array('module_name' => $module->name, 'errors' => $module->getErrors());
                             }
                             unset($module_hook[$module->name]);
                         }
                     } else {
                         if (strncmp($key, 'to_disable', strlen('to_disable')) == 0) {
                             $key_exploded = explode('_', $key);
                             $id_shop_module = (int) substr($key_exploded[2], 4);
                             if ((int) $id_shop_module > 0 && $id_shop_module != (int) $id_shop) {
                                 continue;
                             }
                             $module_obj = Module::getInstanceByName($value);
                             if (Validate::isLoadedObject($module_obj)) {
                                 if (Module::isEnabled($module_obj->name)) {
                                     $module_obj->disable();
                                 }
                                 unset($module_hook[$module_obj->name]);
                             }
                         }
                     }
                 }
             }
             $shop = new Shop((int) $id_shop);
             $shop->id_theme = (int) Tools::getValue('id_theme');
             $this->context->shop->id_theme = $shop->id_theme;
             $this->context->shop->update();
             $shop->save();
             if (Shop::isFeatureActive()) {
                 Configuration::updateValue('PS_PRODUCTS_PER_PAGE', (int) $theme->product_per_page, false, null, (int) $id_shop);
             } else {
                 Configuration::updateValue('PS_PRODUCTS_PER_PAGE', (int) $theme->product_per_page);
             }
         }
         $this->doc = array();
         foreach ($xml->docs->doc as $row) {
             $this->doc[strval($row['name'])] = __PS_BASE_URI__ . 'themes/' . $theme->directory . '/docs/' . basename(strval($row['path']));
         }
     }
     Tools::clearCache($this->context->smarty);
     $this->theme_name = $theme->name;
     $this->display = 'view';
 }
Example #20
0
 public function uninstall()
 {
     //Delete configuration
     return parent::uninstall() and $this->unregisterHook(Hook::getIdByName('extraLeft'));
 }
Example #21
0
 /**
  * hook footer to load JS script for standards actions such as product clicks
  */
 public function hookFooter()
 {
     $ga_scripts = '';
     $this->js_state = 0;
     if (isset($this->context->cookie->ga_cart)) {
         $this->filterable = 0;
         $gacarts = unserialize($this->context->cookie->ga_cart);
         foreach ($gacarts as $gacart) {
             if ($gacart['quantity'] > 0) {
                 $ga_scripts .= 'MBG.addToCart(' . Tools::jsonEncode($gacart) . ');';
             } elseif ($gacart['quantity'] < 0) {
                 $gacart['quantity'] = abs($gacart['quantity']);
                 $ga_scripts .= 'MBG.removeFromCart(' . Tools::jsonEncode($gacart) . ');';
             }
         }
         unset($this->context->cookie->ga_cart);
     }
     $controller_name = Tools::getValue('controller');
     $products = $this->wrapProducts($this->context->smarty->getTemplateVars('products'), array(), true);
     if ($controller_name == 'order' || $controller_name == 'orderopc') {
         $this->eligible = 1;
         $step = Tools::getValue('step');
         if (empty($step)) {
             $step = 0;
         }
         $ga_scripts .= $this->addProductFromCheckout($products, $step);
         $ga_scripts .= 'MBG.addCheckout(\'' . (int) $step . '\');';
     }
     if (version_compare(_PS_VERSION_, '1.5', '<')) {
         if ($controller_name == 'orderconfirmation') {
             $this->eligible = 1;
         }
     } else {
         $confirmation_hook_id = (int) Hook::getIdByName('orderConfirmation');
         if (isset(Hook::$executed_hooks[$confirmation_hook_id])) {
             $this->eligible = 1;
         }
     }
     if (isset($products) && count($products) && $controller_name != 'index') {
         if ($this->eligible == 0) {
             $ga_scripts .= $this->addProductImpression($products);
         }
         $ga_scripts .= $this->addProductClick($products);
     }
     return $this->_runJs($ga_scripts);
 }
Example #22
0
function upgrade_module_1_5($object, $install = false)
{
    // Install overrides
    try {
        $object->installOverrides();
    } catch (Exception $e) {
        Tools::displayError(sprintf(Tools::displayError('Unable to install override: %s'), $e->getMessage()));
        //$this->uninstallOverrides(); remove this line because if module a install an override, then module b install same override, this line will remove override of module a (if you find a bug related to this line please don't forget what i say before)
        return false;
    }
    $classindex = realpath(dirname(__FILE__) . '/../..') . '/cache/class_index.php';
    unset($classindex);
    if (version_compare(_PS_VERSION_, '1.6', '>=')) {
        PrestashopAutoload::getInstance()->generateIndex();
    } else {
        Autoload::getInstance()->generateIndex();
    }
    if (!Hook::getIdByName('actionBeforeAddOrder')) {
        $hook = new Hook();
        $hook->name = 'actionBeforeAddOrder';
        $hook->title = 'Execute actions before order is added to database';
        $hook->description = 'Custom hook for Order Add function';
        $hook->position = true;
        $hook->live_edit = false;
        $hook->add();
    }
    if (!Hook::getIdByName('actionBeforeAddOrderInvoice')) {
        $hook2 = new Hook();
        $hook2->name = 'actionBeforeAddOrderInvoice';
        $hook2->title = 'Execute actions before invoice is added to database';
        $hook2->description = 'Custom hook for Order setLastInvoiceNumber function';
        $hook2->position = true;
        $hook2->live_edit = false;
        $hook2->add();
    }
    if (!Hook::getIdByName('actionBeforeAddDeliveryNumber')) {
        $hook3 = new Hook();
        $hook3->name = 'actionBeforeAddDeliveryNumber';
        $hook3->title = 'Execute actions before delivery number is added to database';
        $hook3->description = 'Custom hook for Order setDeliveryNumber function';
        $hook3->position = true;
        $hook3->live_edit = false;
        $hook3->add();
    }
    $id_new_hook = Hook::getIdByName('actionBeforeAddOrder');
    $id_new_hook2 = Hook::getIdByName('actionBeforeAddOrderInvoice');
    $id_new_hook3 = Hook::getIdByName('actionBeforeAddDeliveryNumber');
    $id_old_hook = Hook::getIdByName('actionValidateOrder');
    $mod_new_hook = Hook::getModulesFromHook($id_new_hook, $object->id);
    $mod_new_hook2 = Hook::getModulesFromHook($id_new_hook2, $object->id);
    $mod_new_hook3 = Hook::getModulesFromHook($id_new_hook3, $object->id);
    $mod_old_hook = Hook::getModulesFromHook($id_old_hook, $object->id);
    if (empty($mod_new_hook)) {
        $object->registerHook('actionBeforeAddOrder');
    }
    if (empty($mod_new_hook2)) {
        $object->registerHook('actionBeforeAddOrderInvoice');
    }
    if (empty($mod_new_hook3)) {
        $object->registerHook('actionBeforeAddDeliveryNumber');
    }
    if (!empty($mod_old_hook)) {
        $object->unregisterHook('actionValidateOrder');
    }
    return true;
}
 /**
  * Install Hooks using for framework
  */
 private function _installHook()
 {
     $hookspos = LeoFrameworkHelper::getHookPositions();
     foreach ($hookspos as $hook) {
         if (Hook::getIdByName($hook)) {
         } else {
             $new_hook = new Hook();
             $new_hook->name = pSQL($hook);
             $new_hook->title = pSQL($hook);
             $new_hook->live_edit = 1;
             $new_hook->position = 1;
             $new_hook->add();
             $id_hook = $new_hook->id;
         }
     }
     return true;
 }
Example #24
0
 private function _postProcess()
 {
     if (Tools::isSubmit('submitPsblog')) {
         $pref = $_POST['pref'];
         $old_values = self::getPreferences();
         $checkboxes = array('category_active', 'product_active', 'comment_active', 'comment_moderate', 'comment_guest', 'list_display_date', 'view_display_date', 'related_active', 'view_display_popin', 'rewrite_active', 'product_page_related', 'rss_active', 'share_active');
         foreach ($checkboxes as $input) {
             if (!isset($pref[$input])) {
                 $pref[$input] = 0;
             }
         }
         $new_values = array_merge(self::$default_values, $pref);
         Configuration::updateValue('PSBLOG_CONF', base64_encode(serialize($new_values)));
         if ($new_values['product_page_related'] != $old_values['product_page_related']) {
             if ($new_values['product_page_related'] == 1) {
                 $this->registerHook('productTab');
                 $this->registerHook('productTabContent');
             } else {
                 $this->unregisterHook(Hook::getIdByName('productTab'));
                 $this->unregisterHook(Hook::getIdByName('productTabContent'));
             }
         }
         $this->_html .= '<div class="conf confirm">' . $this->l('Settings updated') . '</div>';
     } elseif (Tools::isSubmit('submitGenerateImg')) {
         include_once _PS_MODULE_DIR_ . "psblog/classes/BlogPost.php";
         $images = BlogPost::getAllImages();
         $save_path = _PS_ROOT_DIR_ . '/' . rtrim(self::$pref['img_save_path'], '/') . "/";
         foreach ($images as $img) {
             @unlink($save_path . 'thumb/' . $img['img_name']);
             @unlink($save_path . 'list/' . $img['img_name']);
             BlogPost::generateImageThumbs($img['id_blog_image']);
         }
         $this->_html .= '<div class="conf confirm">' . $this->l('Images regenerated') . '</div>';
     } elseif (Tools::isSubmit('submitGenerateSitemap')) {
         include_once _PS_MODULE_DIR_ . "psblog/classes/BlogShop.php";
         BlogShop::generateSitemap();
         $this->_html .= '<div class="conf confirm">' . $this->l('Google sitemap regenerated') . '</div>';
     }
 }
Example #25
0
 public function hooks($hookName, $param)
 {
     $langId = Context::getContext()->language->id;
     $shopId = Context::getContext()->shop->id;
     $hookName = str_replace('hook', '', $hookName);
     $hookId = (int) Hook::getIdByName($hookName);
     if ($hookId <= 0) {
         return '';
     }
     $this->context->smarty->assign('hookname', $hookName);
     $page_name = Dispatcher::getInstance()->getController();
     $page_name = preg_match('/^[0-9]/', $page_name) ? 'page_' . $page_name : $page_name;
     $cacheKey = 'flexbanner|' . $langId . '|' . $hookId . '|' . $page_name;
     if (!$this->isCached('flexbanner.tpl', Tools::encrypt($cacheKey))) {
         $items = DB::getInstance()->executeS("Select DISTINCT b.*, bl.`image`, bl.alt, bl.link, bl.description \n\t\t\tFrom " . _DB_PREFIX_ . "flexbanner_banner AS b \n\t\t\tINNER JOIN " . _DB_PREFIX_ . "flexbanner_banner_lang AS bl \n\t\t\t\tOn b.id = bl.banner_id \n\t\t\tWhere \n\t\t\t\tb.`position_name` = '" . $hookName . "' \n\t\t\t\tAND b.status = 1 \n\t\t\t\tAND b.id_shop = " . $shopId . " \n\t\t\t\tAND bl.id_lang = " . $langId . " \n\t\t\tOrder \n\t\t\t\tBy ordering");
         if ($items) {
             foreach ($items as &$item) {
                 $item['image'] = $this->getBannerSrc($item['image'], true);
                 $item['html'] = $this->frontBuildBanner($item, $cacheKey . '|' . $item['id']);
             }
         }
         $this->context->smarty->assign('flexbanner_contents', $items);
     } else {
         return '';
     }
     return $this->display(__FILE__, 'flexbanner.tpl', Tools::encrypt($cacheKey));
 }
Example #26
0
 private function changeHeaderPosition()
 {
     $id_shop = (int) $this->context->shop->id;
     $id_hook_header = Hook::getIdByName('Header');
     $sql = "SELECT MAX(`position`) FROM `" . _DB_PREFIX_ . "hook_module` WHERE id_shop = " . (int) $id_shop . " AND id_hook =" . (int) $id_hook_header;
     $max_pos = Db::getInstance()->getValue($sql);
     $sql = 'UPDATE `' . _DB_PREFIX_ . 'hook_module` SET position=' . ($max_pos + 1) . ' WHERE id_module = ' . (int) $this->id . ' AND id_shop = ' . (int) $id_shop . ' AND id_hook =' . (int) $id_hook_header;
     Db::getInstance()->execute($sql);
 }
Example #27
0
 public function hookPaymentTop()
 {
     if (!$this->getMethodIdByCarrierId((int) $this->context->cart->id_carrier)) {
         //Check if DPD carrier is chosen
         return null;
     }
     if (Configuration::get('PS_ALLOW_MULTISHIPPING')) {
         return null;
     }
     if ($this->ps_14) {
         $this->disablePaymentMethods();
         return null;
     }
     if (!Validate::isLoadedObject($this->context->cart) || !$this->context->cart->id_carrier) {
         return null;
     }
     $is_cod_carrier = $this->isCODCarrier((int) $this->context->cart->id_carrier);
     $cod_payment_method = Configuration::get(DpdGroupConfiguration::COD_MODULE);
     $cache_id = 'exceptionsCache';
     $exceptions_cache = Cache::isStored($cache_id) ? Cache::retrieve($cache_id) : array();
     // existing cache
     $controller = Configuration::get('PS_ORDER_PROCESS_TYPE') == 0 ? 'order' : 'orderopc';
     $id_hook = Hook::getIdByName('displayPayment');
     // ID of hook we are going to manipulate
     if ($payment_modules = self::getPaymentModules()) {
         foreach ($payment_modules as $module) {
             if ($module['name'] == $cod_payment_method && !$is_cod_carrier || $module['name'] != $cod_payment_method && $is_cod_carrier) {
                 $module_instance = Module::getInstanceByName($module['name']);
                 if (Validate::isLoadedObject($module_instance)) {
                     $key = (int) $id_hook . '-' . (int) $module_instance->id;
                     $exceptions_cache[$key][$this->context->shop->id][] = $controller;
                 }
             }
         }
         Cache::store($cache_id, $exceptions_cache);
     }
 }
Example #28
0
 private function hookModule($id_module, $module_hooks, $shop)
 {
     Db::getInstance()->execute('INSERT IGNORE INTO ' . _DB_PREFIX_ . 'module_shop (id_module, id_shop) VALUES(' . (int) $id_module . ', ' . (int) $shop . ')');
     Db::getInstance()->execute($sql = 'DELETE FROM `' . _DB_PREFIX_ . 'hook_module` WHERE `id_module` = ' . pSQL($id_module) . ' AND id_shop = ' . (int) $shop);
     foreach ($module_hooks as $hook) {
         $sql_hook_module = 'INSERT INTO `' . _DB_PREFIX_ . 'hook_module` (`id_module`, `id_shop`, `id_hook`, `position`)
                                                     VALUES (' . (int) $id_module . ', ' . (int) $shop . ', ' . (int) Hook::getIdByName($hook['hook']) . ', ' . (int) $hook['position'] . ')';
         if (count($hook['exceptions']) > 0) {
             foreach ($hook['exceptions'] as $exception) {
                 $sql_hook_module_except = 'INSERT INTO `' . _DB_PREFIX_ . 'hook_module_exceptions` (`id_module`, `id_hook`, `file_name`) VALUES (' . (int) $id_module . ', ' . (int) Hook::getIdByName($hook['hook']) . ', "' . pSQL($exception) . '")';
                 Db::getInstance()->execute($sql_hook_module_except);
             }
         }
         Db::getInstance()->execute($sql_hook_module);
     }
 }
Example #29
0
 public function autoregisterhook($hook_name = 'moduleRoutes', $module_name = 'smartblog', $shop_list = null)
 {
     if (Module::isEnabled($module_name) == 1 && Module::isInstalled($module_name) == 1) {
         $return = true;
         $id_sql = 'SELECT `id_module` FROM `' . _DB_PREFIX_ . 'module` WHERE `name` = "' . $module_name . '"';
         $id_module = Db::getInstance()->getValue($id_sql);
         if (is_array($hook_name)) {
             $hook_names = $hook_name;
         } else {
             $hook_names = array($hook_name);
         }
         foreach ($hook_names as $hook_name) {
             if (!Validate::isHookName($hook_name)) {
                 throw new PrestaShopException('Invalid hook name');
             }
             if (!isset($id_module) || !is_numeric($id_module)) {
                 return false;
             }
             //$hook_name_bak = $hook_name;
             if ($alias = Hook::getRetroHookName($hook_name)) {
                 $hook_name = $alias;
             }
             $id_hook = Hook::getIdByName($hook_name);
             //$live_edit = Hook::getLiveEditById((int) Hook::getIdByName($hook_name_bak));
             if (!$id_hook) {
                 $new_hook = new Hook();
                 $new_hook->name = pSQL($hook_name);
                 $new_hook->title = pSQL($hook_name);
                 $new_hook->live_edit = (bool) preg_match('/^display/i', $new_hook->name);
                 $new_hook->position = (bool) $new_hook->live_edit;
                 $new_hook->add();
                 $id_hook = $new_hook->id;
                 if (!$id_hook) {
                     return false;
                 }
             }
             if (is_null($shop_list)) {
                 $shop_list = Shop::getShops(true, null, true);
             }
             foreach ($shop_list as $shop_id) {
                 $sql = 'SELECT hm.`id_module`
                     FROM `' . _DB_PREFIX_ . 'hook_module` hm, `' . _DB_PREFIX_ . 'hook` h
                     WHERE hm.`id_module` = ' . (int) $id_module . ' AND h.`id_hook` = ' . $id_hook . '
                     AND h.`id_hook` = hm.`id_hook` AND `id_shop` = ' . (int) $shop_id;
                 if (Db::getInstance()->getRow($sql)) {
                     continue;
                 }
                 $sql = 'SELECT MAX(`position`) AS position
                     FROM `' . _DB_PREFIX_ . 'hook_module`
                     WHERE `id_hook` = ' . (int) $id_hook . ' AND `id_shop` = ' . (int) $shop_id;
                 if (!($position = Db::getInstance()->getValue($sql))) {
                     $position = 0;
                 }
                 $return &= Db::getInstance()->insert('hook_module', array('id_module' => (int) $id_module, 'id_hook' => (int) $id_hook, 'id_shop' => (int) $shop_id, 'position' => (int) ($position + 1)));
             }
         }
         return $return;
     } else {
         return false;
     }
 }
Example #30
0
    private function displayForm4()
    {
        $xml = simplexml_load_file(_IMPORT_FOLDER_ . XMLFILENAME);
        $this->xml = $xml;
        self::getModules();
        $hook = array();
        $hooked_module = array();
        $position = array();
        $msg = '';
        foreach ($this->xml->modules->hooks->hook as $row) {
            $hooked_module[] = strval($row['module']);
            $hook[] = strval($row['hook']);
            $position[] = strval($row['position']);
            $exceptions[] = isset($row['exceptions']) ? explode(',', strval($row['exceptions'])) : array();
        }
        if (file_exists(_IMPORT_FOLDER_ . 'doc') && count($xml->docs->doc) != 0) {
            self::loadDocForm();
        }
        // install selected modules
        $flag = 0;
        foreach ($this->selected_shops as $id_shop) {
            if (isset($this->to_export) && $this->to_export) {
                foreach ($this->to_export as $row) {
                    if (in_array($row, $this->native_modules)) {
                        continue;
                    }
                    if ($flag++ == 0) {
                        $msg .= '<b>' . $this->l('The following modules have been installed:') . '</b><br />';
                    }
                    // We copy module only if it does not already exists
                    if (!file_exists(_PS_ROOT_DIR_ . '/modules/' . $row)) {
                        self::recurseCopy(_IMPORT_FOLDER_ . 'modules/' . $row, _PS_ROOT_DIR_ . '/modules/' . $row);
                    }
                    $obj = Module::getInstanceByName($row);
                    if (Validate::isLoadedObject($obj)) {
                        Db::getInstance()->execute('
							UPDATE `' . _DB_PREFIX_ . 'module`
							SET `active`= 1
							WHERE `name` = \'' . pSQL($row) . '\'
						');
                    } else {
                        if (!$obj || !$obj->install()) {
                            continue;
                        }
                    }
                    if (_PS_VERSION_ < '1.5') {
                        $sql = 'DELETE FROM `' . _DB_PREFIX_ . 'hook_module` WHERE `id_module` = ' . pSQL($obj->id);
                    } else {
                        Db::getInstance()->execute('INSERT IGNORE INTO ' . _DB_PREFIX_ . 'module_shop (id_module, id_shop) VALUES(' . (int) $obj->id . ', ' . (int) $id_shop . ')');
                        $sql = 'DELETE FROM `' . _DB_PREFIX_ . 'hook_module` WHERE `id_module` = ' . pSQL($obj->id) . ' AND id_shop = ' . (int) $id_shop;
                    }
                    if (Db::getInstance()->execute($sql)) {
                        $msg .= '<i>- ' . pSQL($row) . '</i><br />';
                    } else {
                        $msg .= '<i>- ' . pSQL($row) . ' - ERROR</i><br />';
                    }
                    $count = -1;
                    while (isset($hooked_module[++$count])) {
                        if ($hooked_module[$count] == $row) {
                            if (_PS_VERSION_ < '1.5') {
                                $sql_hook_module = 'INSERT INTO `' . _DB_PREFIX_ . 'hook_module` (`id_module`, `id_hook`, `position`)
									VALUES (' . (int) $obj->id . ', ' . (int) Hook::get($hook[$count]) . ', ' . (int) $position[$count] . ')';
                            } else {
                                $sql_hook_module = 'INSERT INTO `' . _DB_PREFIX_ . 'hook_module` (`id_module`, `id_shop`, `id_hook`, `position`)
									VALUES (' . (int) $obj->id . ', ' . (int) $id_shop . ', ' . (int) Hook::getIdByName($hook[$count]) . ', ' . (int) $position[$count] . ')';
                            }
                            Db::getInstance()->execute($sql_hook_module);
                            if ($exceptions[$count]) {
                                foreach ($exceptions[$count] as $file_name) {
                                    if (_PS_VERSION_ < '1.5') {
                                        $sql_hook_module_except = 'INSERT INTO `' . _DB_PREFIX_ . 'hook_module_exceptions` (`id_module`, `id_hook`, `file_name`)
											VALUES (' . (int) $obj->id . ', ' . (int) Hook::get($hook[$count]) . ', "' . pSQL($file_name) . '")';
                                    } else {
                                        $sql_hook_module_except = 'INSERT INTO `' . _DB_PREFIX_ . 'hook_module_exceptions` (`id_module`, `id_hook`, `file_name`)
											VALUES (' . (int) $obj->id . ', ' . (int) Hook::getIdByName($hook[$count]) . ', "' . pSQL($file_name) . '")';
                                    }
                                    Db::getInstance()->execute($sql_hook_module_except);
                                }
                            }
                        }
                    }
                }
            }
            if (($val = (int) Tools::getValue('nativeModules')) != 1) {
                $flag = 0;
                // Disable native modules
                if ($val == 2 && ($this->to_disable && count($this->to_disable) || $this->selected_disable_modules && count($this->selected_disable_modules)) && _PS_VERSION_ > '1.5') {
                    foreach (array_merge($this->to_disable, $this->selected_disable_modules) as $row) {
                        $obj = Module::getInstanceByName($row);
                        if (Validate::isLoadedObject($obj)) {
                            if ($flag++ == 0) {
                                $msg .= '<b>' . $this->l('The following modules have been disabled:') . '</b><br />';
                            }
                            // Delete all native module which are in the front office feature category and in selected shops
                            if (_PS_VERSION_ < '1.5') {
                                $sql = 'DELETE FROM `' . _DB_PREFIX_ . 'hook_module` WHERE `id_module` = ' . pSQL($obj->id) . ' AND `id_shop` = ' . (int) $id_shop;
                                if (Db::getInstance()->execute($sql)) {
                                    $msg .= '<i>- ' . pSQL($row) . '</i><br />';
                                }
                            } else {
                                $sql = 'DELETE FROM `' . _DB_PREFIX_ . 'module_shop` WHERE `id_module` = ' . pSQL($obj->id) . ' AND `id_shop` = ' . (int) $id_shop;
                                $sql1 = 'DELETE FROM `' . _DB_PREFIX_ . 'hook_module` WHERE `id_module` = ' . pSQL($obj->id) . ' AND `id_shop` = ' . (int) $id_shop;
                                if (Db::getInstance()->execute($sql) && Db::getInstance()->execute($sql1)) {
                                    $msg .= '<i>- ' . pSQL($row) . '</i><br />';
                                }
                            }
                        }
                    }
                }
                $flag = 0;
                if ($this->to_enable && count($this->to_enable)) {
                    foreach ($this->to_enable as $row) {
                        $obj = Module::getInstanceByName($row);
                        if (Validate::isLoadedObject($obj)) {
                            if (_PS_VERSION_ < '1.5') {
                                Db::getInstance()->execute('
									UPDATE `' . _DB_PREFIX_ . 'module`
									SET `active`= 1
									WHERE `name` = \'' . pSQL($row) . '\'');
                            } else {
                                Db::getInstance()->execute('
									UPDATE `' . _DB_PREFIX_ . 'module`
									SET `active`= 1
									WHERE `name` = \'' . pSQL($row) . '\'');
                                Db::getInstance()->execute('
									INSERT IGNORE INTO ' . _DB_PREFIX_ . 'module_shop (id_module, id_shop)
									VALUES(' . (int) $obj->id . ', ' . (int) $id_shop . ')
								');
                            }
                        } else {
                            if (!is_object($obj) || !$obj->install()) {
                                continue;
                            }
                        }
                        if ($flag++ == 0) {
                            $msg .= '<b>' . $this->l('The following modules have been enabled:') . '</b><br />';
                        }
                        if (_PS_VERSION_ < '1.5') {
                            $sql = 'DELETE FROM `' . _DB_PREFIX_ . 'hook_module` WHERE `id_module` = ' . pSQL($obj->id);
                        } else {
                            $sql = 'DELETE FROM `' . _DB_PREFIX_ . 'hook_module` WHERE `id_module` = ' . pSQL($obj->id) . ' AND id_shop = ' . (int) $id_shop;
                        }
                        if (Db::getInstance()->execute($sql)) {
                            $msg .= '<i>- ' . pSQL($row) . '</i><br />';
                        }
                        $count = -1;
                        while (isset($hooked_module[++$count])) {
                            if ($hooked_module[$count] == $row) {
                                if (_PS_VERSION_ < '1.5') {
                                    Db::getInstance()->execute('
										INSERT IGNORE INTO `' . _DB_PREFIX_ . 'hook_module` (`id_module`, `id_hook`, `position`)
										VALUES (' . (int) $obj->id . ', ' . (int) Hook::get($hook[$count]) . ', ' . (int) $position[$count] . ')
									');
                                } else {
                                    Db::getInstance()->execute('
										INSERT IGNORE INTO `' . _DB_PREFIX_ . 'hook_module` (`id_module`, `id_shop`, `id_hook`, `position`)
										VALUES (' . (int) $obj->id . ', ' . (int) $id_shop . ', ' . (int) Hook::getIdByName($hook[$count]) . ', ' . (int) $position[$count] . ')
									');
                                }
                                foreach ($exceptions[$count] as $filename) {
                                    if (!empty($filename)) {
                                        if (_PS_VERSION_ < '1.5') {
                                            Db::getInstance()->execute('
												INSERT INTO `' . _DB_PREFIX_ . 'hook_module_exceptions` (`id_module`, `id_hook`, `file_name`)
												VALUES (' . (int) $obj->id . ', ' . (int) Hook::get($hook[$count]) . ', "' . pSQL($filename) . '")
											');
                                        } else {
                                            Db::getInstance()->execute('
												INSERT INTO `' . _DB_PREFIX_ . 'hook_module_exceptions` (`id_module`, id_shop, `id_hook`, `file_name`)
												VALUES (' . (int) $obj->id . ', ' . (int) $id_shop . ', ' . (int) Hook::getIdByName($hook[$count]) . ', "' . pSQL($filename) . '")
											');
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (_PS_VERSION_ > '1.5') {
                $theme = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'theme` WHERE `name` LIKE \'' . (string) $this->xml['name'] . '\'');
                $shop = new Shop((int) $id_shop);
                $shop->id_theme = (int) $theme['id_theme'];
                $shop->update();
            }
        }
        // note : theme was previously created at this point.
        // It is now created during displayForm3
        $result = $this->updateImages();
        if (!isset($result['error'])) {
            $msg .= $this->l('Images have been correctly updated in the database.');
        } else {
            $errors = '<em><strong>' . $this->l('Warning: Copy/Paste your errors if you want to manually set the image type (in the "Images" page under the "Preferences" menu):') . '</em></strong><br />';
            $errors .= $this->l('Some types of image could not be added because they already exist. Here\'s the list:');
            $errors .= '<ul>';
            foreach ($result['error'] as $error) {
                $errors .= '<li style="color:#D8000C">' . $this->l('Name image type:') . ' <strong>' . $error['name'] . '</strong> (' . $this->l('Width:') . ' ' . $error['width'] . 'px, ' . $this->l('Height:') . ' ' . $error['height'] . 'px)</li>';
            }
            $errors .= '</ul>';
        }
        if (isset($error)) {
            $this->_msg .= parent::displayError($errors);
        }
        if (!empty($msg)) {
            $this->_msg .= parent::displayConfirmation($msg);
        }
        $this->_html .= '
			<input type="submit" class="button" name="submitThemes" value="' . $this->l('Previous') . '" />
			<input type="submit" class="button" name="Finish" value="' . $this->l('Finish') . '" />
		</form>';
    }