Skip to content

Instantly share code, notes, and snippets.

@turingmachine
Created August 8, 2015 16:42
Show Gist options
  • Save turingmachine/79f4f0fa962780fa7de3 to your computer and use it in GitHub Desktop.
Save turingmachine/79f4f0fa962780fa7de3 to your computer and use it in GitHub Desktop.
diff -ru original/classes/Tools.php anpassungen/classes/Tools.php
--- original/classes/Tools.php 2015-08-06 01:01:52.116643359 +0200
+++ anpassungen/classes/Tools.php 2015-08-08 18:24:17.166218907 +0200
@@ -1626,6 +1626,8 @@
case PS_ROUND_HALF_ODD:
return Tools::math_round($value, $precision, Tools::$round_mode);
case PS_ROUND_HALF_UP:
+ case PS_ROUND_CHF_5CTS:
+ return round(20 * $value) / 20;
default:
return Tools::math_round($value, $precision, PS_ROUND_HALF_UP);
}
diff -ru original/config/defines.inc.php anpassungen/config/defines.inc.php
--- original/config/defines.inc.php 2015-08-06 01:01:51.797644042 +0200
+++ anpassungen/config/defines.inc.php 2015-08-08 18:24:16.225221061 +0200
@@ -150,6 +150,7 @@
/* Backward compatibility */
define('PS_ROUND_HALF', PS_ROUND_HALF_UP);
+define('PS_ROUND_CHF_5CTS', 6);
/* Registration behavior */
define('PS_REGISTRATION_PROCESS_STANDARD', 0);
@@ -195,4 +196,4 @@
define('_PS_SMARTY_CONSOLE_OPEN_BY_URL_', 1);
define('_PS_SMARTY_CONSOLE_OPEN_', 2);
diff -ru original/controllers/admin/AdminPreferencesController.php anpassungen/controllers/admin/AdminPreferencesController.php
--- original/controllers/admin/AdminPreferencesController.php 2015-08-06 01:01:51.545644581 +0200
+++ anpassungen/controllers/admin/AdminPreferencesController.php 2015-08-08 18:24:15.956221677 +0200
@@ -61,6 +61,10 @@
'value' => PS_ROUND_DOWN,
'name' => $this->l('Round down to the nearest value')
),
+ array(
+ 'value' => PS_ROUND_CHF_5CTS,
+ 'name' => $this->l('Round down to the nearest 5 cts value')
+ ),
);
$activities1 = array(
0 => $this->l('-- Please choose your main activity --'),
diff -ru original/themes/sn/js/tools.js anpassungen/themes/sn/js/tools.js
--- original/themes/sn/js/tools.js 2015-08-06 01:01:52.696642116 +0200
+++ anpassungen/themes/sn/js/tools.js 2015-08-08 18:24:16.843219646 +0200
@@ -35,6 +35,8 @@
return ceilf(value, precision);
else if (method === 1)
return floorf(value, precision);
+ else if (method === 6)
+ return Math.round(20 * value) / 20;
precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
return Math.round(value * precisionFactor) / precisionFactor;
}
diff -ru original/themes/sn/modules/blockcart/blockcart.tpl anpassungen/themes/sn/modules/blockcart/blockcart.tpl
--- original/themes/sn/modules/blockcart/blockcart.tpl 2015-08-08 18:34:04.728883585 +0200
+++ anpassungen/themes/sn/modules/blockcart/blockcart.tpl 2015-08-08 18:34:37.591810884 +0200
@@ -10,9 +10,9 @@
<a href="{$link->getPageLink("$order_process", true)|escape:'html'}" title="{l s='View my shopping cart' mod='blockcart'}" rel="nofollow" >
<span>
- <span class="ajax_cart_quantity color">{if $cart_qties > 1}{$cart_qties}{else}0{/if}</span>
- <span class="ajax_cart_product_txt{if $cart_qties > 1} hidden{/if}">{l s='Produkt' mod='blockuserinfo'}</span>
- <span class="ajax_cart_product_txt_s{if $cart_qties < 2 } hidden{/if}">{l s='Produkte' mod='blockuserinfo'}</span>
+ <span class="ajax_cart_quantity color">{if $cart_qties > 0}{$cart_qties}{else}0{/if}</span>
+ <span class="ajax_cart_product_txt{if $cart_qties == 0 || $cart_qties > 1} hidden{/if}">{l s='Produkt' mod='blockuserinfo'}</span>
+ <span class="ajax_cart_product_txt_s{if $cart_qties == 1 } hidden{/if}">{l s='Produkte' mod='blockuserinfo'}</span>
für <span class="color ajax_block_cart_total">{if $total} {$total}{else}00.-{/if}</span> <span class="imkorb">im Korb</span>
</span>
</a>
diff -ru original/themes/sn/modules/blockspecials/blockspecials.tpl anpassungen/themes/sn/modules/blockspecials/blockspecials.tpl
--- original/themes/sn/modules/blockspecials/blockspecials.tpl 2015-08-08 18:39:13.079201439 +0200
+++ anpassungen/themes/sn/modules/blockspecials/blockspecials.tpl 2015-08-08 18:39:23.377178657 +0200
@@ -39,7 +39,7 @@
{if $special.specific_prices}
{assign var='specific_prices' value=$special.specific_prices}
{if $specific_prices.reduction_type == 'percentage' && ($specific_prices.from == $specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $specific_prices.from))}
- <span class="reduction"><span>-{$specific_prices.reduction*100|floatval}%</span></span>
+ <span class="reduction"><span>-{($specific_prices.reduction*100-($specific_prices.reduction*100*.1)+.1+10)|round:0}%</span></span>
{/if}
{/if}
{/if}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment