chore: clean up code structure and remove unused code blocks
This commit is contained in:
@@ -152,10 +152,11 @@ class OmnibusEuFree extends Module
|
||||
{
|
||||
$currency = $this->context->currency;
|
||||
$lastMinimalPrice = $this->getLastMinimalPrice($params['product']['id_product'], $params['product']['id_product_attribute'], $currency->id);
|
||||
$regularPrice = isset($params['product']['regular_price']) ? $params['product']['regular_price'] : null;
|
||||
|
||||
if (!empty($lastMinimalPrice)) {
|
||||
$minimalPrice = PrestashopCompatibility::formatPrice(_PS_VERSION_, $lastMinimalPrice['price'], $currency);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$minimalPrice = null;
|
||||
}
|
||||
@@ -164,6 +165,7 @@ class OmnibusEuFree extends Module
|
||||
'OmnibuseufreeInfoVersion' => (int) Configuration::get('OMNIBUSEUFREE_INFORMATION_VERSION', null, null, null, 2),
|
||||
'OmnibuseufreeProductPriceMin' => $minimalPrice,
|
||||
'OmnibuseufreeProductPriceCurrent' => $params['product']['price'],
|
||||
'OmnibuseufreeProductPriceRegular' => $regularPrice,
|
||||
'OmnibuseufreeProductDiscount' => (bool) $params['product']['has_discount'],
|
||||
'OmnibuseufreeNumberOfDays' => (int) Configuration::get('OMNIBUSEUFREE_DAYS', null, null, null, 30),
|
||||
]);
|
||||
@@ -373,7 +375,7 @@ class OmnibusEuFree extends Module
|
||||
'label' => $this->l('Version:'),
|
||||
'name' => 'OMNIBUSEUFREE_INFORMATION_VERSION',
|
||||
'class' => 'omnibus-select-version',
|
||||
'required' => true,
|
||||
'required' => true,
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
@@ -390,8 +392,8 @@ class OmnibusEuFree extends Module
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Number of days'),
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Number of days'),
|
||||
'name' => 'OMNIBUSEUFREE_DAYS',
|
||||
'class' => 'omnibus-input-days',
|
||||
'maxlength' => '3',
|
||||
@@ -454,10 +456,10 @@ class OmnibusEuFree extends Module
|
||||
|
||||
/**
|
||||
* Set values for the inputs.
|
||||
*
|
||||
* OMNIBUSEUFREE_CRON_STATUS since v1.0.2
|
||||
* OMNIBUSEUFREE_DAYS since v1.0.2
|
||||
*
|
||||
*
|
||||
* OMNIBUSEUFREE_CRON_STATUS since v1.0.2
|
||||
* OMNIBUSEUFREE_DAYS since v1.0.2
|
||||
*
|
||||
*/
|
||||
protected function getConfigFormValues()
|
||||
{
|
||||
@@ -480,7 +482,7 @@ class OmnibusEuFree extends Module
|
||||
if (Configuration::get('OMNIBUSEUFREE_CRON_STATUS', null, null, null, 2) != Tools::getValue('OMNIBUSEUFREE_CRON_STATUS')) {
|
||||
Configuration::updateValue('OMNIBUSEUFREE_CRON_TOKEN', Tools::hash(Tools::passwdGen(16)));
|
||||
}
|
||||
|
||||
|
||||
Configuration::updateValue('OMNIBUSEUFREE_INFORMATION_VERSION', (int) Tools::getValue('OMNIBUSEUFREE_INFORMATION_VERSION'));
|
||||
Configuration::updateValue('OMNIBUSEUFREE_DISPLAY_PRODUCT_PRICE_BLOCK', (int) Tools::getValue('OMNIBUSEUFREE_DISPLAY_PRODUCT_PRICE_BLOCK'));
|
||||
Configuration::updateValue('OMNIBUSEUFREE_CRON_STATUS', (int) Tools::getValue('OMNIBUSEUFREE_CRON_STATUS'));
|
||||
@@ -538,7 +540,7 @@ class OmnibusEuFree extends Module
|
||||
$ToChange++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$ToChange++;
|
||||
}
|
||||
@@ -570,7 +572,7 @@ class OmnibusEuFree extends Module
|
||||
if ($currency['id_currency'] == $defaultCurrency->id) {
|
||||
$isDefaultCurrency = 1;
|
||||
$product_price_currency = $product_price;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$isDefaultCurrency = 0;
|
||||
$product_price_currency = Tools::convertPrice($product_price, $currency);
|
||||
@@ -611,7 +613,7 @@ class OmnibusEuFree extends Module
|
||||
if ($currency['id_currency'] == $defaultCurrency->id) {
|
||||
$isDefaultCurrency = 1;
|
||||
$product_price_currency = $product_price;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$isDefaultCurrency = 0;
|
||||
$product_price_currency = Tools::convertPrice($product_price, $currency);
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
{l s='Lowest price in %d days before discount: ' sprintf=[$OmnibuseufreeNumberOfDays] mod='omnibuseufree'}<span class="presta-studio-price-history-price">{$OmnibuseufreeProductPriceMin}</span>
|
||||
{else}
|
||||
{* when history is empty *}
|
||||
{l s='Lowest price in %d days: ' sprintf=[$OmnibuseufreeNumberOfDays] mod='omnibuseufree'}<span class="presta-studio-price-history-price">{$OmnibuseufreeProductPriceCurrent}</span>
|
||||
{l s='Lowest price in %d days: ' sprintf=[$OmnibuseufreeNumberOfDays] mod='omnibuseufree'}<span class="presta-studio-price-history-price">{$OmnibuseufreeProductPriceRegular|default:$OmnibuseufreeProductPriceCurrent}</span>
|
||||
{/if}
|
||||
{else}
|
||||
{l s='Lowest price in %d days: ' sprintf=[$OmnibuseufreeNumberOfDays] mod='omnibuseufree'}<span class="presta-studio-price-history-price">{$OmnibuseufreeProductPriceMin}</span>
|
||||
{/if}
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user