// Set default values

This commit is contained in:
Damien Metzger
2013-10-24 13:54:55 +02:00
parent 4bfd8dee11
commit a1df97776a
4 changed files with 38 additions and 12 deletions
+9
View File
@@ -52,6 +52,15 @@ abstract class PaymentModuleCore extends Module
// Insert countries availability
$return = $this->addCheckboxCountryRestrictionsForModule();
if (!Configuration::get('CONF_'.strtoupper($this->name).'_FIXED'))
Configuration::updateValue('CONF_'.strtoupper($this->name).'_FIXED', '0.2');
if (!Configuration::get('CONF_'.strtoupper($this->name).'_VAR'))
Configuration::updateValue('CONF_'.strtoupper($this->name).'_VAR', '2');
if (!Configuration::get('CONF_'.strtoupper($this->name).'_FIXED_FOREIGN'))
Configuration::updateValue('CONF_'.strtoupper($this->name).'_FIXED_FOREIGN', '0.2');
if (!Configuration::get('CONF_'.strtoupper($this->name).'_VAR_FOREIGN'))
Configuration::updateValue('CONF_'.strtoupper($this->name).'_VAR_FOREIGN', '2');
return $return;
}
@@ -90,7 +90,7 @@ class AdminDashboardControllerCore extends AdminController
'validation' => 'isPrice',
'cast' => 'floatval',
'type' => 'text',
'default' => '0',
'defaultValue' => '0',
'suffix' => $currency->iso_code
);
$forms['payment']['fields']['CONF_'.strtoupper($module->name).'_VAR'] = array(
@@ -99,7 +99,7 @@ class AdminDashboardControllerCore extends AdminController
'validation' => 'isPercentage',
'cast' => 'floatval',
'type' => 'text',
'default' => '0',
'defaultValue' => '0',
'suffix' => '%'
);
@@ -111,7 +111,7 @@ class AdminDashboardControllerCore extends AdminController
'validation' => 'isPrice',
'cast' => 'floatval',
'type' => 'text',
'default' => '0',
'defaultValue' => '0',
'suffix' => $currency->iso_code
);
$forms['payment']['fields']['CONF_'.strtoupper($module->name).'_VAR_FOREIGN'] = array(
@@ -120,7 +120,7 @@ class AdminDashboardControllerCore extends AdminController
'validation' => 'isPercentage',
'cast' => 'floatval',
'type' => 'text',
'default' => '0',
'defaultValue' => '0',
'suffix' => '%'
);
}
@@ -134,7 +134,7 @@ class AdminDashboardControllerCore extends AdminController
'validation' => 'isPercentage',
'cast' => 'floatval',
'type' => 'text',
'default' => '0',
'defaultValue' => '0',
'suffix' => '%'
);
$forms['carriers']['fields']['CONF_'.strtoupper($carrier['id_reference']).'_SHIP_OVERSEAS'] = array(
@@ -143,7 +143,7 @@ class AdminDashboardControllerCore extends AdminController
'validation' => 'isPercentage',
'cast' => 'floatval',
'type' => 'text',
'default' => '0',
'defaultValue' => '0',
'suffix' => '%'
);
}
@@ -154,7 +154,7 @@ class AdminDashboardControllerCore extends AdminController
'validation' => 'isPercentage',
'cast' => 'intval',
'type' => 'text',
'default' => '0',
'defaultValue' => '0',
'suffix' => '%'
);
@@ -163,7 +163,7 @@ class AdminDashboardControllerCore extends AdminController
'validation' => 'isPrice',
'cast' => 'floatval',
'type' => 'text',
'default' => '0',
'defaultValue' => '0',
'suffix' => $currency->iso_code
);
@@ -182,7 +182,7 @@ class AdminDashboardControllerCore extends AdminController
'validation' => 'isPrice',
'cast' => 'floatval',
'type' => 'text',
'default' => '0',
'defaultValue' => '0',
'suffix' => $currency->iso_code
);
+1
View File
@@ -66,6 +66,7 @@ UPDATE `PREFIX_configuration` SET value = '1' WHERE name = 'SUPPLIER_DISPLAY_FOR
UPDATE `PREFIX_configuration` SET value = '1' WHERE name = 'BLOCK_CATEG_NBR_COLUMN_FOOTER';
UPDATE `PREFIX_configuration` SET value = '' WHERE name = 'UPGRADER_BACKUPDB_FILENAME';
UPDATE `PREFIX_configuration` SET value = '' WHERE name = 'UPGRADER_BACKUPFILES_FILENAME';
UPDATE `PREFIX_configuration` SET value = '40' WHERE name = 'CONF_AVERAGE_PRODUCT_MARGIN';
/* No right column */
DELETE FROM `PREFIX_hook_module` WHERE id_hook = (SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayRightColumn');
+19 -3
View File
@@ -60,6 +60,19 @@ class Dashgoals extends Module
public function install()
{
for ($month = '01'; $month <= 12; $month = sprintf('%02d', $month + 1))
{
$key = strtoupper('dashgoals_traffic_'.$month.'_'.date('Y'));
if (!ConfigurationKPI::get($key))
ConfigurationKPI::updateValue($key, 600);
$key = strtoupper('dashgoals_conversion_'.$month.'_'.date('Y'));
if (!ConfigurationKPI::get($key))
ConfigurationKPI::updateValue($key, 2);
$key = strtoupper('dashgoals_avg_cart_value_'.$month.'_'.date('Y'));
if (!ConfigurationKPI::get($key))
ConfigurationKPI::updateValue($key, 80);
}
return (
parent::install()
&& $this->registerHook('dashboardZoneTwo')
@@ -118,18 +131,21 @@ class Dashgoals extends Module
$timestamp = strtotime($year.'-'.$i.'-01');
$goal = ConfigurationKPI::get(strtoupper('dashgoals_traffic_'.$i.'_'.$year));
$stream1['values'][] = array('x' => Dashgoals::$month_labels[$i], 'y' => ($goal ? $visits[$timestamp] / $goal : 0));
$value = 0;
if ($goal && isset($visits[$timestamp]))
$value = round($visits[$timestamp] / $goal);
$stream1['values'][] = array('x' => Dashgoals::$month_labels[$i], 'y' => $value);
$goal = ConfigurationKPI::get(strtoupper('dashgoals_conversion_'.$i.'_'.$year));
$value = 0;
if ($goal && isset($visits[$timestamp]) && $visits[$timestamp] && isset($orders[$timestamp]) && $orders[$timestamp])
$value = (100 * $orders[$timestamp] / $visits[$timestamp]) / $goal;
$value = round((100 * $orders[$timestamp] / $visits[$timestamp]) / $goal);
$stream2['values'][] = array('x' => Dashgoals::$month_labels[$i], 'y' => $value);
$goal = ConfigurationKPI::get(strtoupper('dashgoals_avg_cart_value_'.$i.'_'.$year));
$value = 0;
if ($goal && isset($orders[$timestamp]) && $orders[$timestamp] && isset($sales[$timestamp]) && $sales[$timestamp])
$value = ($sales[$timestamp] / $orders[$timestamp]) / $goal;
$value = round(($sales[$timestamp] / $orders[$timestamp]) / $goal);
$stream3['values'][] = array('x' => Dashgoals::$month_labels[$i], 'y' => $value);
}