Merge branch 'bootstrap' of https://github.com/PrestaShop/PrestaShop into bootstrap
This commit is contained in:
@@ -102,10 +102,19 @@
|
||||
</script>
|
||||
{/literal}
|
||||
{/if}
|
||||
{if isset($input.maxchar)}
|
||||
{if isset($input.maxchar) || isset($input.prefix) || isset($input.suffix)}
|
||||
<div class="input-group">
|
||||
<span id="{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}_counter" class="input-group-addon"><span class="text-count-down">{$input.maxchar}</span></span>
|
||||
{/if}
|
||||
{if isset($input.maxchar)}
|
||||
<span id="{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}_counter" class="input-group-addon">
|
||||
<span class="text-count-down">{$input.maxchar}</span>
|
||||
</span>
|
||||
{/if}
|
||||
{if isset($input.prefix)}
|
||||
<span class="input-group-addon">
|
||||
{$input.prefix}
|
||||
</span>
|
||||
{/if}
|
||||
<input type="text"
|
||||
id="{if isset($input.id)}{$input.id}_{$language.id_lang}{else}{$input.name}_{$language.id_lang}{/if}"
|
||||
name="{$input.name}_{$language.id_lang}"
|
||||
@@ -118,7 +127,12 @@
|
||||
{if isset($input.readonly) && $input.readonly} readonly="readonly"{/if}
|
||||
{if isset($input.disabled) && $input.disabled} disabled="disabled"{/if}
|
||||
{if isset($input.autocomplete) && !$input.autocomplete} autocomplete="off"{/if} />
|
||||
{if isset($input.maxchar)}
|
||||
{if isset($input.suffix)}
|
||||
<span class="input-group-addon">
|
||||
{$input.suffix}
|
||||
</span>
|
||||
{/if}
|
||||
{if isset($input.maxchar) || isset($input.prefix) || isset($input.suffix)}
|
||||
</div>
|
||||
{/if}
|
||||
{if $languages|count > 1}
|
||||
@@ -175,10 +189,17 @@
|
||||
{/literal}
|
||||
{/if}
|
||||
{assign var='value_text' value=$fields_value[$input.name]}
|
||||
{if isset($input.maxchar)}
|
||||
{if isset($input.maxchar) || isset($input.prefix) || isset($input.suffix)}
|
||||
<div class="input-group">
|
||||
{/if}
|
||||
{if isset($input.maxchar)}
|
||||
<span id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}_counter" class="input-group-addon"><span class="text-count-down">{$input.maxchar}</span></span>
|
||||
{/if}
|
||||
{if isset($input.prefix)}
|
||||
<span class="input-group-addon">
|
||||
{$input.prefix}
|
||||
</span>
|
||||
{/if}
|
||||
<input type="text"
|
||||
name="{$input.name}"
|
||||
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
|
||||
@@ -191,8 +212,13 @@
|
||||
{if isset($input.readonly) && $input.readonly} readonly="readonly"{/if}
|
||||
{if isset($input.disabled) && $input.disabled} disabled="disabled"{/if}
|
||||
{if isset($input.autocomplete) && !$input.autocomplete} autocomplete="off"{/if} />
|
||||
{if isset($input.suffix)}{$input.suffix}{/if}
|
||||
{if isset($input.maxchar)}
|
||||
{if isset($input.suffix)}
|
||||
<span class="input-group-addon">
|
||||
{$input.suffix}
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
{if isset($input.maxchar) || isset($input.prefix) || isset($input.suffix)}
|
||||
</div>
|
||||
{/if}
|
||||
{if isset($input.maxchar)}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
<div id="{$id|escape}" class="col-lg-3 box-stats {$color|escape}" >
|
||||
<{if $href}a style="display:block" href="{$href|escape}"{else}div{/if} id="{$id|escape}" class="col-lg-3 box-stats {$color|escape}" >
|
||||
{if $icon}<i class="{$icon|escape}"></i>{/if}
|
||||
{if $chart}
|
||||
<div class="boxchart-overlay">
|
||||
@@ -32,7 +32,7 @@
|
||||
{/if}
|
||||
<span class="title">{$title|escape}<br /><small>{$subtitle|escape}</small></span>
|
||||
<span class="value">{$value|escape}</span>
|
||||
</div>
|
||||
</{if $href}a{else}div{/if}>
|
||||
|
||||
{if $source != ''}
|
||||
<script>
|
||||
|
||||
+4
-4
@@ -3051,7 +3051,7 @@ class ProductCore extends ObjectModel
|
||||
return array();
|
||||
|
||||
if (!$res = Db::getInstance()->executeS('
|
||||
SELECT pa.id_product, a.color, a.id_attribute, pac.id_product_attribute
|
||||
SELECT pa.id_product, a.color, pac.id_product_attribute
|
||||
FROM '._DB_PREFIX_.'product_attribute pa
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa').'
|
||||
JOIN '._DB_PREFIX_.'product_attribute_combination pac ON (pac.id_product_attribute = product_attribute_shop.id_product_attribute)
|
||||
@@ -3068,7 +3068,7 @@ class ProductCore extends ObjectModel
|
||||
if (Tools::isEmpty($row['color']))
|
||||
continue;
|
||||
|
||||
$colors[(int)$row['id_product']][] = array('id_product_attribute' => (int)$row['id_product_attribute'], 'color' => $row['color']);
|
||||
$colors[(int)$row['id_product']][] = array('id_product_attribute' => (int)$row['id_product_attribute'], 'color' => $row['color'], 'id_product' => $row['id_product']);
|
||||
}
|
||||
|
||||
return $colors;
|
||||
@@ -5107,8 +5107,8 @@ class ProductCore extends ObjectModel
|
||||
foreach ($attributes as &$a)
|
||||
{
|
||||
foreach ($a as &$b)
|
||||
$b = str_replace('-', '_', Tools::link_rewrite($b));
|
||||
$anchor .= '/'.$a['group'].'-'.$a['name'];
|
||||
$b = str_replace(Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR'), '_', Tools::link_rewrite($b));
|
||||
$anchor .= '/'.$a['group'].Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR').$a['name'];
|
||||
}
|
||||
return $anchor;
|
||||
}
|
||||
|
||||
@@ -369,8 +369,9 @@ class AdminControllerCore extends Controller
|
||||
if (!empty($prev) && $prev == $tab['name'])
|
||||
array_pop($this->breadcrumbs);
|
||||
$prev = $tab['name'];
|
||||
if ($tab['id_parent'] != 0)
|
||||
$this->breadcrumbs[] = '<a href="'.Tools::htmlentitiesUTF8($this->context->link->getAdminLink($tab['class_name'])).'">'.$tab['name'].'</a>';
|
||||
|
||||
if ($tab['id_parent'] != 0 && ($link = __PS_BASE_URI__.basename(_PS_ADMIN_DIR_ ).'/'.$this->context->link->getAdminLink($tab['class_name'])) != $_SERVER['REQUEST_URI'])
|
||||
$this->breadcrumbs[] = '<a href="'.Tools::htmlentitiesUTF8($link).'">'.$tab['name'].'</a>';
|
||||
else
|
||||
$this->breadcrumbs[] = $tab['name'];
|
||||
}
|
||||
|
||||
@@ -1171,7 +1171,8 @@ class FrontControllerCore extends Controller
|
||||
if (isset($colors[$product['id_product']]))
|
||||
$tpl->assign(array(
|
||||
'id_product' => $product['id_product'],
|
||||
'colors_list' => $colors[$product['id_product']]
|
||||
'colors_list' => $colors[$product['id_product']],
|
||||
'link' => Context::getContext()->link
|
||||
));
|
||||
if (!in_array($product['id_product'], $products_need_cache) || isset($colors[$product['id_product']]))
|
||||
$product['color_list'] = $tpl->fetch(_PS_THEME_DIR_.'product-list-colors.tpl', $this->getColorsListCacheId($product['id_product']));
|
||||
|
||||
@@ -38,6 +38,7 @@ class HelperKpiCore extends Helper
|
||||
public $value;
|
||||
public $data;
|
||||
public $source;
|
||||
public $href;
|
||||
|
||||
public function generate()
|
||||
{
|
||||
@@ -52,7 +53,8 @@ class HelperKpiCore extends Helper
|
||||
'subtitle' => $this->subtitle,
|
||||
'value' => $this->value,
|
||||
'data' => $this->data,
|
||||
'source' => $this->source
|
||||
'source' => $this->source,
|
||||
'href' => $this->href
|
||||
));
|
||||
return $this->tpl->fetch();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class AdminDashboardControllerCore extends AdminController
|
||||
|
||||
parent::__construct();
|
||||
|
||||
if (Tools::isSubmit('profitability_conf') || Tools::isSubmit('submitOptions'))
|
||||
if (Tools::isSubmit('profitability_conf') || Tools::isSubmit('submitOptionsconfiguration'))
|
||||
$this->fields_options = $this->getOptionFields();
|
||||
}
|
||||
|
||||
|
||||
@@ -1253,7 +1253,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
$helper = new HelperKpi();
|
||||
$helper->id = 'box-conversion-rate';
|
||||
$helper->chart = true;
|
||||
$helper->icon = 'icon-sort-by-attributes-alt';
|
||||
//$helper->chart = true;
|
||||
$helper->color = 'color1';
|
||||
$helper->title = $this->l('Conversion Rate');
|
||||
$helper->subtitle = $this->l('30 days');
|
||||
@@ -1271,6 +1272,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$helper->color = 'color2';
|
||||
$helper->title = $this->l('Abandoned Carts');
|
||||
$helper->subtitle = $this->l('Today');
|
||||
$helper->href = $this->context->link->getAdminLink('AdminCarts');
|
||||
if (ConfigurationKPI::get('ABANDONED_CARTS') !== false)
|
||||
$helper->value = ConfigurationKPI::get('ABANDONED_CARTS');
|
||||
if (ConfigurationKPI::get('ABANDONED_CARTS_EXPIRE') < $time)
|
||||
|
||||
@@ -181,6 +181,15 @@ class AdminPPreferencesControllerCore extends AdminController
|
||||
'validation' => 'isBool',
|
||||
'cast' => 'intval',
|
||||
'type' => 'bool'
|
||||
),
|
||||
'PS_ATTRIBUTE_ANCHOR_SEPARATOR' => array(
|
||||
'title' => $this->l('Separator of attribute anchor on the product links'),
|
||||
'type' => 'select',
|
||||
'list' => array(
|
||||
array('id' => '-', 'name' => '-'),
|
||||
array('id' => ',', 'name' => ','),
|
||||
),
|
||||
'identifier' => 'id'
|
||||
)
|
||||
)
|
||||
),
|
||||
|
||||
@@ -62,7 +62,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
return $visitors;
|
||||
}
|
||||
|
||||
public static function getAbandonedCarts($date_from, $date_to, $granularity = false)
|
||||
public static function getAbandonedCarts($date_from, $date_to)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(DISTINCT id_guest)
|
||||
@@ -319,6 +319,33 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
return 0;
|
||||
return round($messages / $threads, 1);
|
||||
}
|
||||
|
||||
public static function getExpenses($date_from, $date_to)
|
||||
{
|
||||
$secs_per_year = 365.25 * 86400;
|
||||
$secs_per_month = 30.4375 * 86400;
|
||||
$total_secs = (strtotime($date_to) - min(strtotime($date_from), time())) / 86400;
|
||||
$expenses = Configuration::get('CONF_MONTHLY_FEES') * $total_secs / $secs_per_month + Configuration::get('CONF_YEARLY_FEES') * $total_secs / $secs_per_year;
|
||||
|
||||
$orders = Db::getInstance()->ExecuteS('
|
||||
SELECT
|
||||
total_paid_tax_incl / o.conversion_rate as total_paid_tax_incl,
|
||||
total_shipping_tax_excl / o.conversion_rate as total_shipping_tax_excl,
|
||||
module
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
WHERE `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59"
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o'));
|
||||
foreach ($orders as $order)
|
||||
{
|
||||
// Add flat fees for this order
|
||||
$expenses += Configuration::get('CONF_ORDER_FIXED_FEES') + Configuration::get('CONF_'.strtoupper($order['module']).'_FIXED_FEE');
|
||||
// Add variable fees for this order
|
||||
$expenses += $order['total_paid_tax_incl'] * (Configuration::get('CONF_ORDER_VAR_FEES') + Configuration::get('CONF_'.strtoupper($order['module']).'_VAR_FEE')) / 100;
|
||||
// Add shipping fees for this order
|
||||
$expenses += $order['total_shipping_tax_excl'] * (100 - Configuration::get('CONF_SHIPPING_MARGIN')) / 100;
|
||||
}
|
||||
return $expenses;
|
||||
}
|
||||
|
||||
public function displayAjaxGetKpi()
|
||||
{
|
||||
@@ -326,20 +353,20 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
switch (Tools::getValue('kpi'))
|
||||
{
|
||||
case 'conversion_rate':
|
||||
$visitors = AdminStatsController::getUniqueVisitors(date('Y-m-d', strtotime('-31 day')), date('Y-m-d', strtotime('-1 day')), 'day');
|
||||
$orders = AdminStatsController::getOrders(date('Y-m-d', strtotime('-31 day')), date('Y-m-d', strtotime('-1 day')), 'day');
|
||||
$visitors = AdminStatsController::getUniqueVisitors(date('Y-m-d', strtotime('-31 day')), date('Y-m-d', strtotime('-1 day')), false /*'day'*/);
|
||||
$orders = AdminStatsController::getOrders(date('Y-m-d', strtotime('-31 day')), date('Y-m-d', strtotime('-1 day')), false /*'day'*/);
|
||||
|
||||
$data = array();
|
||||
$from = strtotime(date('Y-m-d 00:00:00', strtotime('-31 day')));
|
||||
$to = strtotime(date('Y-m-d 23:59:59', strtotime('-1 day')));
|
||||
for ($date = $from; $date <= $to; $date = strtotime('+1 day', $date))
|
||||
if (isset($visitors[$date]) && $visitors[$date])
|
||||
$data[$date] = round(100 * ((isset($orders[$date]) && $orders[$date]) ? $orders[$date] : 0) / $visitors[$date], 2);
|
||||
else
|
||||
$data[$date] = 0;
|
||||
// $data = array();
|
||||
// $from = strtotime(date('Y-m-d 00:00:00', strtotime('-31 day')));
|
||||
// $to = strtotime(date('Y-m-d 23:59:59', strtotime('-1 day')));
|
||||
// for ($date = $from; $date <= $to; $date = strtotime('+1 day', $date))
|
||||
// if (isset($visitors[$date]) && $visitors[$date])
|
||||
// $data[$date] = round(100 * ((isset($orders[$date]) && $orders[$date]) ? $orders[$date] : 0) / $visitors[$date], 2);
|
||||
// else
|
||||
// $data[$date] = 0;
|
||||
|
||||
$visits_sum = array_sum($visitors);
|
||||
$orders_sum = array_sum($orders);
|
||||
$visits_sum = $visitors; //array_sum($visitors);
|
||||
$orders_sum = $orders; //array_sum($orders);
|
||||
if ($visits_sum)
|
||||
$value = round(100 * $orders_sum / $visits_sum, 2);
|
||||
elseif ($orders_sum)
|
||||
@@ -348,7 +375,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
$value = 0;
|
||||
$value .= '%';
|
||||
|
||||
ConfigurationKPI::updateValue('CONVERSION_RATE_CHART', Tools::jsonEncode($data));
|
||||
// ConfigurationKPI::updateValue('CONVERSION_RATE_CHART', Tools::jsonEncode($data));
|
||||
ConfigurationKPI::updateValue('CONVERSION_RATE', $value);
|
||||
ConfigurationKPI::updateValue('CONVERSION_RATE_EXPIRE', strtotime(date('Y-m-d 00:00:00', strtotime('+1 day'))));
|
||||
break;
|
||||
@@ -356,7 +383,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
case 'abandoned_cart':
|
||||
$value = AdminStatsController::getAbandonedCarts(date('Y-m-d H:i:s', strtotime('-2 day')), date('Y-m-d H:i:s', strtotime('-1 day')));
|
||||
ConfigurationKPI::updateValue('ABANDONED_CARTS', $value);
|
||||
ConfigurationKPI::updateValue('ABANDONED_CARTS_EXPIRE', strtotime('+10 min'));
|
||||
ConfigurationKPI::updateValue('ABANDONED_CARTS_EXPIRE', strtotime('+1 hour'));
|
||||
break;
|
||||
|
||||
case 'installed_modules':
|
||||
@@ -504,7 +531,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
else
|
||||
{
|
||||
$country = new Country($row['id_country'], $this->context->language->id);
|
||||
$value = sprintf($this->l('%.1f%% %s'), $row['orders'], $country->name);
|
||||
$value = sprintf($this->l('%d%% %s'), $row['orders'], $country->name);
|
||||
}
|
||||
|
||||
ConfigurationKPI::updateValue('MAIN_COUNTRY', array($this->context->language->id => $value));
|
||||
@@ -547,9 +574,10 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
case 'netprofit_visitor':
|
||||
$date_from = date('Y-m-d', strtotime('-31 day'));
|
||||
$date_to = date('Y-m-d', strtotime('-1 day'));
|
||||
$visitors = AdminStatsController::getUniqueVisitors($date_from, $date_to);
|
||||
$total_visitors = AdminStatsController::getUniqueVisitors($date_from, $date_to);
|
||||
$total_sales = AdminStatsController::getTotalSales($date_from, $date_to);
|
||||
$total_purchase = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
$total_expenses = AdminStatsController::getExpenses($date_from, $date_to);
|
||||
$total_purchases = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT SUM(od.`product_quantity` * od.`purchase_supplier_price` / `conversion_rate`) as total_purchase_price
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order
|
||||
@@ -557,11 +585,11 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o'));
|
||||
|
||||
$net_profits = $total_sales;
|
||||
$net_profits -= $total_purchase;
|
||||
// Todo : Add profitability calculation
|
||||
$net_profits -= $total_purchases;
|
||||
$net_profits -= $total_expenses;
|
||||
|
||||
if ($visitors)
|
||||
$value = Tools::displayPrice($net_profits / $visitors, $currency);
|
||||
if ($total_visitors)
|
||||
$value = Tools::displayPrice($net_profits / $total_visitors, $currency);
|
||||
elseif ($net_profits)
|
||||
$value = '∞';
|
||||
else
|
||||
|
||||
@@ -1272,7 +1272,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$kpis[] = $helper->generate();
|
||||
|
||||
$helper = new HelperKpi();
|
||||
$helper->id = 'box-country';
|
||||
$helper->id = 'box-translations';
|
||||
$helper->icon = 'icon-list';
|
||||
$helper->color = 'color3';
|
||||
$helper->title = $this->l('Front Office Translations');
|
||||
|
||||
@@ -515,10 +515,14 @@ class ProductControllerCore extends FrontController
|
||||
if (is_array($attributes_combinations) && count($attributes_combinations))
|
||||
foreach ($attributes_combinations as &$ac)
|
||||
foreach ($ac as &$val)
|
||||
$val = str_replace('-', '_', Tools::link_rewrite(str_replace(array(',', '.'), '-', $val)));
|
||||
$val = str_replace(Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR'), '_', Tools::link_rewrite(str_replace(array(',', '.'), '-', $val)));
|
||||
else
|
||||
$attributes_combinations = array();
|
||||
$this->context->smarty->assign('attributesCombinations', $attributes_combinations);
|
||||
$this->context->smarty->assign(array(
|
||||
'attributesCombinations' => $attributes_combinations,
|
||||
'attribute_anchor_separator' => Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -778,5 +778,8 @@ Country</value>
|
||||
<configuration id="PS_DASHBOARD_USE_PUSH" name="PS_DASHBOARD_USE_PUSH">
|
||||
<value>0</value>
|
||||
</configuration>
|
||||
<configuration id="PS_ATTRIBUTE_ANCHOR_SEPARATOR" name="PS_ATTRIBUTE_ANCHOR_SEPARATOR">
|
||||
<value>-</value>
|
||||
</configuration>
|
||||
</entities>
|
||||
</entity_configuration>
|
||||
|
||||
@@ -29,3 +29,5 @@ CREATE TABLE `PREFIX_configuration_kpi_lang` (
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
/* PHP:ps1600_add_missing_index(); */;
|
||||
|
||||
UPDATE `PREFIX_configuration` SET `value`='-' WHERE `name`='PS_ATTRIBUTE_ANCHOR_SEPARATOR';
|
||||
@@ -419,7 +419,7 @@ class BlockLayered extends Module
|
||||
foreach ($attribute as $param)
|
||||
{
|
||||
$selected_filters = array();
|
||||
$link = '/'.str_replace('-', '_', Tools::link_rewrite($param['name'])).'-'.str_replace('-', '_', Tools::link_rewrite($param['value']));
|
||||
$link = '/'.str_replace(Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR'), '_', Tools::link_rewrite($param['name'])).Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR').str_replace(Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR'), '_', Tools::link_rewrite($param['value']));
|
||||
$selected_filters[$param['type']] = array();
|
||||
if (!isset($param['id_id_value']))
|
||||
$param['id_id_value'] = $param['id_value'];
|
||||
@@ -2103,7 +2103,7 @@ class BlockLayered extends Module
|
||||
{
|
||||
foreach ($url_attributes as $url_attribute)
|
||||
{
|
||||
$url_parameters = explode('-', $url_attribute);
|
||||
$url_parameters = explode(Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR'), $url_attribute);
|
||||
$attribute_name = array_shift($url_parameters);
|
||||
if ($attribute_name == 'page')
|
||||
$this->page = (int)$url_parameters[0];
|
||||
@@ -2113,7 +2113,7 @@ class BlockLayered extends Module
|
||||
{
|
||||
foreach ($url_parameters as $url_parameter)
|
||||
{
|
||||
$data = Db::getInstance()->getValue('SELECT data FROM `'._DB_PREFIX_.'layered_friendly_url` WHERE `url_key` = \''.md5('/'.$attribute_name.'-'.$url_parameter).'\'');
|
||||
$data = Db::getInstance()->getValue('SELECT data FROM `'._DB_PREFIX_.'layered_friendly_url` WHERE `url_key` = \''.md5('/'.$attribute_name.Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR').$url_parameter).'\'');
|
||||
if ($data)
|
||||
foreach (Tools::unSerialize($data) as $key_params => $params)
|
||||
{
|
||||
@@ -3029,7 +3029,7 @@ class BlockLayered extends Module
|
||||
{
|
||||
$value_name = !empty($value['url_name']) ? $value['url_name'] : $value['name'];
|
||||
$value_meta = !empty($value['meta_title']) ? $value['meta_title'] : $value['name'];
|
||||
$param_group_selected .= '-'.str_replace('-', '_', Tools::link_rewrite($value_name));
|
||||
$param_group_selected .= Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR').str_replace(Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR'), '_', Tools::link_rewrite($value_name));
|
||||
$param_group_selected_array[Tools::link_rewrite($filter_name)][] = Tools::link_rewrite($value_name);
|
||||
|
||||
if (!isset($title_values[$filter_name]))
|
||||
@@ -3044,12 +3044,12 @@ class BlockLayered extends Module
|
||||
}
|
||||
if (!empty($param_group_selected))
|
||||
{
|
||||
$param_selected .= '/'.str_replace('-', '_', Tools::link_rewrite($filter_name)).$param_group_selected;
|
||||
$param_selected .= '/'.str_replace(Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR'), '_', Tools::link_rewrite($filter_name)).$param_group_selected;
|
||||
$option_checked_array[Tools::link_rewrite($filter_name)] = $param_group_selected;
|
||||
}
|
||||
// select only attribute and group attribute to display an unique product combination link
|
||||
if (!empty($param_group_selected) && $type_filter['type'] == 'id_attribute_group')
|
||||
$param_product_url .= '/'.str_replace('-', '_', Tools::link_rewrite($filter_name)).$param_group_selected;
|
||||
$param_product_url .= '/'.str_replace(Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR'), '_', Tools::link_rewrite($filter_name)).$param_group_selected;
|
||||
|
||||
}
|
||||
|
||||
@@ -3089,23 +3089,23 @@ class BlockLayered extends Module
|
||||
// Update parameter filter checked before
|
||||
if (array_key_exists(Tools::link_rewrite($filter_name), $option_checked_array))
|
||||
{
|
||||
$option_checked_clone_array[Tools::link_rewrite($filter_name)] = $option_checked_clone_array[Tools::link_rewrite($filter_name)].'-'.str_replace('-', '_', Tools::link_rewrite($value_name));
|
||||
$option_checked_clone_array[Tools::link_rewrite($filter_name)] = $option_checked_clone_array[Tools::link_rewrite($filter_name)].Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR').str_replace(Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR'), '_', Tools::link_rewrite($value_name));
|
||||
$nofollow = true;
|
||||
}
|
||||
else
|
||||
$option_checked_clone_array[Tools::link_rewrite($filter_name)] = '-'.str_replace('-', '_', Tools::link_rewrite($value_name));
|
||||
$option_checked_clone_array[Tools::link_rewrite($filter_name)] = Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR').str_replace(Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR'), '_', Tools::link_rewrite($value_name));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove selected parameters
|
||||
$option_checked_clone_array[Tools::link_rewrite($filter_name)] = str_replace('-'.str_replace('-', '_', Tools::link_rewrite($value_name)), '', $option_checked_clone_array[Tools::link_rewrite($filter_name)]);
|
||||
$option_checked_clone_array[Tools::link_rewrite($filter_name)] = str_replace(Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR').str_replace(Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR'), '_', Tools::link_rewrite($value_name)), '', $option_checked_clone_array[Tools::link_rewrite($filter_name)]);
|
||||
if (empty($option_checked_clone_array[Tools::link_rewrite($filter_name)]))
|
||||
unset($option_checked_clone_array[Tools::link_rewrite($filter_name)]);
|
||||
}
|
||||
$parameters = '';
|
||||
ksort($option_checked_clone_array); // Order parameters
|
||||
foreach ($option_checked_clone_array as $key_group => $value_group)
|
||||
$parameters .= '/'.str_replace('-', '_', $key_group).$value_group;
|
||||
$parameters .= '/'.str_replace(Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR'), '_', $key_group).$value_group;
|
||||
|
||||
// Check if there is an non indexable attribute or feature in the url
|
||||
foreach ($non_indexable as $value)
|
||||
|
||||
+189
-178
@@ -236,7 +236,7 @@ class Loyalty extends Module
|
||||
private function voucherCategories($categories)
|
||||
{
|
||||
$cat = '';
|
||||
if ($categories)
|
||||
if ($categories && is_array($categories))
|
||||
foreach ($categories as $category)
|
||||
$cat .= $category.',';
|
||||
return rtrim($cat, ',');
|
||||
@@ -247,187 +247,11 @@ class Loyalty extends Module
|
||||
$this->instanceDefaultStates();
|
||||
$this->_postProcess();
|
||||
|
||||
$order_states = OrderState::getOrderStates($this->context->language->id);
|
||||
$currency = new Currency((int)(Configuration::get('PS_CURRENCY_DEFAULT')));
|
||||
$id_lang_default = (int)Configuration::get('PS_LANG_DEFAULT');
|
||||
$languages = Language::getLanguages(false);
|
||||
$languageIds = 'voucher_details¤default_loyalty_state¤none_award_loyalty_state¤convert_loyalty_state¤validation_loyalty_state¤cancel_loyalty_state';
|
||||
|
||||
$this->html .= '
|
||||
<script type="text/javascript">
|
||||
id_language = Number('.$id_lang_default.');
|
||||
</script>
|
||||
<h2>'.$this->l('Loyalty Program').'</h2>
|
||||
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post">
|
||||
<fieldset>
|
||||
<legend>'.$this->l('Settings').'</legend>
|
||||
|
||||
<label>'.$this->l('Ratio').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="2" id="point_rate" name="point_rate" value="'.(float)(Configuration::get('PS_LOYALTY_POINT_RATE')).'" /> '.$currency->sign.'
|
||||
<label for="point_rate" class="t"> = '.$this->l('1 reward point').'.</label>
|
||||
<br />
|
||||
<label for="point_value" class="t">'.$this->l('1 point = ').'</label>
|
||||
<input type="text" size="2" name="point_value" id="point_value" value="'.(float)(Configuration::get('PS_LOYALTY_POINT_VALUE')).'" /> '.$currency->sign.'
|
||||
<label for="point_value" class="t">'.$this->l('for the discount').'.</label>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<label>'.$this->l('Voucher details').'</label>
|
||||
<div class="margin-form">';
|
||||
foreach ($languages as $language)
|
||||
$this->html .= '
|
||||
<div id="voucher_details_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $id_lang_default ? 'block' : 'none').'; float: left;">
|
||||
<input size="33" type="text" name="voucher_details_'.$language['id_lang'].'" value="'.Configuration::get('PS_LOYALTY_VOUCHER_DETAILS', (int)($language['id_lang'])).'" />
|
||||
</div>';
|
||||
$this->html .= $this->displayFlags($languages, $id_lang_default, $languageIds, 'voucher_details', true);
|
||||
$this->html .= ' </div>
|
||||
<div class="clear" style="margin-top: 20px"></div>
|
||||
<label>'.$this->l('Minimum amount in which the voucher can be used').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="2" name="minimal" value="'.(float)Configuration::get('PS_LOYALTY_MINIMAL').'" /> '.$currency->sign.'
|
||||
</div>
|
||||
<div class="clear" style="margin-top: 20px"></div>
|
||||
<label>'.$this->l('Give points on discounted products').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="PS_LOYALTY_NONE_AWARD" id="PS_LOYALTY_NONE_AWARD_on" value="1" '.(Configuration::get('PS_LOYALTY_NONE_AWARD') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="PS_LOYALTY_NONE_AWARD_on"><img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Yes').'" /></label>
|
||||
<input type="radio" name="PS_LOYALTY_NONE_AWARD" id="PS_LOYALTY_NONE_AWARD_off" value="0" '.(!Configuration::get('PS_LOYALTY_NONE_AWARD') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="PS_LOYALTY_NONE_AWARD_off"><img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('No').'" /></label>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<label>'.$this->l('Points are awarded when the order is').'</label>
|
||||
<div class="margin-form" style="margin-top:10px">
|
||||
<select id="id_order_state_validation" name="id_order_state_validation">';
|
||||
foreach ($order_states as $order_state)
|
||||
{
|
||||
$this->html .= '<option value="'.$order_state['id_order_state'].'" style="background-color:'.$order_state['color'].';"';
|
||||
if ((int)$this->loyaltyStateValidation->id_order_state == $order_state['id_order_state'])
|
||||
$this->html .= ' selected="selected"';
|
||||
$this->html .= '>'.$order_state['name'].'</option>';
|
||||
}
|
||||
$this->html .= '</select>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<label>'.$this->l('Points are cancelled when the order is').'</label>
|
||||
<div class="margin-form" style="margin-top:10px">
|
||||
<select id="id_order_state_cancel" name="id_order_state_cancel">';
|
||||
foreach ($order_states as $order_state)
|
||||
{
|
||||
$this->html .= '<option value="'.$order_state['id_order_state'].'" style="background-color:'.$order_state['color'].';"';
|
||||
if ((int)$this->loyaltyStateCancel->id_order_state == $order_state['id_order_state'])
|
||||
$this->html .= ' selected="selected"';
|
||||
$this->html .= '>'.$order_state['name'].'</option>';
|
||||
}
|
||||
$this->html .= '</select>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<label>'.$this->l('Vouchers created by the loyalty system can be used in the following categories :').'</label>';
|
||||
$index = explode(',', Configuration::get('PS_LOYALTY_VOUCHER_CATEGORY'));
|
||||
$indexedCategories = isset($_POST['categoryBox']) ? $_POST['categoryBox'] : $index;
|
||||
|
||||
$helper = new Helper();
|
||||
$this->html .= '<div class="margin-form">'.$helper->renderCategoryTree(null, $indexedCategories).'</div>';
|
||||
$this->html .= '
|
||||
<p style="padding-left:200px;">'.$this->l('Mark the box(es) of categories in which loyalty vouchers are usable.').'</p>
|
||||
<div class="clear"></div>
|
||||
<h3 style="margin-top:20px">'.$this->l('Loyalty points progression').'</h3>
|
||||
<label>'.$this->l('Initial').'</label>
|
||||
<div class="margin-form">';
|
||||
foreach ($languages as $language)
|
||||
$this->html .= '
|
||||
<div id="default_loyalty_state_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $id_lang_default ? 'block' : 'none').'; float: left;">
|
||||
<input size="33" type="text" name="default_loyalty_state_'.$language['id_lang'].'" value="'.(isset($this->loyaltyStateDefault->name[(int)($language['id_lang'])]) ? $this->loyaltyStateDefault->name[(int)($language['id_lang'])] : $this->loyaltyStateDefault->name[(int)$id_lang_default]).'" />
|
||||
</div>';
|
||||
$this->html .= $this->displayFlags($languages, $id_lang_default, $languageIds, 'default_loyalty_state', true);
|
||||
$this->html .= ' </div>
|
||||
<div class="clear"></div>
|
||||
<label>'.$this->l('Unavailable').'</label>
|
||||
<div class="margin-form">';
|
||||
foreach ($languages as $language)
|
||||
$this->html .= '
|
||||
<div id="none_award_loyalty_state_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $id_lang_default ? 'block' : 'none').'; float: left;">
|
||||
<input size="33" type="text" name="none_award_loyalty_state_'.$language['id_lang'].'" value="'.(isset($this->loyaltyStateNoneAward->name[(int)($language['id_lang'])]) ? $this->loyaltyStateNoneAward->name[(int)($language['id_lang'])] : $this->loyaltyStateNoneAward->name[(int)$id_lang_default]).'" />
|
||||
</div>';
|
||||
$this->html .= $this->displayFlags($languages, $id_lang_default, $languageIds, 'none_award_loyalty_state', true);
|
||||
$this->html .= ' </div>
|
||||
<div class="clear"></div>
|
||||
<label>'.$this->l('Converted').'</label>
|
||||
<div class="margin-form">';
|
||||
foreach ($languages as $language)
|
||||
$this->html .= '
|
||||
<div id="convert_loyalty_state_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $id_lang_default ? 'block' : 'none').'; float: left;">
|
||||
<input size="33" type="text" name="convert_loyalty_state_'.$language['id_lang'].'" value="'.(isset($this->loyaltyStateConvert->name[(int)($language['id_lang'])]) ? $this->loyaltyStateConvert->name[(int)($language['id_lang'])] : $this->loyaltyStateConvert->name[(int)$id_lang_default]).'" />
|
||||
</div>';
|
||||
$this->html .= $this->displayFlags($languages, $id_lang_default, $languageIds, 'convert_loyalty_state', true);
|
||||
$this->html .= ' </div>
|
||||
<div class="clear"></div>
|
||||
<label>'.$this->l('Validation').'</label>
|
||||
<div class="margin-form">';
|
||||
foreach ($languages as $language)
|
||||
$this->html .= '
|
||||
<div id="validation_loyalty_state_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $id_lang_default ? 'block' : 'none').'; float: left;">
|
||||
<input size="33" type="text" name="validation_loyalty_state_'.$language['id_lang'].'" value="'.(isset($this->loyaltyStateValidation->name[(int)($language['id_lang'])]) ? $this->loyaltyStateValidation->name[(int)($language['id_lang'])] : $this->loyaltyStateValidation->name[(int)$id_lang_default]).'" />
|
||||
</div>';
|
||||
$this->html .= $this->displayFlags($languages, $id_lang_default, $languageIds, 'validation_loyalty_state', true);
|
||||
$this->html .= ' </div>
|
||||
<div class="clear"></div>
|
||||
<label>'.$this->l('Cancelled').'</label>
|
||||
<div class="margin-form">';
|
||||
foreach ($languages as $language)
|
||||
$this->html .= '
|
||||
<div id="cancel_loyalty_state_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $id_lang_default ? 'block' : 'none').'; float: left;">
|
||||
<input size="33" type="text" name="cancel_loyalty_state_'.$language['id_lang'].'" value="'.(isset($this->loyaltyStateCancel->name[(int)($language['id_lang'])]) ? $this->loyaltyStateCancel->name[(int)($language['id_lang'])] : $this->loyaltyStateCancel->name[(int)$id_lang_default]).'" />
|
||||
</div>';
|
||||
$this->html .= $this->displayFlags($languages, $id_lang_default, $languageIds, 'cancel_loyalty_state', true);
|
||||
$this->html .= ' </div>
|
||||
<div class="clear center">
|
||||
<input type="submit" style="margin-top:20px" name="submitLoyalty" id="submitLoyalty" value="'.$this->l(' Save ').'" class="button" />
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
$this->html .= $this->renderForm();
|
||||
|
||||
return $this->html;
|
||||
}
|
||||
|
||||
public static function recurseCategoryForInclude($id_obj, $indexedCategories, $categories, $current, $id_category = 1, $id_category_default = null, $has_suite = array())
|
||||
{
|
||||
global $done;
|
||||
static $irow;
|
||||
$html = '';
|
||||
|
||||
if (!isset($done[$current['infos']['id_parent']]))
|
||||
$done[$current['infos']['id_parent']] = 0;
|
||||
$done[$current['infos']['id_parent']] += 1;
|
||||
|
||||
$todo = count($categories[$current['infos']['id_parent']]);
|
||||
$doneC = $done[$current['infos']['id_parent']];
|
||||
|
||||
$level = $current['infos']['level_depth'] + 1;
|
||||
|
||||
$html .= '
|
||||
<tr class="'.($irow++ % 2 ? 'alt_row' : '').'">
|
||||
<td>
|
||||
<input type="checkbox" name="categoryBox[]" class="categoryBox'.($id_category_default == $id_category ? ' id_category_default' : '').'" id="categoryBox_'.$id_category.'" value="'.$id_category.'"'.((in_array($id_category, $indexedCategories) || ((int)(Tools::getValue('id_category')) == $id_category && !(int)($id_obj))) ? ' checked="checked"' : '').' />
|
||||
</td>
|
||||
<td>
|
||||
'.$id_category.'
|
||||
</td>
|
||||
<td>';
|
||||
for ($i = 2; $i < $level; $i++)
|
||||
$html .= '<img src="../img/admin/lvl_'.$has_suite[$i - 2].'.gif" alt="" style="vertical-align: middle;"/>';
|
||||
$html .= '<img src="../img/admin/'.($level == 1 ? 'lv1.gif' : 'lv2_'.($todo == $doneC ? 'f' : 'b').'.gif').'" alt="" style="vertical-align: middle;"/>
|
||||
<label for="categoryBox_'.$id_category.'" class="t">'.stripslashes($current['infos']['name']).'</label></td>
|
||||
</tr>';
|
||||
|
||||
if ($level > 1)
|
||||
$has_suite[] = ($todo == $doneC ? 0 : 1);
|
||||
if (isset($categories[$id_category]))
|
||||
foreach ($categories[$id_category] as $key => $row)
|
||||
if ($key != 'infos')
|
||||
$html .= self::recurseCategoryForInclude($id_obj, $indexedCategories, $categories, $categories[$id_category][$key], $key, $id_category_default, $has_suite);
|
||||
return $html;
|
||||
}
|
||||
|
||||
/* Hook display on product detail */
|
||||
public function hookExtraRight($params)
|
||||
{
|
||||
@@ -672,4 +496,191 @@ class Loyalty extends Module
|
||||
|
||||
return (array_key_exists($key, $translations)) ? $translations[$key] : $key;
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$order_states = OrderState::getOrderStates($this->context->language->id);
|
||||
$currency = new Currency((int)(Configuration::get('PS_CURRENCY_DEFAULT')));
|
||||
if (Tools::getValue('categoryBox'))
|
||||
$selected_categories = Tools::getValue('categoryBox');
|
||||
else
|
||||
$selected_categories = explode(',', Configuration::get('PS_LOYALTY_VOUCHER_CATEGORY'));
|
||||
|
||||
$fields_form_1 = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Settings'),
|
||||
'icon' => 'icon-cogs'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Ratio'),
|
||||
'name' => 'point_rate',
|
||||
'prefix' => $currency->sign,
|
||||
'suffix' => $this->l('= 1 reward point.'),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('1 point ='),
|
||||
'name' => 'point_value',
|
||||
'prefix' => $currency->sign,
|
||||
'suffix' => $this->l('for the discount.'),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Voucher details'),
|
||||
'name' => 'voucher_details',
|
||||
'lang' => true,
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Minimum amount in which the voucher can be used'),
|
||||
'name' => 'minimal',
|
||||
'prefix' => $currency->sign,
|
||||
'class' => 'fixed-width-sm',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Points are awarded when the order is'),
|
||||
'name' => 'id_order_state_validation',
|
||||
'options' => array(
|
||||
'query' => $order_states,
|
||||
'id' => 'id_order_state',
|
||||
'name' => 'name',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Points are cancelled when the order is'),
|
||||
'name' => 'id_order_state_cancel',
|
||||
'options' => array(
|
||||
'query' => $order_states,
|
||||
'id' => 'id_order_state',
|
||||
'name' => 'name',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Give points on discounted products'),
|
||||
'name' => 'PS_LOYALTY_NONE_AWARD',
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'active_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled')
|
||||
),
|
||||
array(
|
||||
'id' => 'active_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled')
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'categories',
|
||||
'label' => $this->l('Vouchers created by the loyalty system can be used in the following categories :'),
|
||||
'name' => 'categoryBox',
|
||||
'desc' => $this->l('Mark the box(es) of categories in which loyalty vouchers are usable.'),
|
||||
'tree' => array(
|
||||
'use_search' => false,
|
||||
'id' => 'categoryBox',
|
||||
'use_checkbox' => true,
|
||||
'selected_categories' => $selected_categories,
|
||||
),
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
'class' => 'btn btn-primary')
|
||||
),
|
||||
);
|
||||
|
||||
$fields_form_2 = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Loyalty points progression'),
|
||||
'icon' => 'icon-cogs'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Initial'),
|
||||
'name' => 'default_loyalty_state',
|
||||
'lang' => true,
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Unavailable'),
|
||||
'name' => 'none_award_loyalty_state',
|
||||
'lang' => true,
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Converted'),
|
||||
'name' => 'convert_loyalty_state',
|
||||
'lang' => true,
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Validation'),
|
||||
'name' => 'validation_loyalty_state',
|
||||
'lang' => true,
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Cancelled'),
|
||||
'name' => 'cancel_loyalty_state',
|
||||
'lang' => true,
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
'class' => 'btn btn-primary')
|
||||
),
|
||||
);
|
||||
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = $this->table;
|
||||
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
$helper->default_form_language = $lang->id;
|
||||
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$helper->identifier = $this->identifier;
|
||||
$helper->submit_action = 'submitLoyalty';
|
||||
$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_1, $fields_form_2));
|
||||
}
|
||||
|
||||
public function getConfigFieldsValues()
|
||||
{
|
||||
$fields_values = array(
|
||||
'point_rate' => Tools::getValue('PS_LOYALTY_POINT_RATE', Configuration::get('PS_LOYALTY_POINT_RATE')),
|
||||
'point_value' => Tools::getValue('PS_LOYALTY_POINT_VALUE', Configuration::get('PS_LOYALTY_POINT_VALUE')),
|
||||
'PS_LOYALTY_NONE_AWARD' => Tools::getValue('PS_LOYALTY_NONE_AWARD', Configuration::get('PS_LOYALTY_NONE_AWARD')),
|
||||
'minimal' => Tools::getValue('PS_LOYALTY_MINIMAL', Configuration::get('PS_LOYALTY_MINIMAL')),
|
||||
'id_order_state_validation' => Tools::getValue('id_order_state_validation', $this->loyaltyStateValidation->id_order_state),
|
||||
'id_order_state_cancel' => Tools::getValue('id_order_state_cancel', $this->loyaltyStateCancel->id_order_state),
|
||||
|
||||
);
|
||||
|
||||
$languages = Language::getLanguages(false);
|
||||
|
||||
foreach ($languages as $lang)
|
||||
{
|
||||
$fields_values['voucher_details'][$lang['id_lang']] = Tools::getValue('voucher_details_'.(int)$lang['id_lang'], Configuration::get('PS_LOYALTY_VOUCHER_DETAILS', (int)$lang['id_lang']));
|
||||
$fields_values['default_loyalty_state'][$lang['id_lang']] = Tools::getValue('default_loyalty_state_'.(int)$lang['id_lang'], $this->loyaltyStateDefault->name[(int)($lang['id_lang'])]);
|
||||
$fields_values['validation_loyalty_state'][$lang['id_lang']] = Tools::getValue('validation_loyalty_state_'.(int)$lang['id_lang'], $this->loyaltyStateValidation->name[(int)($lang['id_lang'])]);
|
||||
$fields_values['cancel_loyalty_state'][$lang['id_lang']] = Tools::getValue('cancel_loyalty_state_'.(int)$lang['id_lang'], $this->loyaltyStateCancel->name[(int)($lang['id_lang'])]);
|
||||
$fields_values['convert_loyalty_state'][$lang['id_lang']] = Tools::getValue('convert_loyalty_state_'.(int)$lang['id_lang'], $this->loyaltyStateConvert->name[(int)($lang['id_lang'])]);
|
||||
$fields_values['none_award_loyalty_state'][$lang['id_lang']] = Tools::getValue('none_award_loyalty_state_'.(int)$lang['id_lang'], $this->loyaltyStateNoneAward->name[(int)($lang['id_lang'])]);
|
||||
}
|
||||
return $fields_values;
|
||||
}
|
||||
}
|
||||
@@ -659,7 +659,7 @@ function getProductAttribute()
|
||||
for (var i in attributesCombinations)
|
||||
for (var a in tab_attributes)
|
||||
if (attributesCombinations[i]['id_attribute'] === tab_attributes[a])
|
||||
request += '/'+attributesCombinations[i]['group'] + '-' + attributesCombinations[i]['attribute'];
|
||||
request += '/'+attributesCombinations[i]['group'] + attribute_anchor_separator + attributesCombinations[i]['attribute'];
|
||||
request = request.replace(request.substring(0, 1), '#/');
|
||||
url = window.location + '';
|
||||
|
||||
@@ -694,7 +694,7 @@ function checkUrl()
|
||||
if (tabParams[0] == '')
|
||||
tabParams.shift();
|
||||
for (var i in tabParams)
|
||||
tabValues.push(tabParams[i].split('-'));
|
||||
tabValues.push(tabParams[i].split(attribute_anchor_separator));
|
||||
product_id = $('#product_page_product_id').val();
|
||||
// fill html with values
|
||||
$('.color_pick').removeClass('selected');
|
||||
|
||||
@@ -23,9 +23,8 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
|
||||
<ul id="color_to_pick_list" class="clearfix">
|
||||
{foreach from=$colors_list item='color'}
|
||||
<li><a id="color_{$color.id_product_attribute|intval}" class="color_pick" style="background: {$color.color};"></a></li>
|
||||
<li><a href="{$link->getProductLink($color.id_product, null, null, null, null, null, $color.id_product_attribute)|escape:'htmlall':'UTF-8'}" id="color_{$color.id_product_attribute|intval}" class="color_pick" style="background: {$color.color};"></a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
|
||||
@@ -49,6 +49,7 @@ var availableNowValue = '{$product->available_now|escape:'quotes':'UTF-8'}';
|
||||
var availableLaterValue = '{$product->available_later|escape:'quotes':'UTF-8'}';
|
||||
var productPriceTaxExcluded = {$product->getPriceWithoutReduct(true)|default:'null'} - {$product->ecotax};
|
||||
var productBasePriceTaxExcluded = {$product->base_price} - {$product->ecotax};
|
||||
var attribute_anchor_separator = '{$attribute_anchor_separator|addslashes}';
|
||||
|
||||
var reduction_percent = {if $product->specificPrice AND $product->specificPrice.reduction AND $product->specificPrice.reduction_type == 'percentage'}{$product->specificPrice.reduction*100}{else}0{/if};
|
||||
var reduction_price = {if $product->specificPrice AND $product->specificPrice.reduction AND $product->specificPrice.reduction_type == 'amount'}{$product->specificPrice.reduction|floatval}{else}0{/if};
|
||||
|
||||
Reference in New Issue
Block a user