mastek Posted March 5, 2015 Share Posted March 5, 2015 Witam,chciałbym ustawić zaokrąglanie % w przypadku produktów przecenionych. Czyli np. jak jest 11,22% to aby było 11%, a jak np. 11,66% to 12% Na karcie produktu odpowiada za to: {$product.specific_prices.reduction*100} - ale może w innym miejscu można to zdefiniować i wtedy zmiana będzie globalna? Z góry dzięki za pomoc. Link to comment Share on other sites More sharing options...
maranc Posted March 5, 2015 Share Posted March 5, 2015 W szablonie daj: {$product.specific_prices.reduction*100|number_format:0}. Globalnie tego nie da się ustawić, no chyba że modyfikując pliki php.... Link to comment Share on other sites More sharing options...
hatak Posted March 5, 2015 Share Posted March 5, 2015 i pamietac trzeba, ze to tylko formatowanie wyswietlania , liczyc bedzie po staremu Link to comment Share on other sites More sharing options...
mastek Posted March 9, 2015 Author Share Posted March 9, 2015 Dziękuje jednak nic to nie zmieniło, wyczyściłem cache i prze-kompilowałem szablon. Nadal pojawiają się miejsca po przecinku np. 16.99% Przykładowy kod; <span id="reduction_percent_display"> {if $product->specificPrice && $product->specificPrice.reduction_type == 'percentage'}-{$product->specificPrice.reduction*100|number_format:0}%{/if} </span> Link to comment Share on other sites More sharing options...
Yabber Posted March 9, 2015 Share Posted March 9, 2015 (edited) Bo w winklach to jest php, a nie html. {$product->round(specificPrice.reduction*100)} Edited March 9, 2015 by Yabber (see edit history) Link to comment Share on other sites More sharing options...
mastek Posted March 9, 2015 Author Share Posted March 9, 2015 ok, tylko teraz to biała karta zamiast karty produktu Link to comment Share on other sites More sharing options...
Yabber Posted March 9, 2015 Share Posted March 9, 2015 Bo się walnąłem Tak jest OK. {if $product->specificPrice && $product->specificPrice.reduction_type == 'percentage'}-{round($product->specificPrice.reduction*100)}%{/if} 1 Link to comment Share on other sites More sharing options...
mastek Posted March 9, 2015 Author Share Posted March 9, 2015 Wielkie dzięki, i nie tyle co usuwa miejsca po przecinku to ładnie zaokrągla w dół i górę Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now