Ich hatte ein ähnliches Problem mit dem Update und dem Zerhauen der Preise. Allerdings lag das bei mir an einer anderen Stelle. Ich habe im Shop Preise über 1000 (Forint). Die Preise werden dann als 1,234.00 dargestellt, was natürlich nicht ganz der gewohnten Syntax des Shops entspricht.
ich habe das hier
<td class="dataTableContent" align="center"><input type="text" size="7" name="stock_update[
<?php echo $results['products_id'] ?>][price]" value="
<?php echo number_format($products_price_brutto,2,'.',','); ?>" onChange="
<?php echo $doChange?>" onBlur="
<?php echo $doValidate_flt ?>" /></td>
<td class="dataTableContent" align="right">
<?php echo number_format($results['products_price'],4,'.',','); ?></td>
durch das ersetzt
<td class="dataTableContent" align="center"><input type="text" size="7" name="stock_update[
<?php echo $results['products_id'] ?>][price]" value="
<?php echo number_format($products_price_brutto,2,'.',''); ?>" onChange="
<?php echo $doChange?>" onBlur="
<?php echo $doValidate_flt ?>" /></td>
<td class="dataTableContent" align="right">
<?php echo number_format($results['products_price'],4,'.',''); ?></td>
Damit werden die Preise dann wie gewohnt dargestellt. Sowohl netto als auch brutto und auch korrekt in die Datenbank übertragen, wenn man z.B. etwas dem Lager hinzufügt.
Das funktioniert aber nur wenn bei wie bei mir quasi alle preise über 1000 liegen. Damit da gar keine Formatierung mehr stattfindet habe ich diese Dezimalformatierungsgeschichte einfach komplett entfernt. Was ich im Prinzip besser finde, weil ja im ganzen Shop mit "." statt "," gearbeitet wird und dann ein Tausenderzeichen nur verwirrt.
Also folgendes noch entfernen:
statt:
$items_price = number_unformat($items['price']);
das einsetzen
$items_price = $items['price'];
und den Block komplett entfernen
// Function to remove formatted number - Added 2009/05/05 Azrin Aris function number_unformat
($input) { $curr = new currencies
(); $thousands_sep = $curr->currencies[DEFAULT_CURRENCY
]['thousands_point']; $decimal_point = $curr->currencies[DEFAULT_CURRENCY
]['decimal_point']; if ($thousands_sep == chr(160)) { // change non-breaking space into ordinary space $thousands_sep = chr(32); } // if $count = count_chars($input, 1); if ($count[ord($decimal_point)] > 1) { // too many decimal places return $input; } // if // split number into 2 distinct parts list($integer, $fraction) = explode($decimal_point, $input); // remove thousands separator $integer = str_replace($thousands_sep, NULL, $integer); // join the two parts back together again $number = $integer .'.' .$fraction; return $number; } // number_unformat