133 lines
3.7 KiB
PHP
133 lines
3.7 KiB
PHP
<?php
|
|
/*
|
|
* 2007-2013 PrestaShop
|
|
*
|
|
* NOTICE OF LICENSE
|
|
*
|
|
* This source file is subject to the Academic Free License (AFL 3.0)
|
|
* that is bundled with this package in the file LICENSE.txt.
|
|
* It is also available through the world-wide-web at this URL:
|
|
* http://opensource.org/licenses/afl-3.0.php
|
|
* If you did not receive a copy of the license and are unable to
|
|
* obtain it through the world-wide-web, please send an email
|
|
* to license@prestashop.com so we can send you a copy immediately.
|
|
*
|
|
* DISCLAIMER
|
|
*
|
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
|
* versions in the future. If you wish to customize PrestaShop for your
|
|
* needs please refer to http://www.prestashop.com for more information.
|
|
*
|
|
* @author PrestaShop SA <contact@prestashop.com>
|
|
* @copyright 2007-2013 PrestaShop SA
|
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
|
* International Registered Trademark & Property of PrestaShop SA
|
|
*/
|
|
|
|
if (!defined('_PS_VERSION_'))
|
|
exit;
|
|
|
|
class Blockquickview extends Module
|
|
{
|
|
public function __construct()
|
|
{
|
|
$this->name = 'blockquickview';
|
|
$this->tab = 'front_office_features';
|
|
$this->version = '1.0';
|
|
parent::__construct();
|
|
$this->displayName = $this->l('Quick view');
|
|
$this->description = $this->l('Add Quick information about product.');
|
|
}
|
|
|
|
public function install()
|
|
{
|
|
Configuration::updateValue('PS_QUICK_VIEW',1);
|
|
if (!parent::install())
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
public function uninstall()
|
|
{
|
|
if (!parent::uninstall() OR
|
|
!Configuration::deleteByName('PS_QUICK_VIEW'))
|
|
return false;
|
|
else return true;
|
|
}
|
|
|
|
|
|
public function getContent()
|
|
{
|
|
$html = '';
|
|
// If we try to update the settings
|
|
if (Tools::isSubmit('submitModule'))
|
|
{
|
|
Configuration::updateValue('PS_QUICK_VIEW', Tools::getValue('PS_QUICK_VIEW'));
|
|
$html .= $this->displayConfirmation($this->l('Configuration updated'));
|
|
}
|
|
$html .= $this->renderForm();
|
|
return $html;
|
|
}
|
|
|
|
public function renderForm()
|
|
{
|
|
$fields_form = array(
|
|
'form' => array(
|
|
'legend' => array(
|
|
'title' => $this->l('Settings'),
|
|
'icon' => 'icon-cogs'
|
|
),
|
|
'input' => array(
|
|
array(
|
|
'type' => 'switch',
|
|
'label' => $this->l('Display Quick view'),
|
|
'name' => 'PS_QUICK_VIEW',
|
|
'values' => array(
|
|
array(
|
|
'id' => 'active_on',
|
|
'value' => 1,
|
|
'label' => $this->l('Enabled')
|
|
),
|
|
array(
|
|
'id' => 'active_off',
|
|
'value' => 0,
|
|
'label' => $this->l('Disabled')
|
|
)
|
|
),
|
|
),
|
|
),
|
|
'submit' => array(
|
|
'title' => $this->l('Save'),
|
|
'class' => 'btn btn-primary')
|
|
),
|
|
);
|
|
|
|
$helper = new HelperForm();
|
|
$helper->show_toolbar = false;
|
|
$helper->table = $this->table;
|
|
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
|
$helper->default_form_language = $lang->id;
|
|
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
|
$this->fields_form = array();
|
|
|
|
$helper->identifier = $this->identifier;
|
|
$helper->submit_action = 'submitModule';
|
|
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
|
|
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
|
$helper->tpl_vars = array(
|
|
'fields_value' => $this->getConfigFieldsValues(),
|
|
'languages' => $this->context->controller->getLanguages(),
|
|
'id_language' => $this->context->language->id
|
|
);
|
|
|
|
return $helper->generateForm(array($fields_form));
|
|
}
|
|
|
|
public function getConfigFieldsValues()
|
|
{
|
|
return array(
|
|
'PS_QUICK_VIEW' => Tools::getValue('PS_QUICK_VIEW', Configuration::get('PS_QUICK_VIEW')),
|
|
);
|
|
|
|
}
|
|
} |