Merge pull request #401 from abhishek-webkul/gli-771

Remove unused modules
This commit is contained in:
Rohit Jain
2022-11-10 17:13:01 +05:30
committed by GitHub
2695 changed files with 161 additions and 102060 deletions

View File

@@ -26,10 +26,6 @@
{extends file="helpers/form/form.tpl"}
{block name="label"}
{if $input.name == 'vat_number'}
<div id="vat_area" style="display: visible">
{/if}
{if $input.type == 'text_customer' && !isset($customer)}
<label class="control-label col-lg-3 required" for="email">{l s='Customer email'}</label>
{else}
@@ -92,7 +88,4 @@
{else}
{$smarty.block.parent}
{/if}
{if $input.name == 'vat_number'}
</div>
{/if}
{/block}

View File

@@ -911,7 +911,6 @@
var module_dir = '{$smarty.const._MODULE_DIR_}';
var id_language = {$defaultFormLanguage|intval};
var languages = new Array();
var vat_number = {if $vat_number}1{else}0{/if};
// Multilang field setup must happen before document is ready so that calls to displayFlags() to avoid
// precedence conflicts with other document.ready() blocks
{foreach $languages as $k => $language}

View File

@@ -243,13 +243,6 @@ class AddressCore extends ObjectModel
public function validateController($htmlentities = true)
{
$errors = parent::validateController($htmlentities);
if (!Configuration::get('VATNUMBER_MANAGEMENT') || !Configuration::get('VATNUMBER_CHECKING')) {
return $errors;
}
include_once(_PS_MODULE_DIR_.'vatnumber/vatnumber.php');
if (class_exists('VatNumber', false)) {
return array_merge($errors, VatNumber::WebServiceCheck($this->vat_number));
}
return $errors;
}
/**

View File

@@ -124,19 +124,6 @@ class DispatcherCore
'tags' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
),
),
/* Must be after the product and category rules in order to avoid conflict */
'layered_rule' => array(
'controller' => 'category',
'rule' => '{id}-{rewrite}{/:selected_filters}',
'keywords' => array(
'id' => array('regexp' => '[0-9]+', 'param' => 'id_category'),
/* Selected filters is used by the module blocklayered */
'selected_filters' => array('regexp' => '.*', 'param' => 'selected_filters'),
'rewrite' => array('regexp' => '[_a-zA-Z0-9\pL\pS-]*'),
'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
),
),
);
/**

View File

@@ -943,7 +943,6 @@ abstract class PaymentModuleCore extends Module
'{delivery_phone}' => ($delivery->phone) ? $delivery->phone : $delivery->phone_mobile,
'{delivery_other}' => $delivery->other,
'{invoice_company}' => $invoice->company,
'{invoice_vat_number}' => $invoice->vat_number,
'{invoice_firstname}' => $invoice->firstname,
'{invoice_lastname}' => $invoice->lastname,
'{invoice_address2}' => $invoice->address2,

View File

@@ -189,7 +189,7 @@ class PrestaShopBackupCore
{
if (!$this->psBackupAll) {
$ignore_insert_table = array(_DB_PREFIX_.'connections', _DB_PREFIX_.'connections_page', _DB_PREFIX_
.'connections_source', _DB_PREFIX_.'guest', _DB_PREFIX_.'statssearch');
.'connections_source', _DB_PREFIX_.'guest');
} else {
$ignore_insert_table = array();
}

View File

@@ -588,13 +588,6 @@ class ProductCore extends ObjectModel
$id_address = (int)$cur_cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
}
$address_infos = Address::getCountryAndState($id_address);
if (self::$_taxCalculationMethod != PS_TAX_EXC
&& !empty($address_infos['vat_number'])
&& $address_infos['id_country'] != Configuration::get('VATNUMBER_COUNTRY')
&& Configuration::get('VATNUMBER_MANAGEMENT')) {
self::$_taxCalculationMethod = PS_TAX_EXC;
}
} else {
self::$_taxCalculationMethod = Group::getPriceDisplayMethod(Group::getCurrent()->id);
}
@@ -2857,13 +2850,6 @@ class ProductCore extends ObjectModel
$usetax = false;
}
if ($usetax != false
&& !empty($address_infos['vat_number'])
&& $address_infos['id_country'] != Configuration::get('VATNUMBER_COUNTRY')
&& Configuration::get('VATNUMBER_MANAGEMENT')) {
$usetax = false;
}
if (is_null($id_customer) && Validate::isLoadedObject($context->customer)) {
$id_customer = $context->customer->id;
}
@@ -5514,66 +5500,6 @@ class ProductCore extends ObjectModel
$id_shop = (int)Context::getContext()->shop->id;
$cache_id = 'Product::getAttributesParams_'.(int)$id_product.'-'.(int)$id_product_attribute.'-'.(int)$id_lang.'-'.(int)$id_shop;
// if blocklayered module is installed we check if user has set custom attribute name
if (Module::isInstalled('blocklayered') && Module::isEnabled('blocklayered')) {
$nb_custom_values = Db::getInstance()->executeS('
SELECT DISTINCT la.`id_attribute`, la.`url_name` as `name`
FROM `'._DB_PREFIX_.'attribute` a
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac
ON (a.`id_attribute` = pac.`id_attribute`)
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
'.Shop::addSqlAssociation('product_attribute', 'pa').'
LEFT JOIN `'._DB_PREFIX_.'layered_indexable_attribute_lang_value` la
ON (la.`id_attribute` = a.`id_attribute` AND la.`id_lang` = '.(int)$id_lang.')
WHERE la.`url_name` IS NOT NULL AND la.`url_name` != \'\'
AND pa.`id_product` = '.(int)$id_product.'
AND pac.`id_product_attribute` = '.(int)$id_product_attribute);
if (!empty($nb_custom_values)) {
$tab_id_attribute = array();
foreach ($nb_custom_values as $attribute) {
$tab_id_attribute[] = $attribute['id_attribute'];
$group = Db::getInstance()->executeS('
SELECT a.`id_attribute`, g.`id_attribute_group`, g.`url_name` as `group`
FROM `'._DB_PREFIX_.'layered_indexable_attribute_group_lang_value` g
LEFT JOIN `'._DB_PREFIX_.'attribute` a
ON (a.`id_attribute_group` = g.`id_attribute_group`)
WHERE a.`id_attribute` = '.(int)$attribute['id_attribute'].'
AND g.`id_lang` = '.(int)$id_lang.'
AND g.`url_name` IS NOT NULL AND g.`url_name` != \'\'');
if (empty($group)) {
$group = Db::getInstance()->executeS('
SELECT g.`id_attribute_group`, g.`name` as `group`
FROM `'._DB_PREFIX_.'attribute_group_lang` g
LEFT JOIN `'._DB_PREFIX_.'attribute` a
ON (a.`id_attribute_group` = g.`id_attribute_group`)
WHERE a.`id_attribute` = '.(int)$attribute['id_attribute'].'
AND g.`id_lang` = '.(int)$id_lang.'
AND g.`name` IS NOT NULL');
}
$result[] = array_merge($attribute, $group[0]);
}
$values_not_custom = Db::getInstance()->executeS('
SELECT DISTINCT a.`id_attribute`, a.`id_attribute_group`, al.`name`, agl.`name` as `group`
FROM `'._DB_PREFIX_.'attribute` a
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al
ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$id_lang.')
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl
ON (a.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$id_lang.')
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac
ON (a.`id_attribute` = pac.`id_attribute`)
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
'.Shop::addSqlAssociation('product_attribute', 'pa').'
WHERE pa.`id_product` = '.(int)$id_product.'
AND pac.id_product_attribute = '.(int)$id_product_attribute.'
AND a.`id_attribute` NOT IN('.implode(', ', $tab_id_attribute).')');
return array_merge($values_not_custom, $result);
}
}
if (!Cache::isStored($cache_id)) {
$result = Db::getInstance()->executeS('
SELECT a.`id_attribute`, a.`id_attribute_group`, al.`name`, agl.`name` as `group`
@@ -5603,94 +5529,20 @@ class ProductCore extends ObjectModel
*/
public static function getAttributesInformationsByProduct($id_product)
{
// if blocklayered module is installed we check if user has set custom attribute name
if (Module::isInstalled('blocklayered') && Module::isEnabled('blocklayered')) {
$nb_custom_values = Db::getInstance()->executeS('
SELECT DISTINCT la.`id_attribute`, la.`url_name` as `attribute`
FROM `'._DB_PREFIX_.'attribute` a
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac
ON (a.`id_attribute` = pac.`id_attribute`)
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
'.Shop::addSqlAssociation('product_attribute', 'pa').'
LEFT JOIN `'._DB_PREFIX_.'layered_indexable_attribute_lang_value` la
ON (la.`id_attribute` = a.`id_attribute` AND la.`id_lang` = '.(int)Context::getContext()->language->id.')
WHERE la.`url_name` IS NOT NULL AND la.`url_name` != \'\'
AND pa.`id_product` = '.(int)$id_product);
if (!empty($nb_custom_values)) {
$tab_id_attribute = array();
foreach ($nb_custom_values as $attribute) {
$tab_id_attribute[] = $attribute['id_attribute'];
$group = Db::getInstance()->executeS('
SELECT g.`id_attribute_group`, g.`url_name` as `group`
FROM `'._DB_PREFIX_.'layered_indexable_attribute_group_lang_value` g
LEFT JOIN `'._DB_PREFIX_.'attribute` a
ON (a.`id_attribute_group` = g.`id_attribute_group`)
WHERE a.`id_attribute` = '.(int)$attribute['id_attribute'].'
AND g.`id_lang` = '.(int)Context::getContext()->language->id.'
AND g.`url_name` IS NOT NULL AND g.`url_name` != \'\'');
if (empty($group)) {
$group = Db::getInstance()->executeS('
SELECT g.`id_attribute_group`, g.`name` as `group`
FROM `'._DB_PREFIX_.'attribute_group_lang` g
LEFT JOIN `'._DB_PREFIX_.'attribute` a
ON (a.`id_attribute_group` = g.`id_attribute_group`)
WHERE a.`id_attribute` = '.(int)$attribute['id_attribute'].'
AND g.`id_lang` = '.(int)Context::getContext()->language->id.'
AND g.`name` IS NOT NULL');
}
$result[] = array_merge($attribute, $group[0]);
}
$values_not_custom = Db::getInstance()->executeS('
SELECT DISTINCT a.`id_attribute`, a.`id_attribute_group`, al.`name` as `attribute`, agl.`name` as `group`
FROM `'._DB_PREFIX_.'attribute` a
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al
ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)Context::getContext()->language->id.')
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl
ON (a.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)Context::getContext()->language->id.')
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac
ON (a.`id_attribute` = pac.`id_attribute`)
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
'.Shop::addSqlAssociation('product_attribute', 'pa').'
'.Shop::addSqlAssociation('attribute', 'pac').'
WHERE pa.`id_product` = '.(int)$id_product.'
AND a.`id_attribute` NOT IN('.implode(', ', $tab_id_attribute).')');
$result = array_merge($values_not_custom, $result);
} else {
$result = Db::getInstance()->executeS('
SELECT DISTINCT a.`id_attribute`, a.`id_attribute_group`, al.`name` as `attribute`, agl.`name` as `group`
FROM `'._DB_PREFIX_.'attribute` a
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al
ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)Context::getContext()->language->id.')
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl
ON (a.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)Context::getContext()->language->id.')
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac
ON (a.`id_attribute` = pac.`id_attribute`)
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
'.Shop::addSqlAssociation('product_attribute', 'pa').'
'.Shop::addSqlAssociation('attribute', 'pac').'
WHERE pa.`id_product` = '.(int)$id_product);
}
} else {
$result = Db::getInstance()->executeS('
SELECT DISTINCT a.`id_attribute`, a.`id_attribute_group`, al.`name` as `attribute`, agl.`name` as `group`
FROM `'._DB_PREFIX_.'attribute` a
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al
ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)Context::getContext()->language->id.')
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl
ON (a.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)Context::getContext()->language->id.')
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac
ON (a.`id_attribute` = pac.`id_attribute`)
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
'.Shop::addSqlAssociation('product_attribute', 'pa').'
'.Shop::addSqlAssociation('attribute', 'pac').'
WHERE pa.`id_product` = '.(int)$id_product);
}
$result = Db::getInstance()->executeS('
SELECT DISTINCT a.`id_attribute`, a.`id_attribute_group`, al.`name` as `attribute`, agl.`name` as `group`
FROM `'._DB_PREFIX_.'attribute` a
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al
ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)Context::getContext()->language->id.')
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl
ON (a.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)Context::getContext()->language->id.')
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac
ON (a.`id_attribute` = pac.`id_attribute`)
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
'.Shop::addSqlAssociation('product_attribute', 'pa').'
'.Shop::addSqlAssociation('attribute', 'pac').'
WHERE pa.`id_product` = '.(int)$id_product);
return $result;
}

View File

@@ -465,7 +465,6 @@ class FrontControllerCore extends Controller
'use_taxes' => (int)Configuration::get('PS_TAX'),
'show_taxes' => (int)(Configuration::get('PS_TAX_DISPLAY') == 1 && (int)Configuration::get('PS_TAX')),
'display_tax_label' => (bool)$display_tax_label,
'vat_management' => (int)Configuration::get('VATNUMBER_MANAGEMENT'),
'opc' => (bool)Configuration::get('PS_ORDER_PROCESS_TYPE'),
'PS_CATALOG_MODE' => (bool)Configuration::get('PS_CATALOG_MODE') || (Group::isFeatureActive() && !(bool)Group::getCurrent()->show_prices),
'b2b_enable' => (bool)Configuration::get('PS_B2B_ENABLE'),
@@ -1582,17 +1581,10 @@ class FrontControllerCore extends Controller
*/
public function setMobileTemplate($template)
{
// Needed for site map
$blockmanufacturer = Module::getInstanceByName('blockmanufacturer');
$blocksupplier = Module::getInstanceByName('blocksupplier');
$this->context->smarty->assign(array(
'categoriesTree' => Category::getRootCategory()->recurseLiteCategTree(0),
'categoriescmsTree' => CMSCategory::getRecurseCategory($this->context->language->id, 1, 1, 1),
'voucherAllowed' => (int)CartRule::isFeatureActive(),
'display_manufacturer_link' => (bool)$blockmanufacturer->active,
'display_supplier_link' => (bool)$blocksupplier->active,
'PS_DISPLAY_SUPPLIERS' => Configuration::get('PS_DISPLAY_SUPPLIERS'),
'PS_DISPLAY_BEST_SELLERS' => Configuration::get('PS_DISPLAY_BEST_SELLERS'),
'display_store' => Configuration::get('PS_STORES_DISPLAY_SITEMAP'),
'conditions' => Configuration::get('PS_CONDITIONS'),

View File

@@ -251,7 +251,6 @@ class HelperFormCore extends Helper
'fields' => $this->fields_form,
'fields_value' => $this->fields_value,
'required_fields' => $this->getFieldsRequired(),
'vat_number' => Module::isInstalled('vatnumber') && file_exists(_PS_MODULE_DIR_.'vatnumber/ajax.php'),
'module_dir' => _MODULE_DIR_,
'base_url' => $this->context->shop->getBaseURL(),
'contains_states' => (isset($this->fields_value['id_country']) && isset($this->fields_value['id_state'])) ? Country::containsStates($this->fields_value['id_country']) : null,

View File

@@ -533,9 +533,6 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$debug = Tools::getValue('debug');
$address = new Address((int)$this->order->id_address_tax);
$tax_exempt = Configuration::get('VATNUMBER_MANAGEMENT')
&& !empty($address->vat_number)
&& $address->id_country != Configuration::get('VATNUMBER_COUNTRY');
$carrier = new Carrier($this->order->id_carrier);
// code to send name of the taxes applied on the order to show names od taxes in the invoice for GST
@@ -560,7 +557,6 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$data = array(
'showTaxName' => $showTaxName,
'tax_exempt' => $tax_exempt,
'use_one_after_another_method' => $this->order_invoice->useOneAfterAnotherTaxComputationMethod(),
'display_tax_bases_in_breakdowns' => $this->order_invoice->displayTaxBasesInProductTaxesBreakdown(),
'product_tax_breakdown' => $this->order_invoice->getProductTaxesBreakdown($this->order),

View File

@@ -199,12 +199,7 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
public function getTaxTabContent()
{
$address = new Address((int)$this->order->id_address_tax);
$tax_exempt = Configuration::get('VATNUMBER_MANAGEMENT')
&& !empty($address->vat_number)
&& $address->id_country != Configuration::get('VATNUMBER_COUNTRY');
$this->smarty->assign(array(
'tax_exempt' => $tax_exempt,
'product_tax_breakdown' => $this->getProductTaxesBreakdown(),
'shipping_tax_breakdown' => $this->getShippingTaxesBreakdown(),
'order' => $this->order,

View File

@@ -50,7 +50,6 @@
<modules>
<module action="enable" name="blocknewsletter"/>
<module action="enable" name="blocksocial"/>
<module action="enable" name="socialsharing"/>
<module action="enable" name="blockmyaccount"/>
<module action="enable" name="blocklanguages"/>
<module action="enable" name="blockcurrencies"/>
@@ -62,43 +61,6 @@
<module action="enable" name="statsdata"/>
<module action="enable" name="blockcart"/>
<module action="enable" name="blockuserinfo"/>
<module action="disable" name="blockadvertising"/>
<module action="disable" name="blockbanner"/>
<module action="disable" name="blockbestsellers"/>
<module action="disable" name="blockcategories"/>
<module action="disable" name="blockcms"/>
<module action="disable" name="blockcmsinfo"/>
<module action="disable" name="blockcontact"/>
<module action="disable" name="blockcontactinfos"/>
<module action="disable" name="blockcustomerprivacy"/>
<module action="disable" name="blockfacebook"/>
<module action="disable" name="blocklayered"/>
<module action="disable" name="blocklink"/>
<module action="disable" name="blockmanufacturer"/>
<module action="disable" name="blockmyaccountfooter"/>
<module action="disable" name="blocknewproducts"/>
<module action="disable" name="blockpaymentlogo"/>
<module action="disable" name="blockpermanentlinks"/>
<module action="disable" name="blockrss"/>
<module action="disable" name="blocksearch"/>
<module action="disable" name="blocksharefb"/>
<module action="disable" name="blockspecials"/>
<module action="disable" name="blockstore"/>
<module action="disable" name="blocksupplier"/>
<module action="disable" name="blocktags"/>
<module action="disable" name="blocktopmenu"/>
<module action="disable" name="blockviewed"/>
<module action="disable" name="blockwishlist"/>
<module action="disable" name="crossselling"/>
<module action="disable" name="homefeatured"/>
<module action="disable" name="homeslider"/>
<module action="disable" name="productpaymentlogos"/>
<module action="disable" name="productscategory"/>
<module action="disable" name="producttooltip"/>
<module action="disable" name="pscleaner"/>
<module action="disable" name="sendtoafriend"/>
<module action="disable" name="trackingfront"/>
<module action="disable" name="vatnumber"/>
<hooks>
<hook module="hotelreservationsystem" hook="actionValidateOrder" position="1"/>
<hook module="hotelreservationsystem" hook="Header" position="1"/>
@@ -166,12 +128,6 @@
<hook module="blocknewsletter" hook="actionDeleteGDPRCustomer" position="1"/>
<hook module="blocksocial" hook="Header" position="4"/>
<hook module="blocksocial" hook="displayFooterNotificationHook" position="2"/>
<hook module="socialsharing" hook="Header" position="6"/>
<hook module="socialsharing" hook="displayRightColumnProduct" position="1"/>
<hook module="socialsharing" hook="actionObjectProductUpdateAfter" position="1"/>
<hook module="socialsharing" hook="actionObjectProductDeleteAfter" position="1"/>
<hook module="socialsharing" hook="displayCompareExtraInformation" position="1"/>
<hook module="socialsharing" hook="displaySocialSharing" position="1"/>
<hook module="blockmyaccount" hook="displayLeftColumn" position="3" exceptions="category"/>
<hook module="blockmyaccount" hook="Header" position="8"/>
<hook module="blockmyaccount" hook="actionModuleRegisterHookAfter" position="1"/>

View File

@@ -36,7 +36,7 @@ class AdminAddressesControllerCore extends AdminController
{
$this->bootstrap = true;
$this->required_database = true;
$this->required_fields = array('company','address2', 'postcode', 'other', 'phone', 'phone_mobile', 'vat_number', 'dni');
$this->required_fields = array('company', 'address2', 'postcode', 'other', 'phone', 'phone_mobile', 'dni');
$this->table = 'address';
$this->className = 'Address';
$this->lang = false;
@@ -217,13 +217,6 @@ class AdminAddressesControllerCore extends AdminController
'col' => '4',
'hint' => $this->l('Invalid characters:').' &lt;&gt;;=#{}'
);
$temp_fields[] = array(
'type' => 'text',
'label' => $this->l('VAT number'),
'col' => '2',
'name' => 'vat_number',
'required' => in_array('vat_number', $required_fields)
);
} elseif ($addr_field_item == 'lastname') {
if (isset($customer) &&
!Tools::isSubmit('submit'.strtoupper($this->table)) &&

View File

@@ -61,7 +61,7 @@ class AdminBackupControllerCore extends AdminController
'title' => $this->l('Ignore statistics tables'),
'desc' => $this->l('Drop existing tables during import.').'
<br />'._DB_PREFIX_.'connections, '._DB_PREFIX_.'connections_page, '._DB_PREFIX_
.'connections_source, '._DB_PREFIX_.'guest, '._DB_PREFIX_.'statssearch',
.'connections_source, '._DB_PREFIX_.'guest',
'cast' => 'intval',
'type' => 'bool'
),

View File

@@ -741,7 +741,6 @@ class AdminMetaControllerCore extends AdminController
{
$this->addFieldRoute('product_rule', $this->l('Route to products'));
$this->addFieldRoute('category_rule', $this->l('Route to category'));
$this->addFieldRoute('layered_rule', $this->l('Route to category which has the "selected_filter" attribute for the "Layered Navigation" (blocklayered) module'));
$this->addFieldRoute('supplier_rule', $this->l('Route to supplier'));
$this->addFieldRoute('manufacturer_rule', $this->l('Route to manufacturer'));
$this->addFieldRoute('cms_rule', $this->l('Route to CMS page'));

View File

@@ -29,7 +29,6 @@ class AdminModulesControllerCore extends AdminController
private $_modules_ad = array(
'blockcart' => array('cartabandonmentpro'),
/* 'bloctopmenu' => array('advancedtopmenu'), */
'blocklayered' => array('pm_advancedsearch4')
);
/*
** @var array map with $_GET keywords and their callback

View File

@@ -2697,8 +2697,6 @@ class AdminProductsControllerCore extends AdminController
// used to build the new url when changing category
$this->tpl_list_vars['base_url'] = preg_replace('#&id_category=[0-9]*#', '', self::$currentIndex).'&token='.$this->token;
}
// @todo module free
$this->tpl_form_vars['vat_number'] = file_exists(_PS_MODULE_DIR_.'vatnumber/ajax.php');
parent::initContent();
}

View File

@@ -230,17 +230,6 @@ class AdminReferrersControllerCore extends AdminController
'submit' => array('title' => $this->l('Save')),
));
if (Module::isInstalled('trackingfront')) {
$this->fields_form[0]['form']['desc'] = array(
$this->l('Affiliates can access their data with this name and password.'),
$this->l('Front access:').' <a class="btn btn-link" href="'.$uri.'modules/trackingfront/stats.php" onclick="return !window.open(this.href);"><i class="icon-external-link-sign"></i> '.$uri.'modules/trackingfront/stats.php</a>'
);
} else {
$this->fields_form[0]['form']['desc'] = array(
sprintf($this->l('Please install the "%s" module in order to give your affiliates access their own statistics.'), Module::getModuleName('trackingfront'))
);
}
$this->fields_form[1] = array('form' => array(
'legend' => array(
'title' => $this->l('Commission plan'),

View File

@@ -2085,45 +2085,16 @@ class AdminThemesControllerCore extends AdminController
return array(
'addsharethis',
'bankwire',
'blockadvertising',
'blockbanner',
'blockbestsellers',
'blockcart',
'blockcategories',
'blockcms',
'blockcmsinfo',
'blockcontact',
'blockcontactinfos',
'blockcurrencies',
'blockcustomerprivacy',
'blockfacebook',
'blocklanguages',
'blocklayered',
'blocklink',
'blockmanufacturer',
'blockmyaccount',
'blockmyaccountfooter',
'blocknewproducts',
'blocknewsletter',
'blockpaymentlogo',
'blockpermanentlinks',
'blockreinsurance',
'blockrss',
'blocksearch',
'blocksharefb',
'blocksocial',
'blockspecials',
'blockstore',
'blocksupplier',
'blocktags',
'blocktopmenu',
'blockuserinfo',
'blockviewed',
'blockwishlist',
'carriercompare',
'cashondelivery',
'cheque',
'crossselling',
'dashactivity',
'dashgoals',
'dashproducts',
@@ -2135,22 +2106,13 @@ class AdminThemesControllerCore extends AdminController
'followup',
'gapi',
'graphnvd3',
'gridhtml',
'homefeatured',
'homeslider',
'loyalty',
'mailalerts',
'newsletter',
'pagesnotfound',
'productcomments',
'productpaymentlogos',
'productscategory',
'producttooltip',
'pscleaner',
'referralprogram',
'sekeywords',
'sendtoafriend',
'socialsharing',
'statsbestcategories',
'statsbestcustomers',
'statsbestmanufacturers',
@@ -2170,12 +2132,8 @@ class AdminThemesControllerCore extends AdminController
'statsproduct',
'statsregistrations',
'statssales',
'statssearch',
'statsstock',
'statsvisits',
'themeconfigurator',
'trackingfront',
'vatnumber',
'watermark'
);
}

View File

@@ -45,7 +45,6 @@ class AddressControllerCore extends FrontController
{
parent::setMedia();
$this->addJS(array(
_THEME_JS_DIR_.'tools/vatManagement.js',
_THEME_JS_DIR_.'tools/statesManagement.js',
_PS_JS_DIR_.'validate.js'
));
@@ -257,7 +256,6 @@ class AddressControllerCore extends FrontController
parent::initContent();
$this->assignCountries();
$this->assignVatNumber();
$this->assignAddressFormat();
// Assign common vars
@@ -331,32 +329,6 @@ class AddressControllerCore extends FrontController
));
}
/**
* Assign template vars related to vat number
* @todo move this in vatnumber module !
*/
protected function assignVatNumber()
{
$vat_number_exists = file_exists(_PS_MODULE_DIR_.'vatnumber/vatnumber.php');
$vat_number_management = Configuration::get('VATNUMBER_MANAGEMENT');
if ($vat_number_management && $vat_number_exists) {
include_once(_PS_MODULE_DIR_.'vatnumber/vatnumber.php');
}
if ($vat_number_management && $vat_number_exists && VatNumber::isApplicable((int)Tools::getCountry())) {
$vat_display = 2;
} elseif ($vat_number_management) {
$vat_display = 1;
} else {
$vat_display = 0;
}
$this->context->smarty->assign(array(
'vatnumber_ajax_call' => file_exists(_PS_MODULE_DIR_.'vatnumber/ajax.php'),
'vat_display' => $vat_display,
));
}
public function displayAjax()
{
if (count($this->errors)) {

View File

@@ -85,7 +85,6 @@ class AddressesControllerCore extends FrontController
$addresses_style = array(
'company' => 'address_company',
'vat_number' => 'address_company',
'firstname' => 'address_name',
'lastname' => 'address_name',
'address1' => 'address_address1',

View File

@@ -70,7 +70,6 @@ class AuthControllerCore extends FrontController
$this->addJqueryPlugin('typewatch');
$this->addJS(array(
_THEME_JS_DIR_.'tools/vatManagement.js',
_THEME_JS_DIR_.'tools/statesManagement.js',
_THEME_JS_DIR_.'authentication.js',
_PS_JS_DIR_.'validate.js'
@@ -217,7 +216,6 @@ class AuthControllerCore extends FrontController
'countries' => $countries,
'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'),
'sl_country' => (int)$this->id_country,
'vat_management' => Configuration::get('VATNUMBER_MANAGEMENT')
));
}

View File

@@ -345,7 +345,6 @@ class OrderOpcControllerCore extends ParentOrderController
}
$this->addJS(array(
_THEME_JS_DIR_.'tools/vatManagement.js',
_THEME_JS_DIR_.'tools/statesManagement.js',
_THEME_JS_DIR_.'order-carrier.js',
_PS_JS_DIR_.'validate.js'
@@ -597,7 +596,6 @@ class OrderOpcControllerCore extends ParentOrderController
'company' => Tools::htmlentitiesUTF8($address_delivery->company),
'lastname' => Tools::htmlentitiesUTF8($address_delivery->lastname),
'firstname' => Tools::htmlentitiesUTF8($address_delivery->firstname),
'vat_number' => Tools::htmlentitiesUTF8($address_delivery->vat_number),
'dni' => Tools::htmlentitiesUTF8($address_delivery->dni),
'address1' => Tools::htmlentitiesUTF8($address_delivery->address1),
'postcode' => Tools::htmlentitiesUTF8($address_delivery->postcode),
@@ -613,7 +611,6 @@ class OrderOpcControllerCore extends ParentOrderController
'company_invoice' => Tools::htmlentitiesUTF8($address_invoice->company),
'lastname_invoice' => Tools::htmlentitiesUTF8($address_invoice->lastname),
'firstname_invoice' => Tools::htmlentitiesUTF8($address_invoice->firstname),
'vat_number_invoice' => Tools::htmlentitiesUTF8($address_invoice->vat_number),
'dni_invoice' => Tools::htmlentitiesUTF8($address_invoice->dni),
'address1_invoice' => Tools::htmlentitiesUTF8($address_invoice->address1),
'address2_invoice' => Tools::htmlentitiesUTF8($address_invoice->address2),
@@ -627,7 +624,6 @@ class OrderOpcControllerCore extends ParentOrderController
'invoice_company' => Tools::htmlentitiesUTF8($address_invoice->company),
'invoice_lastname' => Tools::htmlentitiesUTF8($address_invoice->lastname),
'invoice_firstname' => Tools::htmlentitiesUTF8($address_invoice->firstname),
'invoice_vat_number' => Tools::htmlentitiesUTF8($address_invoice->vat_number),
'invoice_dni' => Tools::htmlentitiesUTF8($address_invoice->dni),
'invoice_address' => $this->context->cart->id_address_invoice !== $this->context->cart->id_address_delivery,
'invoice_address1' => Tools::htmlentitiesUTF8($address_invoice->address1),

View File

@@ -158,7 +158,7 @@ class ProductControllerCore extends FrontController
$id_category = (int)$this->product->id_category_default;
}
$this->category = new Category((int)$id_category, (int)$this->context->cookie->id_lang);
if (isset($this->context->cookie) && isset($this->category->id_category) && !(Module::isInstalled('blockcategories') && Module::isEnabled('blockcategories'))) {
if (isset($this->context->cookie) && isset($this->category->id_category)) {
$this->context->cookie->last_visited_category = (int)$this->category->id_category;
}
}

View File

@@ -46,22 +46,6 @@ class SitemapControllerCore extends FrontController
$this->context->smarty->assign('categoriesTree', Category::getRootCategory()->recurseLiteCategTree(0));
$this->context->smarty->assign('categoriescmsTree', CMSCategory::getRecurseCategory($this->context->language->id, 1, 1, 1));
$this->context->smarty->assign('voucherAllowed', (int)CartRule::isFeatureActive());
if (Module::isInstalled('blockmanufacturer') && Module::isEnabled('blockmanufacturer')) {
$blockmanufacturer = Module::getInstanceByName('blockmanufacturer');
$this->context->smarty->assign('display_manufacturer_link', isset($blockmanufacturer->active) ? (bool)$blockmanufacturer->active : false);
} else {
$this->context->smarty->assign('display_manufacturer_link', 0);
}
if (Module::isInstalled('blocksupplier') && Module::isEnabled('blocksupplier')) {
$blocksupplier = Module::getInstanceByName('blocksupplier');
$this->context->smarty->assign('display_supplier_link', isset($blocksupplier->active) ? (bool)$blocksupplier->active : false);
} else {
$this->context->smarty->assign('display_supplier_link', 0);
}
$this->context->smarty->assign('PS_DISPLAY_SUPPLIERS', Configuration::get('PS_DISPLAY_SUPPLIERS'));
$this->context->smarty->assign('PS_DISPLAY_BEST_SELLERS', Configuration::get('PS_DISPLAY_BEST_SELLERS'));
$this->context->smarty->assign('display_store', Configuration::get('PS_STORES_DISPLAY_SITEMAP'));

View File

@@ -43,12 +43,10 @@ UPDATE `PREFIX_configuration` SET value = '1' WHERE name = 'MANUFACTURER_DISPLAY
UPDATE `PREFIX_configuration` SET value = '1' WHERE name = 'MANUFACTURER_DISPLAY_TEXT';
UPDATE `PREFIX_configuration` SET value = '5' WHERE name = 'MANUFACTURER_DISPLAY_TEXT_NB';
UPDATE `PREFIX_configuration` SET value = '8' WHERE name = 'NEW_PRODUCTS_NBR';
UPDATE `PREFIX_configuration` SET value = '10' WHERE name = 'BLOCKTAGS_NBR';
UPDATE `PREFIX_configuration` SET value = '0_3|0_4' WHERE name = 'FOOTER_CMS';
UPDATE `PREFIX_configuration` SET value = '0_3|0_4' WHERE name = 'FOOTER_BLOCK_ACTIVATION';
UPDATE `PREFIX_configuration` SET value = '1' WHERE name = 'FOOTER_POWEREDBY';
UPDATE `PREFIX_configuration` SET value = 'https://qloapps.com/' WHERE name = 'BLOCKADVERT_LINK';
UPDATE `PREFIX_configuration` SET value = 'store.jpg' WHERE name = 'BLOCKSTORE_IMG';
UPDATE `PREFIX_configuration` SET value = 'jpg' WHERE name = 'BLOCKADVERT_IMG_EXT';
UPDATE `PREFIX_configuration` SET value = 'CAT3,CAT8,CAT5,LNK1' WHERE name = 'MOD_BLOCKTOPMENU_ITEMS';
UPDATE `PREFIX_configuration` SET value = '0' WHERE name = 'MOD_BLOCKTOPMENU_SEARCH';
@@ -107,9 +105,6 @@ AND id_hook = @id_hook;
/* displayTop */
SET @id_hook = (SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayTop');
UPDATE `PREFIX_hook_module` SET position = 1
WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'blocksearch')
AND id_hook = @id_hook;
UPDATE `PREFIX_hook_module` SET position = 3
WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'blocktopmenu')
@@ -131,10 +126,6 @@ UPDATE `PREFIX_hook_module` SET position = 1
WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'blocknewproducts')
AND id_hook IN (@id_hook, @id_hook2);
UPDATE `PREFIX_hook_module` SET position = 2
WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'homefeatured')
AND id_hook IN (@id_hook, @id_hook2);
UPDATE `PREFIX_hook_module` SET position = 3
WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockbestsellers')
AND id_hook IN (@id_hook, @id_hook2);
@@ -149,14 +140,6 @@ UPDATE `PREFIX_hook_module` SET position = 2
WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'blocksocial')
AND id_hook = @id_hook;
UPDATE `PREFIX_hook_module` SET position = 3
WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockcategories')
AND id_hook = @id_hook;
UPDATE `PREFIX_hook_module` SET position = 4
WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockcms')
AND id_hook = @id_hook;
UPDATE `PREFIX_hook_module` SET position = 5
WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockmyaccountfooter')
AND id_hook = @id_hook;
@@ -170,9 +153,6 @@ SET @id_hook = (SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayProductBu
UPDATE `PREFIX_hook_module` SET position = 1
WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockwishlist')
AND id_hook = @id_hook;
UPDATE `PREFIX_hook_module` SET position = 2
WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'productpaymentlogos')
AND id_hook = @id_hook;
INSERT INTO `PREFIX_hook_module_exceptions` (`id_shop`, `id_module`, `id_hook`, `file_name`)
(

View File

@@ -605,9 +605,6 @@
<configuration id="PS_STATS_GRID_RENDER" name="PS_STATS_GRID_RENDER">
<value>gridhtml</value>
</configuration>
<configuration id="BLOCKTAGS_NBR" name="BLOCKTAGS_NBR">
<value>10</value>
</configuration>
<configuration id="CHECKUP_DESCRIPTIONS_LT" name="CHECKUP_DESCRIPTIONS_LT">
<value>100</value>
</configuration>
@@ -644,9 +641,6 @@
<configuration id="BLOCKADVERT_LINK" name="BLOCKADVERT_LINK">
<value>http://www.qloapps.com</value>
</configuration>
<configuration id="BLOCKSTORE_IMG" name="BLOCKSTORE_IMG">
<value>store.jpg</value>
</configuration>
<configuration id="BLOCKADVERT_IMG_EXT" name="BLOCKADVERT_IMG_EXT">
<value>jpg</value>
</configuration>
@@ -662,26 +656,6 @@
<configuration id="blocksocial_twitter" name="BLOCKSOCIAL_TWITTER">
<value>http://www.twitter.com/qloapps</value>
</configuration>
<configuration id="blockcontactinfos_company" name="BLOCKCONTACTINFOS_COMPANY">
<value>Your company</value>
</configuration>
<configuration id="blockcontactinfos_address" name="BLOCKCONTACTINFOS_ADDRESS">
<value>Address line 1
City
Country</value>
</configuration>
<configuration id="blockcontactinfos_phone" name="BLOCKCONTACTINFOS_PHONE">
<value>0123-456-789</value>
</configuration>
<configuration id="blockcontactinfos_email" name="BLOCKCONTACTINFOS_EMAIL">
<value>pub@qloapps.com</value>
</configuration>
<configuration id="blockcontact_telnumber" name="BLOCKCONTACT_TELNUMBER">
<value>0123-456-789</value>
</configuration>
<configuration id="blockcontact_email" name="BLOCKCONTACT_EMAIL">
<value>pub@qloapps.com</value>
</configuration>
<configuration id="SUPPLIER_DISPLAY_TEXT" name="SUPPLIER_DISPLAY_TEXT">
<value>1</value>
</configuration>
@@ -703,18 +677,6 @@ Country</value>
<configuration id="BLOCKREINSURANCE_NBBLOCKS" name="BLOCKREINSURANCE_NBBLOCKS">
<value>5</value>
</configuration>
<configuration id="HOMESLIDER_WIDTH" name="HOMESLIDER_WIDTH">
<value>535</value>
</configuration>
<configuration id="HOMESLIDER_SPEED" name="HOMESLIDER_SPEED">
<value>1300</value>
</configuration>
<configuration id="HOMESLIDER_PAUSE" name="HOMESLIDER_PAUSE">
<value>7700</value>
</configuration>
<configuration id="HOMESLIDER_LOOP" name="HOMESLIDER_LOOP">
<value>1</value>
</configuration>
<configuration id="PS_BASE_DISTANCE_UNIT" name="PS_BASE_DISTANCE_UNIT">
<value>m</value>
</configuration>

View File

@@ -1321,21 +1321,6 @@ function ajaxStates(id_state_selected)
}
}
});
if (module_dir && vat_number)
{
$.ajax({
type: "GET",
url: window.location.origin + module_dir + "vatnumber/ajax.php?id_country=" + $('#id_country').val(),
success: function(isApplicable)
{
if(isApplicable == 1)
$('#vat_area').show();
else
$('#vat_area').hide();
}
});
}
}
function check_for_all_accesses(tabsize, tabnumber)

View File

@@ -1,14 +0,0 @@
------------------------------
# V0.10.1 to V0.10.2
------------------------------
## Improved/Changed Features:
* [CO] :Images link are now generated dynamically
_____________________________________________________________________________
2014-04-22 18:56:48 +0200 // Changelog updated
2014-04-15 17:23:48 +0200 [*] MO : blockadvertising - Changed the way images are stocked to avoid overwrite on update
2014-03-24 10:44:25 +0100 // MO BlockAdvertising : ps_versions_compliancy added
2014-03-20 14:19:12 +0100 Initial commit

View File

@@ -1,292 +0,0 @@
<?php
/*
* 2007-2016 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-2016 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 BlockAdvertising extends Module
{
/* Title associated to the image */
public $adv_title;
/* Link associated to the image */
public $adv_link;
/* Name of the image without extension */
public $adv_imgname;
/* Image path with extension */
public $adv_img;
public function __construct()
{
$this->name = 'blockadvertising';
$this->tab = 'advertising_marketing';
$this->version = '0.10.2';
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('Advertising block');
$this->description = $this->l('Adds an advertisement block to selected sections of your e-commerce website.');
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.6.99.99');
$this->initialize();
}
/*
* Set the properties of the module, like the link to the image and the title (contextual to the current shop context)
*/
protected function initialize()
{
$this->adv_imgname = 'advertising';
if ((Shop::getContext() == Shop::CONTEXT_GROUP || Shop::getContext() == Shop::CONTEXT_SHOP)
&& (bool)Tools::file_get_contents($this->context->link->getMediaLink(_MODULE_DIR_.$this->name.'/img/'.$this->adv_imgname.'-g'.$this->context->shop->getContextShopGroupID().'.'.Configuration::get('BLOCKADVERT_IMG_EXT'))) //bywebkul
)
$this->adv_imgname .= '-g'.$this->context->shop->getContextShopGroupID();
if (Shop::getContext() == Shop::CONTEXT_SHOP
&& (bool)Tools::file_get_contents($this->context->link->getMediaLink(_MODULE_DIR_.$this->name.'/img/'.$this->adv_imgname.'-s'.$this->context->shop->getContextShopID().'.'.Configuration::get('BLOCKADVERT_IMG_EXT'))) // by webkul
)
$this->adv_imgname .= '-s'.$this->context->shop->getContextShopID();
// If none of them available go default
if ($this->adv_imgname == 'advertising')
$this->adv_img = Tools::getMediaServer($this->name)._MODULE_DIR_.$this->name.'/img/fixtures/'.$this->adv_imgname.'.jpg';
else
$this->adv_img = Tools::getMediaServer($this->name)._MODULE_DIR_.$this->name.'/img/'.$this->adv_imgname.'.'.Configuration::get('BLOCKADVERT_IMG_EXT');
$this->adv_link = htmlentities(Configuration::get('BLOCKADVERT_LINK'), ENT_QUOTES, 'UTF-8');
$this->adv_title = htmlentities(Configuration::get('BLOCKADVERT_TITLE'), ENT_QUOTES, 'UTF-8');
}
public function install()
{
if (!parent::install())
return false;
// Hook the module either on the left or right column
$theme = new Theme(Context::getContext()->shop->id_theme);
if ((!$theme->default_left_column || !$this->registerHook('leftColumn'))
&& (!$theme->default_right_column || !$this->registerHook('rightColumn'))
)
{
// If there are no colums implemented by the template, throw an error and uninstall the module
$this->_errors[] = $this->l('This module needs to be hooked to a column, but your theme does not implement one');
parent::uninstall();
return false;
}
Configuration::updateGlobalValue('BLOCKADVERT_LINK', 'http://www.prestashop.com/');
Configuration::updateGlobalValue('BLOCKADVERT_TITLE', 'PrestaShop');
// Try to update with the extension of the image that exists in the module directory
foreach (scandir(_PS_MODULE_DIR_.$this->name) as $file)
if (in_array($file, array('advertising.jpg', 'advertising.gif', 'advertising.png')))
Configuration::updateGlobalValue('BLOCKADVERT_IMG_EXT', substr($file, strrpos($file, '.') + 1));
return true;
}
public function uninstall()
{
Configuration::deleteByName('BLOCKADVERT_LINK');
Configuration::deleteByName('BLOCKADVERT_TITLE');
Configuration::deleteByName('BLOCKADVERT_IMG_EXT');
return (parent::uninstall());
}
/**
* delete the contextual image (it is not allowed to delete the default image)
*
* @return void
*/
private function _deleteCurrentImg()
{
// Delete the image file
if ($this->adv_imgname != 'advertising' && (bool)Tools::file_get_contents($this->context->link->getMediaLink(_PS_MODULE_DIR_.$this->name.'/img/'.$this->adv_imgname.'.'.Configuration::get('BLOCKADVERT_IMG_EXT')))) // by webkul
Tools::deleteFile(_PS_MODULE_DIR_.$this->name.'/img/'.$this->adv_imgname.'.'.Configuration::get('BLOCKADVERT_IMG_EXT'));
// Update the extension to the global value or the shop group value if available
Configuration::deleteFromContext('BLOCKADVERT_IMG_EXT');
Configuration::updateValue('BLOCKADVERT_IMG_EXT', Configuration::get('BLOCKADVERT_IMG_EXT'));
// Reset the properties of the module
$this->initialize();
}
public function postProcess()
{
if (Tools::isSubmit('submitDeleteImgConf'))
$this->_deleteCurrentImg();
$errors = '';
if (Tools::isSubmit('submitAdvConf'))
{
if (isset($_FILES['adv_img']) && isset($_FILES['adv_img']['tmp_name']) && !empty($_FILES['adv_img']['tmp_name']))
{
if ($error = ImageManager::validateUpload($_FILES['adv_img'], Tools::convertBytes(ini_get('upload_max_filesize'))))
$errors .= $error;
else
{
Configuration::updateValue('BLOCKADVERT_IMG_EXT', substr($_FILES['adv_img']['name'], strrpos($_FILES['adv_img']['name'], '.') + 1));
// Set the image name with a name contextual to the shop context
$this->adv_imgname = 'advertising';
if (Shop::getContext() == Shop::CONTEXT_GROUP)
$this->adv_imgname = 'advertising-g'.(int)$this->context->shop->getContextShopGroupID();
elseif (Shop::getContext() == Shop::CONTEXT_SHOP)
$this->adv_imgname = 'advertising-s'.(int)$this->context->shop->getContextShopID();
// Copy the image in the module directory with its new name
if(!ImageManager::resize($_FILES['adv_img']['tmp_name'], _PS_MODULE_DIR_.$this->name.'/img/'.$this->adv_imgname.'.'.Configuration::get('BLOCKADVERT_IMG_EXT'))) { //by webkul
$errors .= $this->l('File upload error.');
}
}
}
// If the link is not set, then delete it in order to use the next default value (either the global value or the group value)
if ($link = Tools::getValue('adv_link'))
Configuration::updateValue('BLOCKADVERT_LINK', $link);
elseif (Shop::getContext() == Shop::CONTEXT_SHOP || Shop::getContext() == Shop::CONTEXT_GROUP)
Configuration::deleteFromContext('BLOCKADVERT_LINK');
// If the title is not set, then delete it in order to use the next default value (either the global value or the group value)
if ($title = Tools::getValue('adv_title'))
Configuration::updateValue('BLOCKADVERT_TITLE', $title);
elseif (Shop::getContext() == Shop::CONTEXT_SHOP || Shop::getContext() == Shop::CONTEXT_GROUP)
Configuration::deleteFromContext('BLOCKADVERT_TITLE');
// Reset the module properties
$this->initialize();
$this->_clearCache('blockadvertising.tpl');
if (!$errors)
Tools::redirectAdmin(AdminController::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&conf=6');
echo $this->displayError($errors);
}
}
/**
* getContent used to display admin module form
*
* @return string content
*/
public function getContent()
{
$this->postProcess();
return $this->renderForm();
}
public function hookRightColumn($params)
{
if (!$this->isCached('blockadvertising.tpl', $this->getCacheId()))
$this->smarty->assign(
array(
'image' => $this->context->link->protocol_content.$this->adv_img,
'adv_link' => $this->adv_link,
'adv_title' => $this->adv_title,
)
);
return $this->display(__FILE__, 'blockadvertising.tpl', $this->getCacheId());
}
public function hookLeftColumn($params)
{
return $this->hookRightColumn($params);
}
public function hookHeader($params)
{
$this->context->controller->addCSS($this->_path.'blockadvertising.css', 'all');
}
public function renderForm()
{
$fields_form = array(
'form' => array(
'legend' => array(
'title' => $this->l('Configuration'),
'icon' => 'icon-cogs'
),
'input' => array(
array(
'type' => 'file',
'label' => $this->l('Image for the advertisement'),
'name' => 'adv_img',
'desc' => $this->l('By default the image will appear in the left column. The recommended dimensions are 155 x 163px.'),
'thumb' => $this->context->link->protocol_content.$this->adv_img,
),
array(
'type' => 'text',
'label' => $this->l('Target link for the image'),
'name' => 'adv_link',
),
array(
'type' => 'text',
'label' => $this->l('Title of the target link'),
'name' => 'adv_title',
'desc' => $this->l('This title will be displayed when you mouse over the advertisement block in your shop.')
),
),
'submit' => array(
'title' => $this->l('Save'),
)
),
);
$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 = 'submitAdvConf';
$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(
'adv_link' => Tools::getValue('adv_link', Configuration::get('BLOCKADVERT_LINK')),
'adv_title' => Tools::getValue('adv_title', Configuration::get('BLOCKADVERT_TITLE')),
);
}
}

View File

@@ -1,30 +0,0 @@
{*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<!-- MODULE Block advertising -->
<div class="advertising_block">
<a href="{$adv_link}" title="{$adv_title}"><img src="{$image}" alt="{$adv_title}" title="{$adv_title}" width="155" height="163" /></a>
</div>
<!-- /MODULE Block advertising -->

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -1,36 +0,0 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_0_9($module)
{
$module_path = $module->getLocalPath();
$img_folder_path = $module->getLocalPath().'img';
$fixture_img_path = $module->getLocalPath().'img'.DIRECTORY_SEPARATOR.'fixtures';
if (!Tools::file_exists_cache($img_folder_path))
mkdir($img_folder_path);
if (!Tools::file_exists_cache($fixture_img_path))
mkdir($fixture_img_path);
$files = scandir($module->getLocalPath());
foreach ($files as $file)
{
if (strncmp($file, 'advertising', 11) == 0)
{
if ($file == 'advertising.jpg')
copy($module_path.$file, $fixture_img_path.DIRECTORY_SEPARATOR.$file);
else
copy($module_path.$file, $img_folder_path.DIRECTORY_SEPARATOR.$file);
unlink($module_path.$file);
}
}
Tools::clearCache(Context::getContext()->smarty, $module->getTemplatePath('blockadvertising.tpl'));
return true;
}

View File

@@ -1,14 +0,0 @@
------------------------------
# V1.4.1 to V1.4.2
------------------------------
## Improved/Changed Features:
* [CO] :Images link are now generated dynamically
_____________________________________________________________________________
2014-04-22 18:56:51 +0200 // Changelog updated
2014-03-24 11:43:28 +0100 / MO blockbanner : ps_versions_compliancy modified (1.5.6.1 => 1.6)
2014-03-24 10:55:56 +0100 / MO blockbanner : ps_versions_compliancy added
2014-03-20 14:19:15 +0100 Initial commit

View File

@@ -1,253 +0,0 @@
<?php
/*
* 2007-2016 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-2016 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 BlockBanner extends Module
{
public function __construct()
{
$this->name = 'blockbanner';
$this->tab = 'front_office_features';
$this->version = '1.4.2';
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('Banner block');
$this->description = $this->l('Displays a banner at the top of the shop.');
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.6.99.99');
}
public function install()
{
return
parent::install() &&
$this->registerHook('displayBanner') &&
$this->registerHook('displayHeader') &&
$this->registerHook('actionObjectLanguageAddAfter') &&
$this->installFixtures() &&
$this->disableDevice(Context::DEVICE_MOBILE);
}
public function hookActionObjectLanguageAddAfter($params)
{
return $this->installFixture((int)$params['object']->id, Configuration::get('BLOCKBANNER_IMG', (int)Configuration::get('PS_LANG_DEFAULT')));
}
protected function installFixtures()
{
$languages = Language::getLanguages(false);
foreach ($languages as $lang)
$this->installFixture((int)$lang['id_lang'], 'sale70.png');
return true;
}
protected function installFixture($id_lang, $image = null)
{
$values['BLOCKBANNER_IMG'][(int)$id_lang] = $image;
$values['BLOCKBANNER_LINK'][(int)$id_lang] = '';
$values['BLOCKBANNER_DESC'][(int)$id_lang] = '';
Configuration::updateValue('BLOCKBANNER_IMG', $values['BLOCKBANNER_IMG']);
Configuration::updateValue('BLOCKBANNER_LINK', $values['BLOCKBANNER_LINK']);
Configuration::updateValue('BLOCKBANNER_DESC', $values['BLOCKBANNER_DESC']);
}
public function uninstall()
{
Configuration::deleteByName('BLOCKBANNER_IMG');
Configuration::deleteByName('BLOCKBANNER_LINK');
Configuration::deleteByName('BLOCKBANNER_DESC');
return parent::uninstall();
}
public function hookDisplayTop($params)
{
if (!$this->isCached('blockbanner.tpl', $this->getCacheId()))
{
$imgname = Configuration::get('BLOCKBANNER_IMG', $this->context->language->id);
$imgUrl = $this->context->link->getMediaLink($this->_path.'img/'.$imgname); // by webkul
if ($imgname && (bool)Tools::file_get_contents($imgUrl)) // by webkul
$this->smarty->assign('banner_img', $imgUrl);
$this->smarty->assign(array(
'banner_link' => Configuration::get('BLOCKBANNER_LINK', $this->context->language->id),
'banner_desc' => Configuration::get('BLOCKBANNER_DESC', $this->context->language->id)
));
}
return $this->display(__FILE__, 'blockbanner.tpl', $this->getCacheId());
}
public function hookDisplayBanner($params)
{
return $this->hookDisplayTop($params);
}
public function hookDisplayFooter($params)
{
return $this->hookDisplayTop($params);
}
public function hookDisplayHeader($params)
{
$this->context->controller->addCSS($this->_path.'blockbanner.css', 'all');
}
public function postProcess()
{
if (Tools::isSubmit('submitStoreConf'))
{
$languages = Language::getLanguages(false);
$values = array();
$update_images_values = false;
foreach ($languages as $lang)
{
if (isset($_FILES['BLOCKBANNER_IMG_'.$lang['id_lang']])
&& isset($_FILES['BLOCKBANNER_IMG_'.$lang['id_lang']]['tmp_name'])
&& !empty($_FILES['BLOCKBANNER_IMG_'.$lang['id_lang']]['tmp_name']))
{
if ($error = ImageManager::validateUpload($_FILES['BLOCKBANNER_IMG_'.$lang['id_lang']], 4000000))
return $error;
else
{
$ext = substr($_FILES['BLOCKBANNER_IMG_'.$lang['id_lang']]['name'], strrpos($_FILES['BLOCKBANNER_IMG_'.$lang['id_lang']]['name'], '.') + 1);
$file_name = md5($_FILES['BLOCKBANNER_IMG_'.$lang['id_lang']]['name']).'.'.$ext;
if (!ImageManager::resize($_FILES['BLOCKBANNER_IMG_'.$lang['id_lang']]['tmp_name'], dirname(__FILE__).DIRECTORY_SEPARATOR.'img'.DIRECTORY_SEPARATOR.$file_name)) { // by webkul
return $this->displayError($this->l('An error occurred while attempting to upload the file.'));
} else {
if (Configuration::hasContext('BLOCKBANNER_IMG', $lang['id_lang'], Shop::getContext())
&& Configuration::get('BLOCKBANNER_IMG', $lang['id_lang']) != $file_name)
Tools::deleteFile(dirname(__FILE__).DIRECTORY_SEPARATOR.'img'.DIRECTORY_SEPARATOR.Configuration::get('BLOCKBANNER_IMG', $lang['id_lang']));
$values['BLOCKBANNER_IMG'][$lang['id_lang']] = $file_name;
}
}
$update_images_values = true;
}
$values['BLOCKBANNER_LINK'][$lang['id_lang']] = Tools::getValue('BLOCKBANNER_LINK_'.$lang['id_lang']);
$values['BLOCKBANNER_DESC'][$lang['id_lang']] = Tools::getValue('BLOCKBANNER_DESC_'.$lang['id_lang']);
}
if ($update_images_values)
Configuration::updateValue('BLOCKBANNER_IMG', $values['BLOCKBANNER_IMG']);
Configuration::updateValue('BLOCKBANNER_LINK', $values['BLOCKBANNER_LINK']);
Configuration::updateValue('BLOCKBANNER_DESC', $values['BLOCKBANNER_DESC']);
$this->_clearCache('blockbanner.tpl');
return $this->displayConfirmation($this->l('The settings have been updated.'));
}
return '';
}
public function getContent()
{
return $this->postProcess().$this->renderForm();
}
public function renderForm()
{
$fields_form = array(
'form' => array(
'legend' => array(
'title' => $this->l('Settings'),
'icon' => 'icon-cogs'
),
'input' => array(
array(
'type' => 'file_lang',
'label' => $this->l('Top banner image'),
'name' => 'BLOCKBANNER_IMG',
'desc' => $this->l('Upload an image for your top banner. The recommended dimensions are 1170 x 65px if you are using the default theme.'),
'lang' => true,
),
array(
'type' => 'text',
'lang' => true,
'label' => $this->l('Banner Link'),
'name' => 'BLOCKBANNER_LINK',
'desc' => $this->l('Enter the link associated to your banner. When clicking on the banner, the link opens in the same window. If no link is entered, it redirects to the homepage.')
),
array(
'type' => 'text',
'lang' => true,
'label' => $this->l('Banner description'),
'name' => 'BLOCKBANNER_DESC',
'desc' => $this->l('Please enter a short but meaningful description for the banner.')
)
),
'submit' => array(
'title' => $this->l('Save')
)
),
);
$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->module = $this;
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
$helper->identifier = $this->identifier;
$helper->submit_action = 'submitStoreConf';
$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(
'uri' => $this->context->link->getMediaLink($this->getPathUri()), // by webkul
'fields_value' => $this->getConfigFieldsValues(),
'languages' => $this->context->controller->getLanguages(),
'id_language' => $this->context->language->id
);
return $helper->generateForm(array($fields_form));
}
public function getConfigFieldsValues()
{
$languages = Language::getLanguages(false);
$fields = array();
foreach ($languages as $lang)
{
$fields['BLOCKBANNER_IMG'][$lang['id_lang']] = Tools::getValue('BLOCKBANNER_IMG_'.$lang['id_lang'], Configuration::get('BLOCKBANNER_IMG', $lang['id_lang']));
$fields['BLOCKBANNER_LINK'][$lang['id_lang']] = Tools::getValue('BLOCKBANNER_LINK_'.$lang['id_lang'], Configuration::get('BLOCKBANNER_LINK', $lang['id_lang']));
$fields['BLOCKBANNER_DESC'][$lang['id_lang']] = Tools::getValue('BLOCKBANNER_DESC_'.$lang['id_lang'], Configuration::get('BLOCKBANNER_DESC', $lang['id_lang']));
}
return $fields;
}
}

View File

@@ -1,31 +0,0 @@
{*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{if $banner_link}{$banner_link|escape:'htmlall':'UTF-8'}{else}{if isset($force_ssl) && $force_ssl}{$base_dir_ssl}{else}{$base_dir}{/if}{/if}" title="{$banner_desc|escape:'htmlall':'UTF-8'}">
{if isset($banner_img)}
<img class="img-responsive" src="{$banner_img|escape:'htmlall':'UTF-8'}" alt="{$banner_desc|escape:'htmlall':'UTF-8'}" title="{$banner_desc|escape:'htmlall':'UTF-8'}" width="1170" height="65" />
{else}
{$banner_desc|escape:'htmlall':'UTF-8'}
{/if}
</a>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -1,9 +0,0 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_1_1($object)
{
return ($object->registerHook('displayBanner') && $object->unregisterHook('displayTop'));
}

View File

@@ -1,93 +0,0 @@
{*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{extends file="helpers/form/form.tpl"}
{block name="field"}
{if $input.type == 'file_lang'}
<div class="col-lg-9">
{foreach from=$languages item=language}
{if $languages|count > 1}
<div class="translatable-field lang-{$language.id_lang}" {if $language.id_lang != $defaultFormLanguage}style="display:none"{/if}>
{/if}
<div class="form-group">
<div class="col-lg-6">
<input id="{$input.name}_{$language.id_lang}" type="file" name="{$input.name}_{$language.id_lang}" class="hide" />
<div class="dummyfile input-group">
<span class="input-group-addon"><i class="icon-file"></i></span>
<input id="{$input.name}_{$language.id_lang}-name" type="text" class="disabled" name="filename" readonly />
<span class="input-group-btn">
<button id="{$input.name}_{$language.id_lang}-selectbutton" type="button" name="submitAddAttachments" class="btn btn-default">
<i class="icon-folder-open"></i> {l s='Choose a file' mod='blockbanner'}
</button>
</span>
</div>
</div>
{if $languages|count > 1}
<div class="col-lg-2">
<button type="button" class="btn btn-default dropdown-toggle" tabindex="-1" data-toggle="dropdown">
{$language.iso_code}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
{foreach from=$languages item=lang}
<li><a href="javascript:hideOtherLanguage({$lang.id_lang});" tabindex="-1">{$lang.name}</a></li>
{/foreach}
</ul>
</div>
{/if}
</div>
<div class="form-group">
{if isset($fields_value[$input.name][$language.id_lang]) && $fields_value[$input.name][$language.id_lang] != ''}
<div id="{$input.name}-{$language.id_lang}-images-thumbnails" class="col-lg-12">
<img src="{$uri}img/{$fields_value[$input.name][$language.id_lang]}" class="img-thumbnail"/>
</div>
{/if}
</div>
{if $languages|count > 1}
</div>
{/if}
<script>
$(document).ready(function(){
$('#{$input.name}_{$language.id_lang}-selectbutton').click(function(e){
$('#{$input.name}_{$language.id_lang}').trigger('click');
});
$('#{$input.name}_{$language.id_lang}').change(function(e){
var val = $(this).val();
var file = val.split(/[\\/]/);
$('#{$input.name}_{$language.id_lang}-name').val(file[file.length-1]);
});
});
</script>
{/foreach}
{if isset($input.desc) && !empty($input.desc)}
<p class="help-block">
{$input.desc}
</p>
{/if}
</div>
{else}
{$smarty.block.parent}
{/if}
{/block}

View File

@@ -1,4 +0,0 @@
2014-04-22 18:56:53 +0200 // Changelog updated
2014-03-24 11:43:28 +0100 / MO blockbestsellers : ps_versions_compliancy modified (1.5.6.1 => 1.6)
2014-03-24 10:59:58 +0100 // MO blockbestsellers : ps_versions_compliancy added
2014-03-20 14:20:39 +0100 Initial commit

View File

@@ -1,37 +0,0 @@
# Top-sellers block
## About
Adds a block displaying your store\'s top-selling products.
## Contributing
PrestaShop modules are open-source extensions to the PrestaShop e-commerce solution. Everyone is welcome and even encouraged to contribute with their own improvements.
### Requirements
Contributors **must** follow the following rules:
* **Make your Pull Request on the "dev" branch**, NOT the "master" branch.
* Do not update the module's version number.
* Follow [the coding standards][1].
### Process in details
Contributors wishing to edit a module's files should follow the following process:
1. Create your GitHub account, if you do not have one already.
2. Fork the blockbestsellers project to your GitHub account.
3. Clone your fork to your local machine in the ```/modules``` directory of your PrestaShop installation.
4. Create a branch in your local clone of the module for your changes.
5. Change the files in your branch. Be sure to follow [the coding standards][1]!
6. Push your changed branch to your fork in your GitHub account.
7. Create a pull request for your changes **on the _'dev'_ branch** of the module's project. Be sure to follow [the commit message norm][2] in your pull request. If you need help to make a pull request, read the [Github help page about creating pull requests][3].
8. Wait for one of the core developers either to include your change in the codebase, or to comment on possible improvements you should make to your code.
That's it: you have contributed to this open-source project! Congratulations!
[1]: http://doc.prestashop.com/display/PS16/Coding+Standards
[2]: http://doc.prestashop.com/display/PS16/How+to+write+a+commit+message
[3]: https://help.github.com/articles/using-pull-requests

View File

@@ -1,273 +0,0 @@
<?php
/*
* 2007-2015 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-2015 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 BlockBestSellers extends Module
{
protected static $cache_best_sellers;
public function __construct()
{
$this->name = 'blockbestsellers';
$this->tab = 'front_office_features';
$this->version = '1.7.0';
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('Top-sellers block');
$this->description = $this->l('Adds a block displaying your store\'s top-selling products.');
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
}
public function install()
{
$this->_clearCache('*');
if (!parent::install()
|| !$this->registerHook('header')
|| !$this->registerHook('leftColumn')
|| !$this->registerHook('actionOrderStatusPostUpdate')
|| !$this->registerHook('addproduct')
|| !$this->registerHook('updateproduct')
|| !$this->registerHook('deleteproduct')
|| !$this->registerHook('displayHomeTab')
|| !$this->registerHook('displayHomeTabContent')
|| !ProductSale::fillProductSales()
)
return false;
Configuration::updateValue('PS_BLOCK_BESTSELLERS_TO_DISPLAY', 10);
return true;
}
public function uninstall()
{
$this->_clearCache('*');
return parent::uninstall();
}
public function hookAddProduct($params)
{
$this->_clearCache('*');
}
public function hookUpdateProduct($params)
{
$this->_clearCache('*');
}
public function hookDeleteProduct($params)
{
$this->_clearCache('*');
}
public function hookActionOrderStatusPostUpdate($params)
{
$this->_clearCache('*');
}
public function _clearCache($template, $cache_id = null, $compile_id = null)
{
parent::_clearCache('blockbestsellers.tpl', 'blockbestsellers-col');
parent::_clearCache('blockbestsellers-home.tpl', 'blockbestsellers-home');
parent::_clearCache('tab.tpl', 'blockbestsellers-tab');
}
/**
* Called in administration -> module -> configure
*/
public function getContent()
{
$output = '';
if (Tools::isSubmit('submitBestSellers'))
{
Configuration::updateValue('PS_BLOCK_BESTSELLERS_DISPLAY', (int)Tools::getValue('PS_BLOCK_BESTSELLERS_DISPLAY'));
Configuration::updateValue('PS_BLOCK_BESTSELLERS_TO_DISPLAY', (int)Tools::getValue('PS_BLOCK_BESTSELLERS_TO_DISPLAY'));
$this->_clearCache('*');
$output .= $this->displayConfirmation($this->l('Settings updated'));
}
return $output.$this->renderForm();
}
public function renderForm()
{
$fields_form = array(
'form' => array(
'legend' => array(
'title' => $this->l('Settings'),
'icon' => 'icon-cogs'
),
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Products to display'),
'name' => 'PS_BLOCK_BESTSELLERS_TO_DISPLAY',
'desc' => $this->l('Determine the number of product to display in this block'),
'class' => 'fixed-width-xs',
),
array(
'type' => 'switch',
'label' => $this->l('Always display this block'),
'name' => 'PS_BLOCK_BESTSELLERS_DISPLAY',
'desc' => $this->l('Show the block even if no best sellers are available.'),
'is_bool' => true,
'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')
)
)
);
$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 = 'submitBestSellers';
$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_BLOCK_BESTSELLERS_TO_DISPLAY' => (int)Tools::getValue('PS_BLOCK_BESTSELLERS_TO_DISPLAY', Configuration::get('PS_BLOCK_BESTSELLERS_TO_DISPLAY')),
'PS_BLOCK_BESTSELLERS_DISPLAY' => (int)Tools::getValue('PS_BLOCK_BESTSELLERS_DISPLAY', Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY')),
);
}
public function hookHeader($params)
{
if (Configuration::get('PS_CATALOG_MODE'))
return;
if (isset($this->context->controller->php_self) && $this->context->controller->php_self == 'index')
$this->context->controller->addCSS(_THEME_CSS_DIR_.'product_list.css');
$this->context->controller->addCSS($this->_path.'blockbestsellers.css', 'all');
}
public function hookDisplayHomeTab($params)
{
if (!$this->isCached('tab.tpl', $this->getCacheId('blockbestsellers-tab')))
{
BlockBestSellers::$cache_best_sellers = $this->getBestSellers($params);
$this->smarty->assign('best_sellers', BlockBestSellers::$cache_best_sellers);
}
if (BlockBestSellers::$cache_best_sellers === false)
return false;
return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('blockbestsellers-tab'));
}
public function hookDisplayHomeTabContent($params)
{
if (!$this->isCached('blockbestsellers-home.tpl', $this->getCacheId('blockbestsellers-home')))
{
$this->smarty->assign(array(
'best_sellers' => BlockBestSellers::$cache_best_sellers,
'homeSize' => Image::getSize(ImageType::getFormatedName('home'))
));
}
if (BlockBestSellers::$cache_best_sellers === false)
return false;
return $this->display(__FILE__, 'blockbestsellers-home.tpl', $this->getCacheId('blockbestsellers-home'));
}
public function hookRightColumn($params)
{
if (!$this->isCached('blockbestsellers.tpl', $this->getCacheId('blockbestsellers-col')))
{
if (!isset(BlockBestSellers::$cache_best_sellers))
BlockBestSellers::$cache_best_sellers = $this->getBestSellers($params);
$this->smarty->assign(array(
'best_sellers' => BlockBestSellers::$cache_best_sellers,
'display_link_bestsellers' => Configuration::get('PS_DISPLAY_BEST_SELLERS'),
'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
'smallSize' => Image::getSize(ImageType::getFormatedName('small'))
));
}
if (BlockBestSellers::$cache_best_sellers === false)
return false;
return $this->display(__FILE__, 'blockbestsellers.tpl', $this->getCacheId('blockbestsellers-col'));
}
public function hookLeftColumn($params)
{
return $this->hookRightColumn($params);
}
protected function getBestSellers($params)
{
if (Configuration::get('PS_CATALOG_MODE'))
return false;
if (!($result = ProductSale::getBestSalesLight((int)$params['cookie']->id_lang, 0, (int)Configuration::get('PS_BLOCK_BESTSELLERS_TO_DISPLAY'))))
return (Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY') ? array() : false);
$currency = new Currency($params['cookie']->id_currency);
$usetax = (Product::getTaxCalculationMethod((int)$this->context->customer->id) != PS_TAX_EXC);
foreach ($result as &$row)
$row['price'] = Tools::displayPrice(Product::getPriceStatic((int)$row['id_product'], $usetax), $currency);
return $result;
}
}

View File

@@ -1,19 +0,0 @@
{
"name": "PrestaShop/blockbestsellers",
"description": "PrestaShop module blockbestsellers",
"homepage": "https://github.com/PrestaShop/blockbestsellers",
"license": "AFL - Academic Free License (AFL 3.0)",
"authors": [
{
"name": "PrestaShop SA",
"email": "contact@prestashop.com"
}
],
"require": {
"php": ">=5.3.2"
},
"config": {
"preferred-install": "dist"
},
"type": "prestashop-module"
}

View File

@@ -1,55 +0,0 @@
/* Block best sellers */
#best-sellers_block_right ul {margin-bottom:5px}
#best-sellers_block_right li {
float:none;
padding:10px 0;
border-bottom:1px dotted #ccc
}
#best-sellers_block_right li.last_item {border:none}
#best-sellers_block_right li a.content_img {
display:block;
float:left;
padding:1px;
height:47px;
width:67px;
text-decoration:none;
background:#333
}
#best-sellers_block_right li span.number {
display:block;
float:left;
margin-top:6px;
width:20px;
font-weight:bold;
font-size:18px;
color:#fff;
text-align:center
}
#best-sellers_block_right li img {
border:1px solid #ededed;
}
#best-sellers_block_right li p {
float:left;
margin-left:7px;
padding:0;
width:125px;
font-weight:bold;
font-size:12px
}
#best-sellers_block_right li .price {
font-weight:bold;
font-size:14px;
color:#990000;
}
#best-sellers_block_right p.lnk {
padding:0;
text-align:right
}
#best-sellers_block_right .lnk .button_large {
padding:0;
border:none;
background:none
}
#best-sellers_block_right .lnk .button_large:hover {text-decoration:underline}

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2015 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-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 601 B

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2015 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-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2015 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-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -1,9 +0,0 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_1_2($object)
{
return ($object->registerHook('addproduct') && $object->registerHook('updateproduct') && $object->registerHook('deleteproduct') && $object->registerHook('actionOrderStatusPostUpdate'));
}

View File

@@ -1,9 +0,0 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_1_3($object)
{
return ($object->registerHook('displayHomeTab') && $object->registerHook('displayHomeTabContent'));
}

View File

@@ -1,33 +0,0 @@
<?php
/*
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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/osl-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-2015 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_1_5_5($object)
{
return Configuration::updateValue('PS_BLOCK_BESTSELLERS_TO_DISPLAY', 10);
}

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2015 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-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -1,32 +0,0 @@
{*
* 2007-2015 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-2015 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 isset($best_sellers) && $best_sellers}
{include file="$tpl_dir./product-list.tpl" products=$best_sellers class='blockbestsellers tab-pane' id='blockbestsellers'}
{else}
<ul id="blockbestsellers" class="blockbestsellers tab-pane">
<li class="alert alert-info">{l s='No best sellers at this time.' mod='blockbestsellers'}</li>
</ul>
{/if}

View File

@@ -1,69 +0,0 @@
{*
* 2007-2015 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-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<!-- MODULE Block best sellers -->
<div id="best-sellers_block_right" class="block products_block">
<h4 class="title_block">
<a href="{$link->getPageLink('best-sales')|escape:'html'}" title="{l s='View a top sellers products' mod='blockbestsellers'}">
{l s='Top sellers' mod='blockbestsellers'}
</a>
</h4>
<div class="block_content">
{if $best_sellers && $best_sellers|@count > 0}
<ul class="product_images">
{foreach from=$best_sellers item=product name=myLoop}
<li class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if} clearfix">
<a href="{$product.link|escape:'html'}" title="{$product.legend|escape:'html':'UTF-8'}" class="content_img clearfix">
<span class="number">{$smarty.foreach.myLoop.iteration}</span>
<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'small_default')|escape:'html'}"
height="{$smallSize.height}" width="{$smallSize.width}"
alt="{$product.legend|escape:'html':'UTF-8'}"/>
</a>
{if !$PS_CATALOG_MODE}
<p>
<a href="{$product.link|escape:'html'}" title="{$product.legend|escape:'html':'UTF-8'}">
{$product.name|strip_tags:'UTF-8'|escape:'html':'UTF-8'}<br/>
{if !$PS_CATALOG_MODE}
<span class="price">{$product.price}</span>
{hook h="displayProductPriceBlock" product=$product type="price"}
{/if}
</a>
</p>
{/if}
</li>
{/foreach}
</ul>
<p class="lnk"><a href="{$link->getPageLink('best-sales')|escape:'html'}"
title="{l s='All best sellers' mod='blockbestsellers'}"
class="button_large">&raquo; {l s='All best sellers' mod='blockbestsellers'}</a></p>
{else}
<p>{l s='No best sellers at this time' mod='blockbestsellers'}</p>
{/if}
</div>
</div>
<!-- /MODULE Block best sellers -->

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2015 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-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -1,25 +0,0 @@
{*
* 2007-2015 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-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<li><a data-toggle="tab" href="#blockbestsellers" class="blockbestsellers">{l s='Best Sellers' mod='blockbestsellers'}</a></li>

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2015 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-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -1,17 +0,0 @@
-----------------------------
# V2.9.4 to V2.9.5
-----------------------------
## Improved/Changed Features:
* [CO] : [#244] Changed Tools::jsonEncode to json_encode
2014-04-22 18:56:57 +0200 // Changelog updated
2014-04-01 14:17:21 +0200 // blockcategories new module version
2014-03-27 11:46:01 +0100 // follow up #PSCSX-1405 again
2014-03-27 11:18:52 +0100 // follow up #PSCSX-1405
2014-03-26 17:37:53 +0100 [-] MO : Blockcategories, Fix bug #PSCSX-1405, could not assign current category
2014-03-24 11:43:28 +0100 / MO blockcategories : ps_versions_compliancy modified (1.5.6.1 => 1.6)
2014-03-24 11:01:30 +0100 / MO blockcategories : ps_versions_compliancy added
2014-03-20 14:20:45 +0100 Initial commit

View File

@@ -1,518 +0,0 @@
<?php
/*
* 2007-2016 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-2016 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 BlockCategories extends Module
{
public function __construct()
{
$this->name = 'blockcategories';
$this->tab = 'front_office_features';
$this->version = '2.9.5';
$this->author = 'PrestaShop';
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('Categories block');
$this->description = $this->l('Adds a block featuring product categories.');
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.6.99.99');
}
public function install()
{
// Prepare tab
$tab = new Tab();
$tab->active = 1;
$tab->class_name = 'AdminBlockCategories';
$tab->name = array();
foreach (Language::getLanguages(true) as $lang)
$tab->name[$lang['id_lang']] = 'BlockCategories';
$tab->id_parent = -1;
$tab->module = $this->name;
if (!$tab->add() ||
!parent::install() ||
!$this->registerHook('footer') ||
!$this->registerHook('header') ||
!$this->registerHook('leftColumn') ||
// Temporary hooks. Do NOT hook any module on it. Some CRUD hook will replace them as soon as possible.
!$this->registerHook('categoryAddition') ||
!$this->registerHook('categoryUpdate') ||
!$this->registerHook('categoryDeletion') ||
!$this->registerHook('actionAdminMetaControllerUpdate_optionsBefore') ||
!$this->registerHook('actionAdminLanguagesControllerStatusBefore') ||
!$this->registerHook('displayBackOfficeCategory') ||
!Configuration::updateValue('BLOCK_CATEG_MAX_DEPTH', 4) ||
!Configuration::updateValue('BLOCK_CATEG_DHTML', 1) ||
!Configuration::updateValue('BLOCK_CATEG_ROOT_CATEGORY', 1))
return false;
return true;
}
public function uninstall()
{
$id_tab = (int)Tab::getIdFromClassName('AdminBlockCategories');
if ($id_tab)
{
$tab = new Tab($id_tab);
$tab->delete();
}
if (!parent::uninstall() ||
!Configuration::deleteByName('BLOCK_CATEG_MAX_DEPTH') ||
!Configuration::deleteByName('BLOCK_CATEG_DHTML') ||
!Configuration::deleteByName('BLOCK_CATEG_ROOT_CATEGORY'))
return false;
return true;
}
public function getContent()
{
$output = '';
if (Tools::isSubmit('submitBlockCategories'))
{
$maxDepth = (int)(Tools::getValue('BLOCK_CATEG_MAX_DEPTH'));
$dhtml = Tools::getValue('BLOCK_CATEG_DHTML');
$nbrColumns = Tools::getValue('BLOCK_CATEG_NBR_COLUMN_FOOTER', 4);
if ($maxDepth < 0)
$output .= $this->displayError($this->l('Maximum depth: Invalid number.'));
elseif ($dhtml != 0 && $dhtml != 1)
$output .= $this->displayError($this->l('Dynamic HTML: Invalid choice.'));
else
{
Configuration::updateValue('BLOCK_CATEG_MAX_DEPTH', (int)$maxDepth);
Configuration::updateValue('BLOCK_CATEG_DHTML', (int)$dhtml);
Configuration::updateValue('BLOCK_CATEG_NBR_COLUMN_FOOTER', (int)$nbrColumns);
Configuration::updateValue('BLOCK_CATEG_SORT_WAY', Tools::getValue('BLOCK_CATEG_SORT_WAY'));
Configuration::updateValue('BLOCK_CATEG_SORT', Tools::getValue('BLOCK_CATEG_SORT'));
Configuration::updateValue('BLOCK_CATEG_ROOT_CATEGORY', Tools::getValue('BLOCK_CATEG_ROOT_CATEGORY'));
$this->_clearBlockcategoriesCache();
Tools::redirectAdmin(AdminController::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&conf=6');
}
}
return $output.$this->renderForm();
}
public function getTree($resultParents, $resultIds, $maxDepth, $id_category = null, $currentDepth = 0)
{
if (is_null($id_category))
$id_category = $this->context->shop->getCategory();
$children = array();
if (isset($resultParents[$id_category]) && count($resultParents[$id_category]) && ($maxDepth == 0 || $currentDepth < $maxDepth))
foreach ($resultParents[$id_category] as $subcat)
$children[] = $this->getTree($resultParents, $resultIds, $maxDepth, $subcat['id_category'], $currentDepth + 1);
if (isset($resultIds[$id_category]))
{
$link = $this->context->link->getCategoryLink($id_category, $resultIds[$id_category]['link_rewrite']);
$name = $resultIds[$id_category]['name'];
$desc = $resultIds[$id_category]['description'];
}
else
$link = $name = $desc = '';
$return = array(
'id' => $id_category,
'link' => $link,
'name' => $name,
'desc'=> $desc,
'children' => $children
);
return $return;
}
public function hookDisplayBackOfficeCategory($params)
{
$category = new Category((int)Tools::getValue('id_category'));
$files = array();
if ($category->level_depth < 1)
return;
for ($i = 0; $i < 3; $i++)
{
if (file_exists(_PS_CAT_IMG_DIR_.(int)$category->id.'-'.$i.'_thumb.jpg'))
{
$files[$i]['type'] = HelperImageUploader::TYPE_IMAGE;
$files[$i]['image'] = ImageManager::thumbnail(_PS_CAT_IMG_DIR_.(int)$category->id.'-'.$i.'_thumb.jpg', $this->context->controller->table.'_'.(int)$category->id.'-'.$i.'_thumb.jpg', 100, 'jpg', true, true);
$files[$i]['delete_url'] = Context::getContext()->link->getAdminLink('AdminBlockCategories').'&deleteThumb='.$i.'&id_category='.(int)$category->id;
}
}
$images_types = ImageType::getImagesTypes('categories');
$formated_medium = ImageType::getFormatedName('medium');
foreach ($images_types as $k => $image_type)
if ($formated_medium == $image_type['name'])
$this->smarty->assign('format', $image_type);
$helper = new HelperImageUploader();
$helper->setMultiple(true)->setUseAjax(true)->setName('thumbnail')->setFiles($files)->setMaxFiles(3)->setUrl(
Context::getContext()->link->getAdminLink('AdminBlockCategories').'&ajax=1&id_category='.$category->id
.'&action=uploadThumbnailImages');
$this->smarty->assign('helper', $helper->render());
return $this->display(__FILE__, 'views/blockcategories_admin.tpl');
}
public function hookLeftColumn($params)
{
$this->setLastVisitedCategory();
$phpself = $this->context->controller->php_self;
$current_allowed_controllers = array('category');
if ($phpself != null && in_array($phpself, $current_allowed_controllers) && Configuration::get('BLOCK_CATEG_ROOT_CATEGORY') && isset($this->context->cookie->last_visited_category) && $this->context->cookie->last_visited_category)
{
$category = new Category($this->context->cookie->last_visited_category, $this->context->language->id);
if (Configuration::get('BLOCK_CATEG_ROOT_CATEGORY') == 2 && !$category->is_root_category && $category->id_parent)
$category = new Category($category->id_parent, $this->context->language->id);
elseif (Configuration::get('BLOCK_CATEG_ROOT_CATEGORY') == 3 && !$category->is_root_category && !$category->getSubCategories($category->id, true))
$category = new Category($category->id_parent, $this->context->language->id);
}
else
$category = new Category((int)Configuration::get('PS_HOME_CATEGORY'), $this->context->language->id);
$cacheId = $this->getCacheId($category ? $category->id : null);
if (!$this->isCached('blockcategories.tpl', $cacheId))
{
$range = '';
$maxdepth = Configuration::get('BLOCK_CATEG_MAX_DEPTH');
if (Validate::isLoadedObject($category))
{
if ($maxdepth > 0)
$maxdepth += $category->level_depth;
$range = 'AND nleft >= '.(int)$category->nleft.' AND nright <= '.(int)$category->nright;
}
$resultIds = array();
$resultParents = array();
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
FROM `'._DB_PREFIX_.'category` c
INNER JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.(int)$this->context->language->id.Shop::addSqlRestrictionOnLang('cl').')
INNER JOIN `'._DB_PREFIX_.'category_shop` cs ON (cs.`id_category` = c.`id_category` AND cs.`id_shop` = '.(int)$this->context->shop->id.')
WHERE (c.`active` = 1 OR c.`id_category` = '.(int)Configuration::get('PS_HOME_CATEGORY').')
AND c.`id_category` != '.(int)Configuration::get('PS_ROOT_CATEGORY').'
'.((int)$maxdepth != 0 ? ' AND `level_depth` <= '.(int)$maxdepth : '').'
'.$range.'
AND c.id_category IN (
SELECT id_category
FROM `'._DB_PREFIX_.'category_group`
WHERE `id_group` IN ('.pSQL(implode(', ', Customer::getGroupsStatic((int)$this->context->customer->id))).')
)
ORDER BY `level_depth` ASC, '.(Configuration::get('BLOCK_CATEG_SORT') ? 'cl.`name`' : 'cs.`position`').' '.(Configuration::get('BLOCK_CATEG_SORT_WAY') ? 'DESC' : 'ASC'));
foreach ($result as &$row)
{
$resultParents[$row['id_parent']][] = &$row;
$resultIds[$row['id_category']] = &$row;
}
$blockCategTree = $this->getTree($resultParents, $resultIds, $maxdepth, ($category ? $category->id : null));
$this->smarty->assign('blockCategTree', $blockCategTree);
if ((Tools::getValue('id_product') || Tools::getValue('id_category')) && isset($this->context->cookie->last_visited_category) && $this->context->cookie->last_visited_category)
{
$category = new Category($this->context->cookie->last_visited_category, $this->context->language->id);
if (Validate::isLoadedObject($category))
$this->smarty->assign(array('currentCategory' => $category, 'currentCategoryId' => $category->id));
}
$this->smarty->assign('isDhtml', Configuration::get('BLOCK_CATEG_DHTML'));
if (file_exists(_PS_THEME_DIR_.'modules/blockcategories/blockcategories.tpl'))
$this->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl');
else
$this->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl');
}
return $this->display(__FILE__, 'blockcategories.tpl', $cacheId);
}
protected function getCacheId($name = null)
{
$cache_id = parent::getCacheId();
if ($name !== null)
$cache_id .= '|'.$name;
if ((Tools::getValue('id_product') || Tools::getValue('id_category')) && isset($this->context->cookie->last_visited_category) && $this->context->cookie->last_visited_category)
$cache_id .= '|'.(int)$this->context->cookie->last_visited_category;
return $cache_id.'|'.implode('-', Customer::getGroupsStatic($this->context->customer->id));
}
public function setLastVisitedCategory()
{
$cache_id = 'blockcategories::setLastVisitedCategory';
if (!Cache::isStored($cache_id))
{
if (method_exists($this->context->controller, 'getCategory') && ($category = $this->context->controller->getCategory()))
$this->context->cookie->last_visited_category = $category->id;
elseif (method_exists($this->context->controller, 'getProduct') && ($product = $this->context->controller->getProduct()))
if (!isset($this->context->cookie->last_visited_category)
|| !Product::idIsOnCategoryId($product->id, array(array('id_category' => $this->context->cookie->last_visited_category)))
|| !Category::inShopStatic($this->context->cookie->last_visited_category, $this->context->shop))
$this->context->cookie->last_visited_category = (int)$product->id_category_default;
Cache::store($cache_id, $this->context->cookie->last_visited_category);
}
return Cache::retrieve($cache_id);
}
public function hookFooter($params)
{
$this->setLastVisitedCategory();
if (!$this->isCached('blockcategories_footer.tpl', $this->getCacheId()))
{
$maxdepth = Configuration::get('BLOCK_CATEG_MAX_DEPTH');
// Get all groups for this customer and concatenate them as a string: "1,2,3..."
$groups = implode(', ', Customer::getGroupsStatic((int)$this->context->customer->id));
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT DISTINCT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
FROM `'._DB_PREFIX_.'category` c
'.Shop::addSqlAssociation('category', 'c').'
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.(int)$this->context->language->id.Shop::addSqlRestrictionOnLang('cl').')
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)
WHERE (c.`active` = 1 OR c.`id_category` = '.(int)Configuration::get('PS_ROOT_CATEGORY').')
'.((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').'
AND cg.`id_group` IN ('.pSQL($groups).')
ORDER BY `level_depth` ASC, '.(Configuration::get('BLOCK_CATEG_SORT') ? 'cl.`name`' : 'category_shop.`position`').' '.(Configuration::get('BLOCK_CATEG_SORT_WAY') ? 'DESC' : 'ASC')))
return;
$resultParents = array();
$resultIds = array();
foreach ($result as &$row)
{
$resultParents[$row['id_parent']][] = &$row;
$resultIds[$row['id_category']] = &$row;
}
//$nbrColumns = Configuration::get('BLOCK_CATEG_NBR_COLUMNS_FOOTER');
$nbrColumns = (int)Configuration::get('BLOCK_CATEG_NBR_COLUMN_FOOTER');
if (!$nbrColumns or empty($nbrColumns))
$nbrColumns = 3;
$numberColumn = abs(count($result) / $nbrColumns);
$widthColumn = floor(100 / $nbrColumns);
$this->smarty->assign('numberColumn', $numberColumn);
$this->smarty->assign('widthColumn', $widthColumn);
$blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEG_MAX_DEPTH'));
unset($resultParents, $resultIds);
$isDhtml = (Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false);
$id_category = (int)Tools::getValue('id_category');
$id_product = (int)Tools::getValue('id_product');
$this->smarty->assign('blockCategTree', $blockCategTree);
if (file_exists(_PS_THEME_DIR_.'modules/blockcategories/blockcategories_footer.tpl'))
$this->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl');
else
$this->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl');
$this->smarty->assign('isDhtml', $isDhtml);
}
$display = $this->display(__FILE__, 'blockcategories_footer.tpl', $this->getCacheId());
return $display;
}
public function hookRightColumn($params)
{
return $this->hookLeftColumn($params);
}
public function hookHeader()
{
$this->context->controller->addJS(_THEME_JS_DIR_.'tools/treeManagement.js');
$this->context->controller->addCSS(($this->_path).'blockcategories.css', 'all');
}
private function _clearBlockcategoriesCache()
{
$this->_clearCache('blockcategories.tpl');
$this->_clearCache('blockcategories_footer.tpl');
}
public function hookCategoryAddition($params)
{
$this->_clearBlockcategoriesCache();
}
public function hookCategoryUpdate($params)
{
$this->_clearBlockcategoriesCache();
}
public function hookCategoryDeletion($params)
{
$this->_clearBlockcategoriesCache();
}
public function hookActionAdminMetaControllerUpdate_optionsBefore($params)
{
$this->_clearBlockcategoriesCache();
}
public function renderForm()
{
$fields_form = array(
'form' => array(
'legend' => array(
'title' => $this->l('Settings'),
'icon' => 'icon-cogs'
),
'input' => array(
array(
'type' => 'radio',
'label' => $this->l('Category root'),
'name' => 'BLOCK_CATEG_ROOT_CATEGORY',
'hint' => $this->l('Select which category is displayed in the block. The current category is the one the visitor is currently browsing.'),
'values' => array(
array(
'id' => 'home',
'value' => 0,
'label' => $this->l('Home category')
),
array(
'id' => 'current',
'value' => 1,
'label' => $this->l('Current category')
),
array(
'id' => 'parent',
'value' => 2,
'label' => $this->l('Parent category')
),
array(
'id' => 'current_parent',
'value' => 3,
'label' => $this->l('Current category, unless it has no subcategories, in which case the parent category of the current category is used')
),
)
),
array(
'type' => 'text',
'label' => $this->l('Maximum depth'),
'name' => 'BLOCK_CATEG_MAX_DEPTH',
'desc' => $this->l('Set the maximum depth of category sublevels displayed in this block (0 = infinite).'),
),
array(
'type' => 'switch',
'label' => $this->l('Dynamic'),
'name' => 'BLOCK_CATEG_DHTML',
'desc' => $this->l('Activate dynamic (animated) mode for category sublevels.'),
'values' => array(
array(
'id' => 'active_on',
'value' => 1,
'label' => $this->l('Enabled')
),
array(
'id' => 'active_off',
'value' => 0,
'label' => $this->l('Disabled')
)
),
),
array(
'type' => 'radio',
'label' => $this->l('Sort'),
'name' => 'BLOCK_CATEG_SORT',
'values' => array(
array(
'id' => 'name',
'value' => 1,
'label' => $this->l('By name')
),
array(
'id' => 'position',
'value' => 0,
'label' => $this->l('By position')
),
)
),
array(
'type' => 'radio',
'label' => $this->l('Sort order'),
'name' => 'BLOCK_CATEG_SORT_WAY',
'values' => array(
array(
'id' => 'name',
'value' => 1,
'label' => $this->l('Descending')
),
array(
'id' => 'position',
'value' => 0,
'label' => $this->l('Ascending')
),
)
),
array(
'type' => 'text',
'label' => $this->l('How many footer columns would you like?'),
'name' => 'BLOCK_CATEG_NBR_COLUMN_FOOTER',
),
),
'submit' => array(
'title' => $this->l('Save'),
)
),
);
$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;
$helper->identifier = $this->identifier;
$helper->submit_action = 'submitBlockCategories';
$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(
'BLOCK_CATEG_MAX_DEPTH' => Tools::getValue('BLOCK_CATEG_MAX_DEPTH', Configuration::get('BLOCK_CATEG_MAX_DEPTH')),
'BLOCK_CATEG_DHTML' => Tools::getValue('BLOCK_CATEG_DHTML', Configuration::get('BLOCK_CATEG_DHTML')),
'BLOCK_CATEG_NBR_COLUMN_FOOTER' => Tools::getValue('BLOCK_CATEG_NBR_COLUMN_FOOTER', Configuration::get('BLOCK_CATEG_NBR_COLUMN_FOOTER')),
'BLOCK_CATEG_SORT_WAY' => Tools::getValue('BLOCK_CATEG_SORT_WAY', Configuration::get('BLOCK_CATEG_SORT_WAY')),
'BLOCK_CATEG_SORT' => Tools::getValue('BLOCK_CATEG_SORT', Configuration::get('BLOCK_CATEG_SORT')),
'BLOCK_CATEG_ROOT_CATEGORY' => Tools::getValue('BLOCK_CATEG_ROOT_CATEGORY', Configuration::get('BLOCK_CATEG_ROOT_CATEGORY'))
);
}
}

View File

@@ -1,49 +0,0 @@
{*
* 2007-2016 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-2016 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 $blockCategTree && $blockCategTree.children|@count}
<!-- Block categories module -->
<div id="categories_block_left" class="block">
<h4 class="title_block">{if isset($currentCategory)}{$currentCategory->name|escape}{else}{l s='Categories' mod='blockcategories'}{/if}</h4>
<div class="block_content">
<ul class="tree {if $isDhtml}dhtml{/if}">
{foreach from=$blockCategTree.children item=child name=blockCategTree}
{if $smarty.foreach.blockCategTree.last}
{include file="$branche_tpl_path" node=$child last='true'}
{else}
{include file="$branche_tpl_path" node=$child}
{/if}
{/foreach}
</ul>
{* Javascript moved here to fix bug #PSCFI-151 *}
<script type="text/javascript">
// <![CDATA[
// we hide the tree only if JavaScript is activated
$('div#categories_block_left ul.dhtml').hide();
// ]]>
</script>
</div>
</div>
<!-- /Block categories module -->
{/if}

View File

@@ -1,55 +0,0 @@
{*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div class="blockcategories_footer">
<!-- Block categories module -->
<h4 class="title_block">{l s='Categories' mod='blockcategories'}</h4>
<div class="category_footer" style="float:left;clear:none;width:{$widthColumn}%">
<div style="float:left" class="list">
<ul class="tree {if $isDhtml}dhtml{/if}">
{foreach from=$blockCategTree.children item=child name=blockCategTree}
{if $smarty.foreach.blockCategTree.last}
{include file="$branche_tpl_path" node=$child last='true'}
{else}
{include file="$branche_tpl_path" node=$child}
{/if}
{if ($smarty.foreach.blockCategTree.iteration mod $numberColumn) == 0 AND !$smarty.foreach.blockCategTree.last}
</ul>
</div>
</div>
<div class="category_footer" style="float:left;clear:none;width:{$widthColumn}%">
<div style="float:left" class="list">
<ul class="tree {if $isDhtml}dhtml{/if}">
{/if}
{/foreach}
</ul>
</div>
</div>
<br class="clear"/>
<!-- /Block categories module -->
</div>

View File

@@ -1,40 +0,0 @@
{*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<li class="category_{$node.id}{if isset($last) && $last == 'true'} last{/if}">
<a href="{$node.link|escape:'html':'UTF-8'}" {if isset($currentCategoryId) && $node.id == $currentCategoryId}class="selected"{/if}
title="{$node.desc|strip_tags|trim|truncate:255:'...'|escape:'html':'UTF-8'}">{$node.name|escape:'html':'UTF-8'}</a>
{if $node.children|@count > 0}
<ul>
{foreach from=$node.children item=child name=categoryTreeBranch}
{if $smarty.foreach.categoryTreeBranch.last}
{include file="$branche_tpl_path" node=$child last='true'}
{else}
{include file="$branche_tpl_path" node=$child last='false'}
{/if}
{/foreach}
</ul>
{/if}
</li>

View File

@@ -1,119 +0,0 @@
<?php
/*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
/**
* @since 1.6.0
*/
class AdminBlockCategoriesController extends ModuleAdminController
{
public function postProcess()
{
if (($id_thumb = Tools::getValue('deleteThumb', false)) !== false)
{
if (file_exists(_PS_CAT_IMG_DIR_.(int)Tools::getValue('id_category').'-'.(int)$id_thumb.'_thumb.jpg')
&& !unlink(_PS_CAT_IMG_DIR_.(int)Tools::getValue('id_category').'-'.(int)$id_thumb.'_thumb.jpg'))
$this->context->controller->errors[] = Tools::displayError('Error while delete');
if (empty($this->context->controller->errors))
Tools::clearSmartyCache();
Tools::redirectAdmin(Context::getContext()->link->getAdminLink('AdminCategories').'&id_category='
.(int)Tools::getValue('id_category').'&updatecategory');
}
parent::postProcess();
}
public function ajaxProcessuploadThumbnailImages()
{
$category = new Category((int)Tools::getValue('id_category'));
if (isset($_FILES['thumbnail']))
{
//Get total of image already present in directory
$files = scandir(_PS_CAT_IMG_DIR_);
$assigned_keys = array();
$allowed_keys = array(0, 1, 2);
foreach ($files as $file) {
$matches = array();
if (preg_match('/^'.$category->id.'-([0-9])?_thumb.jpg/i', $file, $matches) === 1)
$assigned_keys[] = (int)$matches[1];
}
$available_keys = array_diff($allowed_keys, $assigned_keys);
$helper = new HelperImageUploader('thumbnail');
$files = $helper->process();
$total_errors = array();
if (count($available_keys) < count($files))
{
$total_errors['name'] = sprintf(Tools::displayError('An error occurred while uploading the image :'));
$total_errors['error'] = sprintf(Tools::displayError('You cannot upload more files'));
die(json_encode(array('thumbnail' => array($total_errors))));
}
foreach ($files as $key => &$file)
{
$id = array_shift($available_keys);
$errors = array();
// Evaluate the memory required to resize the image: if it's too much, you can't resize it.
if (isset($file['save_path']) && !ImageManager::checkImageMemoryLimit($file['save_path']))
$errors[] = Tools::displayError('Due to memory limit restrictions, this image cannot be loaded. Please increase your memory_limit value via your server\'s configuration settings. ');
// Copy new image
if (!isset($file['save_path']) || (empty($errors) && !ImageManager::resize($file['save_path'], _PS_CAT_IMG_DIR_
.(int)Tools::getValue('id_category').'-'.$id.'_thumb.jpg')))
$errors[] = Tools::displayError('An error occurred while uploading the image.');
if (count($errors))
$total_errors = array_merge($total_errors, $errors);
if (isset($file['save_path']) && is_file($file['save_path']))
unlink($file['save_path']);
//Necesary to prevent hacking
if (isset($file['save_path']))
unset($file['save_path']);
if (isset($file['tmp_name']))
unset($file['tmp_name']);
//Add image preview and delete url
$file['image'] = ImageManager::thumbnail(_PS_CAT_IMG_DIR_.(int)$category->id.'-'.$id.'_thumb.jpg',
$this->context->controller->table.'_'.(int)$category->id.'-'.$id.'_thumb.jpg', 100, 'jpg', true, true);
$file['delete_url'] = Context::getContext()->link->getAdminLink('AdminBlockCategories').'&deleteThumb='
.$id.'&id_category='.(int)$category->id.'&updatecategory';
}
if (count($total_errors))
$this->context->controller->errors = array_merge($this->context->controller->errors, $total_errors);
else
Tools::clearSmartyCache();
die(json_encode(array('thumbnail' => $files)));
}
}
}

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../../');

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 B

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../');

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1009 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -1,9 +0,0 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_2_1($object)
{
return $object->registerHook('displayBackOfficeCategory');
}

View File

@@ -1,25 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_2_9_1($object)
{
$id_tab = (int)Tab::getIdFromClassName('AdminBlockCategories');
if (!$id_tab) {
$tab = new Tab();
$tab->active = 1;
$tab->class_name = 'AdminBlockCategories';
$tab->name = array();
foreach (Language::getLanguages(true) as $lang) {
$tab->name[$lang['id_lang']] = 'BlockCategories';
}
$tab->id_parent = -1;
$tab->module = $object->name;
return $tab->add();
}
return true;
}

View File

@@ -1,37 +0,0 @@
{*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div class="form-group">
<label class="control-label col-lg-3">
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title="{l s='In the default theme, these images will be displayed in the top horizontal menu; but only if the category is one of the first level (see Top horizontal menu module for more info).' mod='blockcategories'}">
{l s='Menu thumbnails' mod='blockcategories'}
</span>
</label>
<div class="col-lg-4">
{$helper}
</div>
<div class="col-lg-6 col-lg-offset-3">
<div class="help-block">{l s='Recommended dimensions (for the default theme): %1spx x %2spx' sprintf=[$format.width, $format.height]}</div>
</div>
</div>

View File

@@ -1,623 +0,0 @@
<?php
/*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
class BlockCMSModel extends ObjectModel
{
public $id_cms_block;
public $id_cms_category;
public $location;
public $position;
public $display_store;
const LEFT_COLUMN = 0;
const RIGHT_COLUMN = 1;
const FOOTER = 2;
/**
* @see ObjectModel::$definition
*/
public static $definition = array(
'table' => 'cms_block',
'primary' => 'id_cms_block',
'fields' => array(
'id_cms_block' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'id_cms_category' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'location' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'position' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'display_store' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true)
),
);
public static function createTables()
{
return (
BlockCMSModel::createCMSBlockTable() &&
BlockCMSModel::createCMSBlockLangTable() &&
BlockCMSModel::createCMSBlockPageTable() &&
BlockCMSModel::createCMSBlockShopTable()
);
}
public static function dropTables()
{
$sql = 'DROP TABLE
`'._DB_PREFIX_.'cms_block`,
`'._DB_PREFIX_.'cms_block_page`,
`'._DB_PREFIX_.'cms_block_lang`,
`'._DB_PREFIX_.'cms_block_shop`';
return Db::getInstance()->execute($sql);
}
public static function createCMSBlockTable()
{
$sql = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'cms_block`(
`id_cms_block` int(10) unsigned NOT NULL auto_increment,
`id_cms_category` int(10) unsigned NOT NULL,
`location` tinyint(1) unsigned NOT NULL,
`position` int(10) unsigned NOT NULL default \'0\',
`display_store` tinyint(1) unsigned NOT NULL default \'1\',
PRIMARY KEY (`id_cms_block`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8';
return Db::getInstance()->execute($sql);
}
public static function createCMSBlockLangTable()
{
$sql = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'cms_block_lang`(
`id_cms_block` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(40) NOT NULL default \'\',
PRIMARY KEY (`id_cms_block`, `id_lang`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8';
return Db::getInstance()->execute($sql);
}
public static function createCMSBlockPageTable()
{
$sql = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'cms_block_page`(
`id_cms_block_page` int(10) unsigned NOT NULL auto_increment,
`id_cms_block` int(10) unsigned NOT NULL,
`id_cms` int(10) unsigned NOT NULL,
`is_category` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`id_cms_block_page`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8';
return Db::getInstance()->execute($sql);
}
public static function createCMSBlockShopTable()
{
$sql = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'cms_block_shop` (
`id_cms_block` int(10) unsigned NOT NULL auto_increment,
`id_shop` int(10) unsigned NOT NULL,
PRIMARY KEY (`id_cms_block`, `id_shop`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8';
return Db::getInstance()->execute($sql);
}
public static function insertCMSBlock($id_category, $location, $position, $display_store)
{
$sql = 'INSERT INTO `'._DB_PREFIX_.'cms_block` (`id_cms_category`, `location`, `position`, `display_store`)
VALUES('.(int)$id_category.', '.(int)$location.', '.(int)$position.', '.(int)$display_store.')';
if (Db::getInstance()->execute($sql))
return Db::getInstance()->Insert_ID();
return false;
}
public static function insertCMSBlockLang($id_cms_block, $id_lang)
{
$sql = 'INSERT INTO `'._DB_PREFIX_.'cms_block_lang` (`id_cms_block`, `id_lang`, `name`)
VALUES('.(int)$id_cms_block.', '.(int)$id_lang.', "'.pSQL(Tools::getValue('block_name_'.$id_lang)).'")';
Db::getInstance()->execute($sql);
return Db::getInstance()->Insert_ID();
}
public static function insertCMSBlockPage($id_cms_block, $id_cms, $is_category)
{
$sql = 'INSERT INTO `'._DB_PREFIX_.'cms_block_page` (`id_cms_block`, `id_cms`, `is_category`)
VALUES('.(int)$id_cms_block.', '.(int)$id_cms.', '.(int)$is_category.')';
Db::getInstance()->execute($sql);
return Db::getInstance()->Insert_ID();
}
public static function insertCMSBlockShop($id_cms_block, $id_shop)
{
$sql = 'INSERT INTO `'._DB_PREFIX_.'cms_block_shop` (`id_cms_block`, `id_shop`)
VALUES('.(int)$id_cms_block.', '.(int)$id_shop.')';
Db::getInstance()->execute($sql);
return Db::getInstance()->Insert_ID();
}
public static function updateCMSBlock($id_cms_block, $id_cms_category, $position, $location, $display_store)
{
$sql = 'UPDATE `'._DB_PREFIX_.'cms_block`
SET `location` = '.(int)$location.',
`id_cms_category` = '.(int)$id_cms_category.',
`position` = '.(int)$position.',
`display_store` = '.(int)$display_store.'
WHERE `id_cms_block` = '.(int)$id_cms_block;
Db::getInstance()->execute($sql);
}
public static function updatePositions($position, $new_position, $location)
{
$sql = 'UPDATE `'._DB_PREFIX_.'cms_block`
SET `position` = '.(int)$new_position.' WHERE `position` > '.(int)$position.'
AND `location` = '.(int)$location;
Db::getInstance()->execute($sql);
}
public static function updateCMSBlockPositions($id_cms_block, $position, $new_position, $location)
{
$query = 'UPDATE `'._DB_PREFIX_.'cms_block`
SET `position` = '.(int)$new_position.'
WHERE `position` = '.(int)$position.'
AND `location` = '.(int)$location;
$sub_query = 'UPDATE `'._DB_PREFIX_.'cms_block`
SET `position` = '.(int)$position.'
WHERE `id_cms_block` = '.(int)$id_cms_block;
if (Db::getInstance()->execute($query))
Db::getInstance()->execute($sub_query);
}
public static function updateCMSBlockPosition($id_cms_block, $position)
{
$query = 'UPDATE `'._DB_PREFIX_.'cms_block`
SET `position` = '.(int)$position.'
WHERE `id_cms_block` = '.(int)$id_cms_block;
Db::getInstance()->execute($query);
}
public static function updateCMSBlockLang($id_cms_block, $block_name, $id_lang)
{
$sql = 'UPDATE `'._DB_PREFIX_.'cms_block_lang`
SET `name` = "'.pSQL($block_name).'"
WHERE `id_cms_block` = '.(int)$id_cms_block.'
AND `id_lang`= '.(int)$id_lang;
Db::getInstance()->execute($sql);
}
public static function updateDisplayStores($display_store)
{
$sql = 'UPDATE `'._DB_PREFIX_.'cms_block`
SET `display_store` = '.(int)$display_store;
Db::getInstance()->execute($sql);
}
public static function deleteCMSBlock($id_cms_block)
{
$sql = 'DELETE FROM `'._DB_PREFIX_.'cms_block`
WHERE `id_cms_block` = '.(int)$id_cms_block;
Db::getInstance()->execute($sql);
}
public static function deleteCMSBlockPage($id_cms_block)
{
$sql = 'DELETE FROM `'._DB_PREFIX_.'cms_block_page`
WHERE `id_cms_block` = '.(int)$id_cms_block;
Db::getInstance()->execute($sql);
}
public static function getMaxPosition($location)
{
$sql = 'SELECT COUNT(*)
FROM `'._DB_PREFIX_.'cms_block`
WHERE `location` = '.(int)$location;
return Db::getInstance()->getValue($sql);
}
public static function getCMSTitlesFooter()
{
$context = Context::getContext();
$footerCms = Configuration::get('FOOTER_CMS');
if (empty($footerCms))
return array();
$cmsCategories = explode('|', $footerCms);
foreach ($cmsCategories as $cmsCategory)
{
$ids = explode('_', $cmsCategory);
if ($ids[0] == 1 && isset($ids[1]))
{
$query = BlockCMSModel::getBlockName($ids[1]);
$content[$cmsCategory]['link'] = $context->link->getCMSCategoryLink((int)$ids[1], $query['link_rewrite']);
$content[$cmsCategory]['meta_title'] = $query['name'];
}
else if ($ids[0] == 0 && isset($ids[1]))
{
$query = BlockCMSModel::getCMSMetaTitle($ids[1]);
$content[$cmsCategory]['link'] = $context->link->getCMSLink((int)$ids[1], $query['link_rewrite']);
$content[$cmsCategory]['meta_title'] = $query['meta_title'];
}
}
return $content;
}
public static function getBlockName($id)
{
$sql = 'SELECT cl.`name`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms_category_lang` cl
INNER JOIN `'._DB_PREFIX_.'cms_category` c
ON (cl.`id_cms_category` = c.`id_cms_category`)
WHERE cl.`id_cms_category` = '.(int)$id.'
AND (c.`active` = 1 OR c.`id_cms_category` = 1)
AND cl.`id_lang` = '.(int)Context::getContext()->language->id;
return Db::getInstance()->getRow($sql);
}
public static function getBlockMetaTitle($id)
{
$sql = 'SELECT cl.`name`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms_category_lang` cl
INNER JOIN `'._DB_PREFIX_.'cms_category` c
ON (cl.`id_cms_category` = c.`id_cms_category`)
WHERE cl.`id_cms_category` = '.(int)$id.'
AND (c.`active` = 1 OR c.`id_cms_category` = 1)
AND cl.`id_lang` = '.(int)Context::getContext()->language->id;
return Db::getInstance()->getRow($sql);
}
public static function getCMSMetaTitle($id)
{
$context = Context::getContext();
$id_shop = (int)$context->shop->id;
$where_shop = '';
if (Tools::version_compare(_PS_VERSION_, '1.6.0.12', '>=') == true && $id_shop != false) {
$where_shop = ' AND cl.`id_shop` = '.(int)$id_shop;
}
$sql = 'SELECT cl.`meta_title`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms_lang` cl
INNER JOIN `'._DB_PREFIX_.'cms` c
ON (cl.`id_cms` = c.`id_cms`)
WHERE cl.`id_cms` = '.(int)$id.'
AND (c.`active` = 1 OR c.`id_cms` = 1)'.
$where_shop.'
AND cl.`id_lang` = '.(int)Context::getContext()->language->id;
return Db::getInstance()->getRow($sql);
}
public static function getCMSCategoriesByLocation($location, $id_shop = false)
{
$context = Context::getContext();
$id_shop = ($id_shop != false) ? $id_shop : $context->shop->id;
$where_shop = '';
if (Tools::version_compare(_PS_VERSION_, '1.6.0.12', '>=') == true && $id_shop != false)
$where_shop = ' AND ccl.`id_shop` = '.(int)$id_shop;
$sql = 'SELECT bc.`id_cms_block`, bc.`id_cms_category`, bc.`display_store`, ccl.`link_rewrite`, ccl.`name` category_name, bcl.`name` block_name
FROM `'._DB_PREFIX_.'cms_block` bc
LEFT JOIN `'._DB_PREFIX_.'cms_block_shop` bcs
ON (bcs.id_cms_block = bc.id_cms_block)
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` ccl
ON (bc.`id_cms_category` = ccl.`id_cms_category`)
INNER JOIN `'._DB_PREFIX_.'cms_block_lang` bcl
ON (bc.`id_cms_block` = bcl.`id_cms_block`)
WHERE bc.`location` = '.(int)$location.'
AND ccl.`id_lang` = '.(int)$context->language->id.'
AND bcl.`id_lang` = '.(int)$context->language->id.'
AND bcs.id_shop = '.($id_shop ? (int)$id_shop : (int)$context->shop->id).
$where_shop.'
ORDER BY `position`';
return Db::getInstance()->executeS($sql);
}
public static function getCMSPages($id_cms_category, $id_shop = false)
{
$id_shop = ($id_shop != false) ? $id_shop : Context::getContext()->shop->id;
$where_shop = '';
if (Tools::version_compare(_PS_VERSION_, '1.6.0.12', '>=') == true && $id_shop != false)
$where_shop = ' AND cl.`id_shop` = '.(int)$id_shop;
$sql = 'SELECT c.`id_cms`, cl.`meta_title`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms` c
INNER JOIN `'._DB_PREFIX_.'cms_shop` cs
ON (c.`id_cms` = cs.`id_cms`)
INNER JOIN `'._DB_PREFIX_.'cms_lang` cl
ON (c.`id_cms` = cl.`id_cms`)
WHERE c.`id_cms_category` = '.(int)$id_cms_category.'
AND cs.`id_shop` = '.(int)$id_shop.'
AND cl.`id_lang` = '.(int)Context::getContext()->language->id.
$where_shop.'
AND c.`active` = 1
ORDER BY `position`';
return Db::getInstance()->executeS($sql);
}
public static function getCMSBlockPages($id_block, $id_shop = false)
{
$id_shop = ($id_shop != false) ? $id_shop : Context::getContext()->shop->id;
$where_shop = '';
if (Tools::version_compare(_PS_VERSION_, '1.6.0.12', '>=') == true && $id_shop != false)
$where_shop = ' AND cl.`id_shop` = '.(int)$id_shop;
$sql = 'SELECT cl.`id_cms`, cl.`meta_title`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms_block_page` bcp
INNER JOIN `'._DB_PREFIX_.'cms_lang` cl
ON (bcp.`id_cms` = cl.`id_cms`)
INNER JOIN `'._DB_PREFIX_.'cms` c
ON (bcp.`id_cms` = c.`id_cms`)
INNER JOIN `'._DB_PREFIX_.'cms_shop` cs
ON (c.`id_cms` = cs.`id_cms`)
WHERE bcp.`id_cms_block` = '.(int)$id_block.'
AND cs.`id_shop` = '.(int)$id_shop.'
AND cl.`id_lang` = '.(int)Context::getContext()->language->id.
$where_shop.'
AND bcp.`is_category` = 0
AND c.`active` = 1
ORDER BY `position`';
return Db::getInstance()->executeS($sql);
}
public static function getCMSBlockPagesCategories($id_cms_block)
{
$sql = 'SELECT bcp.`id_cms`, cl.`name`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms_block_page` bcp
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` cl
ON (bcp.`id_cms` = cl.`id_cms_category`)
WHERE bcp.`id_cms_block` = '.(int)$id_cms_block.'
AND cl.`id_lang` = '.(int)Context::getContext()->language->id.'
AND bcp.`is_category` = 1';
return Db::getInstance()->executeS($sql);
}
public static function getCMSCategories($recursive = false, $parent = 0, $id_shop = false)
{
$id_shop = ($id_shop != false) ? $id_shop : Context::getContext()->shop->id;
$join_shop = '';
$where_shop = '';
if (Tools::version_compare(_PS_VERSION_, '1.6.0.12', '>=') == true)
{
$join_shop = ' INNER JOIN `'._DB_PREFIX_.'cms_category_shop` cs
ON (bcp.`id_cms_category` = cs.`id_cms_category`)';
$where_shop = ' AND cs.`id_shop` = '.(int)$id_shop.' AND cl.`id_shop` = '.(int)$id_shop;
}
if ($recursive === false)
{
$sql = 'SELECT bcp.`id_cms_category`, bcp.`id_parent`, bcp.`level_depth`, bcp.`active`, bcp.`position`, cl.`name`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms_category` bcp'.
$join_shop.'
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` cl
ON (bcp.`id_cms_category` = cl.`id_cms_category`)
WHERE cl.`id_lang` = '.(int)Context::getContext()->language->id.
$where_shop;
if ($parent)
$sql .= ' AND bcp.`id_parent` = '.(int)$parent;
return Db::getInstance()->executeS($sql);
}
else
{
$sql = 'SELECT bcp.`id_cms_category`, bcp.`id_parent`, bcp.`level_depth`, bcp.`active`, bcp.`position`, cl.`name`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms_category` bcp'.
$join_shop.'
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` cl
ON (bcp.`id_cms_category` = cl.`id_cms_category`)
WHERE cl.`id_lang` = '.(int)Context::getContext()->language->id.
$where_shop;
if ($parent)
$sql .= ' AND bcp.`id_parent` = '.(int)$parent;
$results = Db::getInstance()->executeS($sql);
foreach ($results as $result)
{
$sub_categories = BlockCMSModel::getCMSCategories(true, $result['id_cms_category']);
if ($sub_categories && count($sub_categories) > 0)
$result['sub_categories'] = $sub_categories;
$categories[] = $result;
}
return isset($categories) ? $categories : false;
}
}
/* Get a single CMS block by its ID */
public static function getBlockCMS($id_cms_block)
{
$sql = 'SELECT cb.`id_cms_category`, cb.`location`, cb.`position`, cb.`display_store`, cbl.id_lang, cbl.name
FROM `'._DB_PREFIX_.'cms_block` cb
LEFT JOIN `'._DB_PREFIX_.'cms_block_lang` cbl
ON (cbl.`id_cms_block` = cb.`id_cms_block`)
WHERE cb.`id_cms_block` = '.(int)$id_cms_block;
$cmsBlocks = Db::getInstance()->executeS($sql);
foreach ($cmsBlocks as $cmsBlock)
{
$results[(int)$cmsBlock['id_lang']] = $cmsBlock;
$restuls[(int)$cmsBlock['id_lang']]['name'] = $cmsBlock['name'];
}
return $results;
}
/* Get all CMS blocks by location */
public static function getCMSBlocksByLocation($location, $id_shop = false)
{
$context = Context::getContext();
$id_shop = ($id_shop != false) ? $id_shop : $context->shop->id;
$where_shop = '';
if (Tools::version_compare(_PS_VERSION_, '1.6.0.12', '>=') == true && $id_shop != false)
$where_shop = ' AND ccl.`id_shop` = '.$id_shop;
$sql = 'SELECT bc.`id_cms_block`, bcl.`name` block_name, ccl.`name` category_name, bc.`position`, bc.`id_cms_category`, bc.`display_store`
FROM `'._DB_PREFIX_.'cms_block` bc
LEFT JOIN `'._DB_PREFIX_.'cms_block_shop` bcs
ON (bcs.id_cms_block = bc.id_cms_block)
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` ccl
ON (bc.`id_cms_category` = ccl.`id_cms_category`)
INNER JOIN `'._DB_PREFIX_.'cms_block_lang` bcl
ON (bc.`id_cms_block` = bcl.`id_cms_block`)
WHERE ccl.`id_lang` = '.(int)Context::getContext()->language->id.'
AND bcl.`id_lang` = '.(int)Context::getContext()->language->id.'
AND bc.`location` = '.(int)$location.
$where_shop.'
AND bcs.id_shop = '.$id_shop.'
ORDER BY bc.`position`';
return Db::getInstance()->executeS($sql);
}
/* Get all CMS blocks */
public static function getCMSBlocks()
{
$sql = 'SELECT bc.`id_cms_block`, bcl.`name` block_name, ccl.`name` category_name, bc.`position`, bc.`id_cms_category`, bc.`display_store`
FROM `'._DB_PREFIX_.'cms_block` bc
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` ccl
ON (bc.`id_cms_category` = ccl.`id_cms_category`)
INNER JOIN `'._DB_PREFIX_.'cms_block_lang` bcl
ON (bc.`id_cms_block` = bcl.`id_cms_block`)
WHERE ccl.`id_lang` = '.(int)Context::getContext()->language->id.'
AND bcl.`id_lang` = '.(int)Context::getContext()->language->id.'
ORDER BY bc.`position`';
return Db::getInstance()->executeS($sql);
}
/* Get all CMS blocks */
public static function getAllCMSStructure($id_shop = false)
{
$id_shop = ($id_shop != false) ? $id_shop : Context::getContext()->shop->id;
$categories = BlockCMSModel::getCMSCategories(false, 0, $id_shop);
foreach ($categories as $key => $value)
$categories[$key]['cms_pages'] = BlockCMSModel::getCMSPages($value['id_cms_category'], $id_shop);
return $categories;
}
public static function getAllCMSTitles()
{
$titles = array_merge(
BlockCMSModel::getCMSTitles(BlockCMSModel::LEFT_COLUMN),
BlockCMSModel::getCMSTitles(BlockCMSModel::RIGHT_COLUMN)
);
foreach ($titles as $key => $title)
{
unset(
$titles[$key]['category_link'],
$titles[$key]['category_name'],
$titles[$key]['categories'],
$titles[$key]['name']
);
}
return $titles;
}
public static function getCMSTitles($location, $id_shop = false)
{
$content = array();
$context = Context::getContext();
$cmsCategories = BlockCMSModel::getCMSCategoriesByLocation($location, $id_shop);
if (is_array($cmsCategories) && count($cmsCategories))
{
foreach ($cmsCategories as $cmsCategory)
{
$key = (int)$cmsCategory['id_cms_block'];
$content[$key]['display_store'] = $cmsCategory['display_store'];
$content[$key]['cms'] = BlockCMSModel::getCMSBlockPages($cmsCategory['id_cms_block'], $id_shop);
$links = array();
if (count($content[$key]['cms']))
{
foreach ($content[$key]['cms'] as $row)
{
$row['link'] = $context->link->getCMSLink((int)$row['id_cms'], $row['link_rewrite']);
$links[] = $row;
}
}
$content[$key]['cms'] = $links;
$content[$key]['categories'] = BlockCMSModel::getCMSBlockPagesCategories($cmsCategory['id_cms_block']);
$links = array();
if (count($content[$key]['categories']))
{
foreach ($content[$key]['categories'] as $row)
{
$row['link'] = $context->link->getCMSCategoryLink((int)$row['id_cms'], $row['link_rewrite']);
$links[] = $row;
}
}
$content[$key]['categories'] = $links;
$content[$key]['name'] = $cmsCategory['block_name'];
$content[$key]['category_link'] = $context->link->getCMSCategoryLink((int)$cmsCategory['id_cms_category'], $cmsCategory['link_rewrite']);
$content[$key]['category_name'] = $cmsCategory['category_name'];
}
}
return $content;
}
}

View File

@@ -1,9 +0,0 @@
2014-04-22 18:56:59 +0200 // Changelog updated
2014-04-03 19:04:37 +0200 // blockcms, unassigned vars #PSCSX-1424
2014-03-28 10:19:50 +0100 // added default value for new configuration options
2014-03-26 12:42:47 +0100 [*] MO : blockcms : options added to display each links
2014-03-24 12:20:38 +0100 Merge branch 'master' of https://github.com/PrestaShop/blockcms
2014-03-24 11:43:28 +0100 / MO blockcms : ps_versions_compliancy modified (1.5.6.1 => 1.6)
2014-03-24 11:01:34 +0100 / MO blockcms : ps_versions_compliancy added
2014-03-24 10:54:46 +0100 [*] BO : updating labels and descriptions for blockcms.
2014-03-20 14:20:55 +0100 Initial commit

View File

@@ -1,930 +0,0 @@
<?php
/*
* 2007-2016 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-2016 PrestaShop SA
* @version Release: $Revision: 7060 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_CAN_LOAD_FILES_'))
exit;
include_once(dirname(__FILE__) . '/BlockCMSModel.php');
class BlockCms extends Module
{
protected $_html;
protected $_display;
public function __construct()
{
$this->name = 'blockcms';
$this->tab = 'front_office_features';
$this->version = '2.1.2';
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('CMS block');
$this->description = $this->l('Adds a block with several CMS links.');
$this->secure_key = Tools::encrypt($this->name);
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.6.99.99');
}
public function install()
{
if (!parent::install()
|| !$this->registerHook('leftColumn')
|| !$this->registerHook('rightColumn')
|| !$this->registerHook('header')
|| !$this->registerHook('footer')
|| !$this->registerHook('actionObjectCmsUpdateAfter')
|| !$this->registerHook('actionObjectCmsDeleteAfter')
|| !$this->registerHook('actionShopDataDuplication')
|| !$this->registerHook('actionAdminStoresControllerUpdate_optionsAfter')
|| !BlockCMSModel::createTables()
|| !Configuration::updateValue('FOOTER_CMS', '')
|| !Configuration::updateValue('FOOTER_BLOCK_ACTIVATION', 1)
|| !Configuration::updateValue('FOOTER_POWEREDBY', 1)
|| !Configuration::updateValue('FOOTER_PRICE-DROP', 1)
|| !Configuration::updateValue('FOOTER_NEW-PRODUCTS', 1)
|| !Configuration::updateValue('FOOTER_BEST-SALES', 1)
|| !Configuration::updateValue('FOOTER_CONTACT', 1)
|| !Configuration::updateValue('FOOTER_SITEMAP', 1)
)
return false;
$this->_clearCache('blockcms.tpl');
// Install fixtures for blockcms
$default = Db::getInstance()->insert('cms_block', array(
'id_cms_category' => 1,
'location' => 0,
'position' => 0,
));
if (!$default)
return false;
$result = true;
$id_cms_block = Db::getInstance()->Insert_ID();
$shops = Shop::getShops(true, null, true);
foreach ($shops as $shop)
$result &= Db::getInstance()->insert('cms_block_shop', array(
'id_cms_block' => $id_cms_block,
'id_shop' => $shop
));
$languages = Language::getLanguages(false);
foreach ($languages as $lang)
$result &= Db::getInstance()->insert('cms_block_lang', array(
'id_cms_block' => $id_cms_block,
'id_lang' => $lang['id_lang'],
'name' => $this->l('Information'),
));
$pages = CMS::getCMSPages(null, 1);
foreach ($pages as $cms)
$result &= Db::getInstance()->insert('cms_block_page', array(
'id_cms_block' => $id_cms_block,
'id_cms' => $cms['id_cms'],
'is_category' => 0,
));
return $result;
}
public function uninstall()
{
$this->_clearCache('blockcms.tpl');
if (!parent::uninstall() ||
!BlockCMSModel::DropTables() ||
!Configuration::deleteByName('FOOTER_CMS') ||
!Configuration::deleteByName('FOOTER_BLOCK_ACTIVATION') ||
!Configuration::deleteByName('FOOTER_POWEREDBY') ||
!Configuration::deleteByName('FOOTER_PRICE-DROP') ||
!Configuration::deleteByName('FOOTER_NEW-PRODUCTS') ||
!Configuration::deleteByName('FOOTER_BEST-SALES') ||
!Configuration::deleteByName('FOOTER_CONTACT') ||
!Configuration::deleteByName('FOOTER_SITEMAP')
)
return false;
return true;
}
public function initToolbar()
{
$current_index = AdminController::$currentIndex;
$token = Tools::getAdminTokenLite('AdminModules');
$back = Tools::safeOutput(Tools::getValue('back', ''));
if (!isset($back) || empty($back))
$back = $current_index.'&amp;configure='.$this->name.'&token='.$token;
switch ($this->_display)
{
case 'add':
$this->toolbar_btn['cancel'] = array(
'href' => $back,
'desc' => $this->l('Cancel')
);
break;
case 'edit':
$this->toolbar_btn['cancel'] = array(
'href' => $back,
'desc' => $this->l('Cancel')
);
break;
case 'index':
$this->toolbar_btn['new'] = array(
'href' => $current_index.'&amp;configure='.$this->name.'&amp;token='.$token.'&amp;addBlockCMS',
'desc' => $this->l('Add new')
);
break;
default:
break;
}
return $this->toolbar_btn;
}
protected function displayForm()
{
$this->context->controller->addJqueryPlugin('tablednd');
if (version_compare(_PS_VERSION_, '1.6.0.11', '>=') === true)
$this->context->controller->addJS(_PS_JS_DIR_.'admin/dnd.js');
else
$this->context->controller->addJS(_PS_JS_DIR_.'admin-dnd.js');
$current_index = AdminController::$currentIndex;
$token = Tools::getAdminTokenLite('AdminModules');
$this->_display = 'index';
$this->fields_form[0]['form'] = array(
'legend' => array(
'title' => $this->l('CMS block configuration'),
'icon' => 'icon-list-alt'
),
'input' => array(
array(
'type' => 'cms_blocks',
'label' => $this->l('CMS Blocks'),
'name' => 'cms_blocks',
'values' => array(
0 => BlockCMSModel::getCMSBlocksByLocation(BlockCMSModel::LEFT_COLUMN, Shop::getContextShopID()),
1 => BlockCMSModel::getCMSBlocksByLocation(BlockCMSModel::RIGHT_COLUMN, Shop::getContextShopID()))
)
),
'buttons' => array(
'newBlock' => array(
'title' => $this->l('New block'),
'href' => $current_index.'&amp;configure='.$this->name.'&amp;token='.$token.'&amp;addBlockCMS',
'class' => 'pull-right',
'icon' => 'process-icon-new'
)
)
);
$this->fields_form[1]['form'] = array(
'tinymce' => true,
'legend' => array(
'title' => $this->l('Configuration of the various links in the footer'),
'icon' => 'icon-link'
),
'input' => array(
array(
'type' => 'checkbox',
'name' => 'cms_footer',
'values' => array(
'query' => array(
array(
'id' => 'on',
'name' => $this->l('Display various links and information in the footer'),
'val' => '1'
),
),
'id' => 'id',
'name' => 'name'
)
),
array(
'type' => 'cms_pages',
'label' => $this->l('Footer links'),
'name' => 'footerBox[]',
'values' => BlockCMSModel::getAllCMSStructure(),
'desc' => $this->l('Please mark every page that you want to display in the footer CMS block.')
),
array(
'type' => 'textarea',
'label' => $this->l('Footer information'),
'name' => 'footer_text',
'rows' => 5,
'cols' => 60,
'lang' => true
),
array(
'type' => 'checkbox',
'name' => 'PS_STORES_DISPLAY_FOOTER',
'values' => array(
'query' => array(
array(
'id' => 'on',
'name' => $this->l('Display "Our stores" link in the footer'),
'val' => '1'
),
),
'id' => 'id',
'name' => 'name'
)
),
array(
'type' => 'checkbox',
'name' => 'cms_footer_display_price-drop',
'values' => array(
'query' => array(
array(
'id' => 'on',
'name' => $this->l('Display "Price drop" link in the footer'),
'val' => '1'
),
),
'id' => 'id',
'name' => 'name'
)
),
array(
'type' => 'checkbox',
'name' => 'cms_footer_display_new-products',
'values' => array(
'query' => array(
array(
'id' => 'on',
'name' => $this->l('Display "New products" link in the footer'),
'val' => '1'
),
),
'id' => 'id',
'name' => 'name'
)
),
array(
'type' => 'checkbox',
'name' => 'cms_footer_display_best-sales',
'values' => array(
'query' => array(
array(
'id' => 'on',
'name' => $this->l('Display "Best sales" link in the footer'),
'val' => '1'
),
),
'id' => 'id',
'name' => 'name'
)
),
array(
'type' => 'checkbox',
'name' => 'cms_footer_display_contact',
'values' => array(
'query' => array(
array(
'id' => 'on',
'name' => $this->l('Display "Contact us" link in the footer'),
'val' => '1'
),
),
'id' => 'id',
'name' => 'name'
)
),
array(
'type' => 'checkbox',
'name' => 'cms_footer_display_sitemap',
'values' => array(
'query' => array(
array(
'id' => 'on',
'name' => $this->l('Display sitemap link in the footer'),
'val' => '1'
),
),
'id' => 'id',
'name' => 'name'
)
),
array(
'type' => 'checkbox',
'name' => 'cms_footer_powered_by',
'values' => array(
'query' => array(
array(
'id' => 'on',
'name' => $this->l('Display "Powered by PrestaShop" in the footer'),
'val' => '1'
),
),
'id' => 'id',
'name' => 'name'
)
)
),
'submit' => array(
'name' => 'submitFooterCMS',
'title' => $this->l('Save'),
)
);
$this->context->controller->getLanguages();
$tmp = Configuration::get('FOOTER_CMS');
$footer_boxes = explode('|', $tmp);
if ($footer_boxes && is_array($footer_boxes))
foreach ($footer_boxes as $key => $value)
$this->fields_value[$value] = true;
$this->fields_value['cms_footer_on'] = Configuration::get('FOOTER_BLOCK_ACTIVATION');
$this->fields_value['cms_footer_powered_by_on'] = Configuration::get('FOOTER_POWEREDBY');
$this->fields_value['PS_STORES_DISPLAY_FOOTER_on'] = Configuration::get('PS_STORES_DISPLAY_FOOTER');
$this->fields_value['cms_footer_display_price-drop_on'] = Configuration::get('FOOTER_PRICE-DROP');
$this->fields_value['cms_footer_display_new-products_on'] = Configuration::get('FOOTER_NEW-PRODUCTS');
$this->fields_value['cms_footer_display_best-sales_on'] = Configuration::get('FOOTER_BEST-SALES');
$this->fields_value['cms_footer_display_contact_on'] = Configuration::get('FOOTER_CONTACT');
$this->fields_value['cms_footer_display_sitemap_on'] = Configuration::get('FOOTER_SITEMAP');
foreach ($this->context->controller->_languages as $language)
{
$footer_text = Configuration::get('FOOTER_CMS_TEXT_'.$language['id_lang']);
$this->fields_value['footer_text'][$language['id_lang']] = $footer_text;
}
$helper = $this->initForm();
$helper->submit_action = '';
$helper->title = $this->l('CMS Block configuration');
$helper->fields_value = $this->fields_value;
$this->_html .= $helper->generateForm($this->fields_form);
return;
}
protected function displayAddForm()
{
$token = Tools::getAdminTokenLite('AdminModules');
$back = Tools::safeOutput(Tools::getValue('back', ''));
$current_index = AdminController::$currentIndex;
if (!isset($back) || empty($back))
$back = $current_index.'&amp;configure='.$this->name.'&token='.$token;
if (Tools::isSubmit('editBlockCMS') && Tools::getValue('id_cms_block'))
{
$this->_display = 'edit';
$id_cms_block = (int)Tools::getValue('id_cms_block');
$cmsBlock = BlockCMSModel::getBlockCMS($id_cms_block);
$cmsBlockCategories = BlockCMSModel::getCMSBlockPagesCategories($id_cms_block);
$cmsBlockPages = BlockCMSModel::getCMSBlockPages(Tools::getValue('id_cms_block'));
}
else
$this->_display = 'add';
$this->fields_form[0]['form'] = array(
'tinymce' => true,
'legend' => array(
'title' => isset($cmsBlock) ? $this->l('Edit the CMS block.') : $this->l('New CMS block'),
'icon' => isset($cmsBlock) ? 'icon-edit' : 'icon-plus-square'
),
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Name of the CMS block'),
'name' => 'block_name',
'lang' => true,
'desc' => $this->l('If you leave this field empty, the block name will use the category name by default.')
),
array(
'type' => 'select_category',
'label' => $this->l('CMS category'),
'name' => 'id_category',
'options' => array(
'query' => BlockCMSModel::getCMSCategories(true),
'id' => 'id_cms_category',
'name' => 'name'
)
),
array(
'type' => 'select',
'label' => $this->l('Location'),
'name' => 'block_location',
'options' => array(
'query' => array(
array(
'id' => BlockCMSModel::LEFT_COLUMN,
'name' => $this->l('Left column')),
array(
'id' => BlockCMSModel::RIGHT_COLUMN,
'name' => $this->l('Right column')),
),
'id' => 'id',
'name' => 'name'
)
),
array(
'type' => 'switch',
'label' => $this->l('Add link to Store Locator'),
'name' => 'display_stores',
'is_bool' => true,
'values' => array(
array(
'id' => 'display_stores_on',
'value' => 1,
'label' => $this->l('Yes')),
array(
'id' => 'display_stores_off',
'value' => 0,
'label' => $this->l('No')),
),
'desc' => $this->l('Adds the "Our stores" link at the end of the block.')
),
array(
'type' => 'cms_pages',
'label' => $this->l('CMS content'),
'name' => 'cmsBox[]',
'values' => BlockCMSModel::getAllCMSStructure(),
'desc' => $this->l('Please mark every page that you want to display in this block.')
),
),
'buttons' => array(
'cancelBlock' => array(
'title' => $this->l('Cancel'),
'href' => $back,
'icon' => 'process-icon-cancel'
)
),
'submit' => array(
'name' => 'submitBlockCMS',
'title' => $this->l('Save'),
)
);
$this->context->controller->getLanguages();
foreach ($this->context->controller->_languages as $language)
{
if (Tools::getValue('block_name_'.$language['id_lang']))
$this->fields_value['block_name'][$language['id_lang']] = Tools::getValue('block_name_'.$language['id_lang']);
else if (isset($cmsBlock) && isset($cmsBlock[$language['id_lang']]['name']))
$this->fields_value['block_name'][$language['id_lang']] = $cmsBlock[$language['id_lang']]['name'];
else
$this->fields_value['block_name'][$language['id_lang']] = '';
}
if (Tools::getValue('display_stores'))
$this->fields_value['display_stores'] = Tools::getValue('display_stores');
else if (isset($cmsBlock) && isset($cmsBlock[1]['display_store']))
$this->fields_value['display_stores'] = $cmsBlock[1]['display_store'];
else
$this->fields_value['display_stores'] = '';
if (Tools::getValue('id_category'))
$this->fields_value['id_category'] = (int)Tools::getValue('id_category');
else if (isset($cmsBlock) && isset($cmsBlock[1]['id_cms_category']))
$this->fields_value['id_category'] = $cmsBlock[1]['id_cms_category'];
if (Tools::getValue('block_location'))
$this->fields_value['block_location'] = Tools::getValue('block_location');
else if (isset($cmsBlock) && isset($cmsBlock[1]['location']))
$this->fields_value['block_location'] = $cmsBlock[1]['location'];
else
$this->fields_value['block_location'] = 0;
if ($cmsBoxes = Tools::getValue('cmsBox'))
foreach ($cmsBoxes as $key => $value)
$this->fields_value[$value] = true;
else
{
if (isset($cmsBlockPages) && is_array($cmsBlockPages) && count($cmsBlockPages) > 0)
foreach ($cmsBlockPages as $item)
$this->fields_value['0_'.$item['id_cms']] = true;
if (isset($cmsBlockCategories) && is_array($cmsBlockCategories) && count($cmsBlockCategories) > 0)
foreach ($cmsBlockCategories as $item)
$this->fields_value['1_'.$item['id_cms']] = true;
}
$helper = $this->initForm();
if (isset($id_cms_block))
{
$helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name.'&id_cms_block='.$id_cms_block;
$helper->submit_action = 'editBlockCMS';
}
else
$helper->submit_action = 'addBlockCMS';
$helper->fields_value = isset($this->fields_value) ? $this->fields_value : array();
$this->_html .= $helper->generateForm($this->fields_form);
return;
}
protected function initForm()
{
$helper = new HelperForm();
$helper->module = $this;
$helper->name_controller = 'blockcms';
$helper->identifier = $this->identifier;
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->languages = $this->context->controller->_languages;
$helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name;
$helper->default_form_language = $this->context->controller->default_form_language;
$helper->allow_employee_form_lang = $this->context->controller->allow_employee_form_lang;
$helper->toolbar_scroll = true;
$helper->toolbar_btn = $this->initToolbar();
return $helper;
}
protected function changePosition()
{
if (!Validate::isInt(Tools::getValue('position')) ||
(Tools::getValue('location') != BlockCMSModel::LEFT_COLUMN &&
Tools::getValue('location') != BlockCMSModel::RIGHT_COLUMN) ||
(Tools::getValue('way') != 0 && Tools::getValue('way') != 1))
Tools::displayError();
$this->_html .= 'pos change!';
$position = (int)Tools::getValue('position');
$location = (int)Tools::getValue('location');
$id_cms_block = (int)Tools::getValue('id_cms_block');
if (Tools::getValue('way') == 0)
$new_position = $position + 1;
else if (Tools::getValue('way') == 1)
$new_position = $position - 1;
BlockCMSModel::updateCMSBlockPositions($id_cms_block, $position, $new_position, $location);
Tools::redirectAdmin('index.php?tab=AdminModules&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules'));
}
protected function _postValidation()
{
$this->_errors = array();
if (Tools::isSubmit('submitBlockCMS'))
{
$this->context->controller->getLanguages();
$cmsBoxes = Tools::getValue('cmsBox');
if (!Validate::isInt(Tools::getValue('display_stores')) || (Tools::getValue('display_stores') != 0 && Tools::getValue('display_stores') != 1))
$this->_errors[] = $this->l('Invalid store display value.');
if (!Validate::isInt(Tools::getValue('block_location')) || (Tools::getValue('block_location') != BlockCMSModel::LEFT_COLUMN && Tools::getValue('block_location') != BlockCMSModel::RIGHT_COLUMN))
$this->_errors[] = $this->l('Invalid block location.');
if (!is_array($cmsBoxes))
$this->_errors[] = $this->l('You must choose at least one page -- or subcategory -- in order to create a CMS block.');
else
{
foreach ($cmsBoxes as $cmsBox)
if (!preg_match('#^[01]_[0-9]+$#', $cmsBox))
$this->_errors[] = $this->l('Invalid CMS page and/or category.');
foreach ($this->context->controller->_languages as $language)
if (strlen(Tools::getValue('block_name_'.$language['id_lang'])) > 40)
$this->_errors[] = $this->l('The block name is too long.');
}
}
else if (Tools::isSubmit('deleteBlockCMS') && !Validate::isInt(Tools::getValue('id_cms_block')))
{
$this->_errors[] = $this->l('Invalid id_cms_block');
}
else if (Tools::isSubmit('submitFooterCMS'))
{
if (Tools::getValue('footerBox') && is_array(Tools::getValue('footerBox')))
{
foreach (Tools::getValue('footerBox') as $cmsBox)
if (!preg_match('#^[01]_[0-9]+$#', $cmsBox))
$this->_errors[] = $this->l('Invalid CMS page and/or category.');
}
$empty_footer_text = true;
$footer_text = array((int)Configuration::get('PS_LANG_DEFAULT') => Tools::getValue('footer_text_'.(int)Configuration::get('PS_LANG_DEFAULT')));
$this->context->controller->getLanguages();
foreach ($this->context->controller->_languages as $language)
{
if ($language['id_lang'] == (int)Configuration::get('PS_LANG_DEFAULT'))
continue;
$footer_text_value = Tools::getValue('footer_text_'.(int)$language['id_lang']);
if (!empty($footer_text_value))
{
$empty_footer_text = false;
$footer_text[(int)$language['id_lang']] = $footer_text_value;
}
else
$footer_text[(int)$language['id_lang']] = $footer_text[(int)Configuration::get('PS_LANG_DEFAULT')];
}
if (!$empty_footer_text && empty($footer_text[(int)Configuration::get('PS_LANG_DEFAULT')]))
$this->_errors[] = $this->l('Please provide footer text for the default language.');
else
{
foreach ($this->context->controller->_languages as $language)
Configuration::updateValue('FOOTER_CMS_TEXT_'.(int)$language['id_lang'], $footer_text[(int)$language['id_lang']], true);
}
if ((Tools::getValue('cms_footer_on') != 0) && (Tools::getValue('cms_footer_on') != 1))
$this->_errors[] = $this->l('Invalid footer activation.');
}
if (count($this->_errors))
{
foreach ($this->_errors as $err)
$this->_html .= '<div class="alert alert-danger">'.$err.'</div>';
return false;
}
return true;
}
protected function _postProcess()
{
if ($this->_postValidation() == false)
return false;
$this->_clearCache('blockcms.tpl');
$this->_errors = array();
if (Tools::isSubmit('submitBlockCMS'))
{
$this->context->controller->getLanguages();
$id_cms_category = (int)Tools::getvalue('id_category');
$display_store = (int)Tools::getValue('display_stores');
$location = (int)Tools::getvalue('block_location');
$position = BlockCMSModel::getMaxPosition($location);
if (Tools::isSubmit('addBlockCMS'))
{
$id_cms_block = BlockCMSModel::insertCMSBlock($id_cms_category, $location, $position, $display_store);
if ($id_cms_block !== false)
{
foreach ($this->context->controller->_languages as $language)
BlockCMSModel::insertCMSBlockLang($id_cms_block, $language['id_lang']);
$shops = Shop::getContextListShopID();
foreach ($shops as $shop)
BlockCMSModel::insertCMSBlockShop($id_cms_block, $shop);
}
$this->_errors[] = $this->l('Cannot create a block!');
}
elseif (Tools::isSubmit('editBlockCMS'))
{
$id_cms_block = Tools::getvalue('id_cms_block');
$old_block = BlockCMSModel::getBlockCMS($id_cms_block);
BlockCMSModel::deleteCMSBlockPage($id_cms_block);
if ($old_block[1]['location'] != (int)Tools::getvalue('block_location'))
BlockCMSModel::updatePositions($old_block[1]['position'], $old_block[1]['position'] + 1, $old_block[1]['location']);
BlockCMSModel::updateCMSBlock($id_cms_block, $id_cms_category, $position, $location, $display_store);
foreach ($this->context->controller->_languages as $language)
{
$block_name = Tools::getValue('block_name_'.$language['id_lang']);
BlockCMSModel::updateCMSBlockLang($id_cms_block, $block_name, $language['id_lang']);
}
}
$cmsBoxes = Tools::getValue('cmsBox');
if ($cmsBoxes)
{
foreach ($cmsBoxes as $cmsBox)
{
$cms_properties = explode('_', $cmsBox);
BlockCMSModel::insertCMSBlockPage($id_cms_block, $cms_properties[1], $cms_properties[0]);
}
}
if (Tools::isSubmit('addBlockCMS'))
$redirect = 'addBlockCMSConfirmation';
elseif (Tools::isSubmit('editBlockCMS'))
$redirect = 'editBlockCMSConfirmation';
Tools::redirectAdmin(AdminController::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&'.$redirect);
}
elseif (Tools::isSubmit('deleteBlockCMS') && Tools::getValue('id_cms_block'))
{
$id_cms_block = Tools::getvalue('id_cms_block');
if ($id_cms_block)
{
BlockCMSModel::deleteCMSBlock((int)$id_cms_block);
BlockCMSModel::deleteCMSBlockPage((int)$id_cms_block);
Tools::redirectAdmin(AdminController::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&deleteBlockCMSConfirmation');
}
else
$this->_html .= $this->displayError($this->l('Error: You are trying to delete a non-existing CMS block.'));
}
elseif (Tools::isSubmit('submitFooterCMS'))
{
$powered_by = Tools::getValue('cms_footer_powered_by_on') ? 1 : 0;
$footer_boxes = Tools::getValue('footerBox') ? implode('|', Tools::getValue('footerBox')) : '';
$block_activation = (Tools::getValue('cms_footer_on') == 1) ? 1 : 0;
Configuration::updateValue('PS_STORES_DISPLAY_FOOTER', Tools::getValue('PS_STORES_DISPLAY_FOOTER_on'));
Configuration::updateValue('FOOTER_CMS', rtrim($footer_boxes, '|'));
Configuration::updateValue('FOOTER_POWEREDBY', $powered_by);
Configuration::updateValue('FOOTER_BLOCK_ACTIVATION', $block_activation);
Configuration::updateValue('FOOTER_PRICE-DROP', (int)Tools::getValue('cms_footer_display_price-drop_on'));
Configuration::updateValue('FOOTER_NEW-PRODUCTS', (int)Tools::getValue('cms_footer_display_new-products_on'));
Configuration::updateValue('FOOTER_BEST-SALES', (int)Tools::getValue('cms_footer_display_best-sales_on'));
Configuration::updateValue('FOOTER_CONTACT', (int)Tools::getValue('cms_footer_display_contact_on'));
Configuration::updateValue('FOOTER_SITEMAP', (int)Tools::getValue('cms_footer_display_sitemap_on'));
$this->_html .= $this->displayConfirmation($this->l('Your footer information has been updated.'));
}
elseif (Tools::isSubmit('addBlockCMSConfirmation'))
$this->_html .= $this->displayConfirmation($this->l('CMS block added.'));
elseif (Tools::isSubmit('editBlockCMSConfirmation'))
$this->_html .= $this->displayConfirmation($this->l('CMS block edited.'));
elseif (Tools::isSubmit('deleteBlockCMSConfirmation'))
$this->_html .= $this->displayConfirmation($this->l('Deletion successful.'));
elseif (Tools::isSubmit('id_cms_block') && Tools::isSubmit('way') && Tools::isSubmit('position') && Tools::isSubmit('location'))
$this->changePosition();
elseif (Tools::isSubmit('updatePositions'))
$this->updatePositionsDnd();
if (count($this->_errors))
{
foreach ($this->_errors as $err)
$this->_html .= '<div class="alert error">'.$err.'</div>';
}
}
public function getContent()
{
$this->_html = '';
$this->_postProcess();
if (Tools::isSubmit('addBlockCMS') || Tools::isSubmit('editBlockCMS'))
$this->displayAddForm();
else
$this->displayForm();
return $this->_html;
}
public function displayBlockCMS($column)
{
if (!$this->isCached('blockcms.tpl', $this->getCacheId($column)))
{
$cms_titles = BlockCMSModel::getCMSTitles($column);
$this->smarty->assign(array(
'block' => 1,
'cms_titles' => $cms_titles,
'contact_url' => (_PS_VERSION_ >= 1.5) ? 'contact' : 'contact-form'
));
}
return $this->display(__FILE__, 'blockcms.tpl', $this->getCacheId($column));
}
protected function getCacheId($name = null)
{
return parent::getCacheId('blockcms|'.$name);
}
public function hookActionAdminStoresControllerUpdate_optionsAfter()
{
if (Tools::getIsset('PS_STORES_DISPLAY_FOOTER'))
$this->_clearCache('blockcms.tpl');
}
public function hookActionObjectCmsUpdateAfter()
{
$this->_clearCache('blockcms.tpl');
}
public function hookActionObjectCmsDeleteAfter()
{
$this->_clearCache('blockcms.tpl');
}
public function hookHeader($params)
{
$this->context->controller->addCSS(($this->_path).'blockcms.css', 'all');
}
public function hookLeftColumn()
{
return $this->displayBlockCMS(BlockCMSModel::LEFT_COLUMN);
}
public function hookRightColumn()
{
return $this->displayBlockCMS(BlockCMSModel::RIGHT_COLUMN);
}
public function hookFooter()
{
if (!($block_activation = Configuration::get('FOOTER_BLOCK_ACTIVATION')))
return;
if (!$this->isCached('blockcms.tpl', $this->getCacheId(BlockCMSModel::FOOTER)))
{
$display_poweredby = Configuration::get('FOOTER_POWEREDBY');
$this->smarty->assign(
array(
'block' => 0,
'contact_url' => 'contact',
'cmslinks' => BlockCMSModel::getCMSTitlesFooter(),
'display_stores_footer' => Configuration::get('PS_STORES_DISPLAY_FOOTER'),
'display_poweredby' => ((int)$display_poweredby === 1 || $display_poweredby === false),
'footer_text' => Configuration::get('FOOTER_CMS_TEXT_'.(int)$this->context->language->id),
'show_price_drop' => Configuration::get('FOOTER_PRICE-DROP'),
'show_new_products' => Configuration::get('FOOTER_NEW-PRODUCTS'),
'show_best_sales' => Configuration::get('FOOTER_BEST-SALES'),
'show_contact' => Configuration::get('FOOTER_CONTACT'),
'show_sitemap' => Configuration::get('FOOTER_SITEMAP')
)
);
}
return $this->display(__FILE__, 'blockcms.tpl', $this->getCacheId(BlockCMSModel::FOOTER));
}
protected function updatePositionsDnd()
{
if (Tools::getValue('cms_block_0'))
$positions = Tools::getValue('cms_block_0');
elseif (Tools::getValue('cms_block_1'))
$positions = Tools::getValue('cms_block_1');
else
$positions = array();
foreach ($positions as $position => $value)
{
$pos = explode('_', $value);
if (isset($pos[2]))
BlockCMSModel::updateCMSBlockPosition($pos[2], $position);
}
}
public function hookActionShopDataDuplication($params)
{
//get all cmd block to duplicate in new shop
$cms_blocks = Db::getInstance()->executeS('
SELECT * FROM `'._DB_PREFIX_.'cms_block` cb
JOIN `'._DB_PREFIX_.'cms_block_shop` cbf
ON (cb.`id_cms_block` = cbf.`id_cms_block` AND cbf.`id_shop` = '.(int)$params['old_id_shop'].') ');
if (count($cms_blocks))
{
foreach ($cms_blocks as $cms_block)
{
Db::getInstance()->execute('
INSERT IGNORE INTO '._DB_PREFIX_.'cms_block (`id_cms_block`, `id_cms_category`, `location`, `position`, `display_store`)
VALUES (NULL, '.(int)$cms_block['id_cms_category'].', '.(int)$cms_block['location'].', '.(int)$cms_block['position'].', '.(int)$cms_block['display_store'].');');
$id_block_cms = Db::getInstance()->Insert_ID();
Db::getInstance()->execute('INSERT IGNORE INTO '._DB_PREFIX_.'cms_block_shop (`id_cms_block`, `id_shop`) VALUES ('.(int)$id_block_cms.', '.(int)$params['new_id_shop'].');');
$langs = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'cms_block_lang` WHERE `id_cms_block` = '.(int)$cms_block['id_cms_block']);
foreach($langs as $lang)
Db::getInstance()->execute('
INSERT IGNORE INTO `'._DB_PREFIX_.'cms_block_lang` (`id_cms_block`, `id_lang`, `name`)
VALUES ('.(int)$id_block_cms.', '.(int)$lang['id_lang'].', \''.pSQL($lang['name']).'\');');
$pages = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'cms_block_page` WHERE `id_cms_block` = '.(int)$cms_block['id_cms_block']);
foreach($pages as $page)
Db::getInstance()->execute('
INSERT IGNORE INTO `'._DB_PREFIX_.'cms_block_page` (`id_cms_block_page`, `id_cms_block`, `id_cms`, `is_category`)
VALUES (NULL, '.(int)$id_block_cms.', '.(int)$page['id_cms'].', '.(int)$page['is_category'].');');
}
}
}
}

View File

@@ -1,108 +0,0 @@
{*
* 2007-2016 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-2016 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 $block == 1}
<!-- Block CMS module -->
{foreach from=$cms_titles key=cms_key item=cms_title}
<div id="informations_block_left_{$cms_key}" class="block informations_block_left">
<h4 class="title_block">
<a href="{$cms_title.category_link|escape:'html'}">{if !empty($cms_title.name)}{$cms_title.name}{else}{$cms_title.category_name}{/if}</a>
</h4>
<ul class="block_content">
{foreach from=$cms_title.categories item=cms_page}
{if isset($cms_page.link)}
<li class="bullet">
<b style="margin-left:2em;">
<a href="{$cms_page.link|escape:'html'}" title="{$cms_page.name|escape:html:'UTF-8'}">{$cms_page.name|escape:html:'UTF-8'}</a>
</b>
</li>
{/if}
{/foreach}
{foreach from=$cms_title.cms item=cms_page}
{if isset($cms_page.link)}
<li>
<a href="{$cms_page.link|escape:'html'}" title="{$cms_page.meta_title|escape:html:'UTF-8'}">{$cms_page.meta_title|escape:html:'UTF-8'}</a>
</li>
{/if}
{/foreach}
{if $cms_title.display_store}
<li>
<a href="{$link->getPageLink('stores')|escape:'html'}" title="{l s='Our stores' mod='blockcms'}">{l s='Our stores' mod='blockcms'}</a>
</li>
{/if}
</ul>
</div>
{/foreach}
<!-- /Block CMS module -->
{else}
<!-- MODULE Block footer -->
<div class="block_various_links" id="block_various_links_footer">
<h4 class="title_block">{l s='Information' mod='blockcms'}</h4>
<ul>
{if isset($show_price_drop) && $show_price_drop && !$PS_CATALOG_MODE}
<li class="first_item">
<a href="{$link->getPageLink('prices-drop')|escape:'html'}" title="{l s='Specials' mod='blockcms'}">{l s='Specials' mod='blockcms'}</a>
</li>
{/if}
{if isset($show_new_products) && $show_new_products}
<li class="item">
<a href="{$link->getPageLink('new-products')|escape:'html'}" title="{l s='New products' mod='blockcms'}">{l s='New products' mod='blockcms'}</a>
</li>
{/if}
{if isset($show_best_sales) && $show_best_sales && !$PS_CATALOG_MODE}
<li class="item">
<a href="{$link->getPageLink('best-sales')|escape:'html'}" title="{l s='Best sellers' mod='blockcms'}">{l s='Best sellers' mod='blockcms'}</a>
</li>
{/if}
{if isset($display_stores_footer) && $display_stores_footer}
<li class="item">
<a href="{$link->getPageLink('stores')|escape:'html'}" title="{l s='Our stores' mod='blockcms'}">{l s='Our stores' mod='blockcms'}</a>
</li>
{/if}
{if isset($show_contact) && $show_contact}
<li class="item">
<a href="{$link->getPageLink($contact_url, true)|escape:'html'}" title="{l s='Contact us' mod='blockcms'}">{l s='Contact us' mod='blockcms'}</a>
</li>
{/if}
{foreach from=$cmslinks item=cmslink}
{if $cmslink.meta_title != ''}
<li class="item">
<a href="{$cmslink.link|addslashes|escape:'html'}" title="{$cmslink.meta_title|escape:'html':'UTF-8'}">{$cmslink.meta_title|escape:'html':'UTF-8'}</a>
</li>
{/if}
{/foreach}
{if isset($show_sitemap) && $show_sitemap}
<li>
<a href="{$link->getPageLink('sitemap')|escape:'html'}" title="{l s='Sitemap' mod='blockcms'}">{l s='Sitemap' mod='blockcms'}</a>
</li>
{/if}
{if isset($display_poweredby) && $display_poweredby}
<li class="last_item">{l s='[1]Ecommerce software by %s[/1]' mod='blockcms' sprintf=['PrestaShop™'] tags=['<a class="_blank" href="http://www.prestashop.com">']}</li>
{/if}
</ul>
{$footer_text}
</div>
<!-- /MODULE Block footer -->
{/if}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -1,9 +0,0 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_1_3($object)
{
return ($object->registerHook('actionObjectCmsUpdateAfter') && $object->registerHook('actionObjectCmsDeleteAfter'));
}

Some files were not shown because too many files have changed in this diff Show More