Am acest cod :
Problema este ca nu calculeaza corect atunci cand SUBTOTAL este format din 4 cifre. (peste 1000)Cod PHP:<?php
/**
* Patch for shopp('cart','tax') in shopp 1.2.5
* Display tax after discounts subtracted
* Use with exclusive taxes
*/
/* get discount amount */
$discount = 0;
if(shopp('cart', 'has-promos')) {
$discount = shopp('cart','discount', 'return=true');
$parts = array();
preg_match('#[0-9]+(\.|,)[0-9]+#', $discount, $parts);
$discount = (float) str_replace(',', '.', $parts[0]);
}
/* get subtotal amount */
$subtotal = shopp('cart','subtotal', 'return=true');
$parts = array();
preg_match('#[0-9]+(\.|,)[0-9]+#', $subtotal, $parts);
$subtotal = (float) str_replace(',', '.', $parts[0]);
/* subtract discounts */
$subtotal = $subtotal - $discount;
/* get tax from final price */
$tax = $subtotal * shopp_taxrate(true);
$tax = money($tax);
echo $tax;
?>
Multumesc anticipat!!!



Răspunde cu citat
