|
|||
|
Hallo,
nach 2 Wochen Dauer-Suchmaschinen-Quälen hoffe ich mit einer neuen Anfrage hier eine Lösung zu finden.... 1. Problem: Bei allen Artikeln, die ich mit mehreren Attributen Optionen einstelle erscheint auf der jeweiligen Seite des Artikel oben die Fehlermeldung: Zitat:
Vorläufige Lösung(!!!): die Meldung verschwindet, wenn man bei den Artikelattributen beim Preis nicht 0 eingibt sondern z.B. 0.0001. Es ist also ein Problem mit dem Artikelpreis 0.00 bei Attributen... 2. Problem: Im Warenkorb erscheint immer oben die Meldung: Zitat:
Kennt jemand die Fehler bzw. die Ursachen, oder besser noch die Lösungen? Vielen Dank schonmal im vorraus! Ich bin langsam am verzweifeln.... Aso... hier noch die entsprechenden Ausschnitte aus den genannten Dateien (rot und fett= die jeweils genannte Zeile): Datei "includes/classes/xtcPrice.php" Code:
<?php
/* -----------------------------------------------------------------------------------------
$Id: xtcPrice.php 1316 2005-10-21 15:30:58Z mz $
XT-Commerce - community made shopping
http://www.xt-commerce.com
Copyright (c) 2003 XT-Commerce
-----------------------------------------------------------------------------------------
based on:
(c) 2000-2001 The Exchange Project (earlier name of osCommerce)
(c) 2002-2003 osCommerce(currencies.php,v 1.15 2003/03/17); www.oscommerce.com
(c) 2003 nextcommerce (currencies.php,v 1.9 2003/08/17); www.nextcommerce.org
Released under the GNU General Public License
---------------------------------------------------------------------------------------*/
class xtcPrice {
var $currencies;
// class constructor
function xtcPrice($currency, $cGroup) {
$this->currencies = array ();
$this->cStatus = array ();
$this->actualGroup = $cGroup;
$this->actualCurr = $currency;
$this->TAX = array ();
$this->SHIPPING = array();
$this->showFrom_Attributes = true;
// select Currencies
$currencies_query = "SELECT *
FROM
".TABLE_CURRENCIES;
$currencies_query = xtDBquery($currencies_query);
while ($currencies = xtc_db_fetch_array($currencies_query, true)) {
$this->currencies[$currencies['code']] = array ('title' => $currencies['title'], 'symbol_left' => $currencies['symbol_left'], 'symbol_right' => $currencies['symbol_right'], 'decimal_point' => $currencies['decimal_point'], 'thousands_point' => $currencies['thousands_point'], 'decimal_places' => $currencies['decimal_places'], 'value' => $currencies['value']);
}
// select Customers Status data
$customers_status_query = "SELECT *
FROM
".TABLE_CUSTOMERS_STATUS."
WHERE
customers_status_id = '".$this->actualGroup."' AND language_id = '".$_SESSION['languages_id']."'";
$customers_status_query = xtDBquery($customers_status_query);
$customers_status_value = xtc_db_fetch_array($customers_status_query, true);
$this->cStatus = array ('customers_status_id' => $this->actualGroup, 'customers_status_name' => $customers_status_value['customers_status_name'], 'customers_status_image' => $customers_status_value['customers_status_image'], 'customers_status_public' => $customers_status_value['customers_status_public'], 'customers_status_discount' => $customers_status_value['customers_status_discount'], 'customers_status_ot_discount_flag' => $customers_status_value['customers_status_ot_discount_flag'], 'customers_status_ot_discount' => $customers_status_value['customers_status_ot_discount'], 'customers_status_graduated_prices' => $customers_status_value['customers_status_graduated_prices'], 'customers_status_show_price' => $customers_status_value['customers_status_show_price'], 'customers_status_show_price_tax' => $customers_status_value['customers_status_show_price_tax'], 'customers_status_add_tax_ot' => $customers_status_value['customers_status_add_tax_ot'], 'customers_status_payment_unallowed' => $customers_status_value['customers_status_payment_unallowed'], 'customers_status_shipping_unallowed' => $customers_status_value['customers_status_shipping_unallowed'], 'customers_status_discount_attributes' => $customers_status_value['customers_status_discount_attributes'], 'customers_fsk18' => $customers_status_value['customers_fsk18'], 'customers_fsk18_display' => $customers_status_value['customers_fsk18_display']);
// prefetch tax rates for standard zone
$zones_query = xtDBquery("SELECT tax_class_id as class FROM ".TABLE_TAX_CLASS);
while ($zones_data = xtc_db_fetch_array($zones_query,true)) {
// calculate tax based on shipping or deliverey country (for downloads)
if (isset($_SESSION['billto']) && isset($_SESSION['sendto'])) {
$tax_address_query = xtc_db_query("select ab.entry_country_id, ab.entry_zone_id from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) where ab.customers_id = '" . $_SESSION['customer_id'] . "' and ab.address_book_id = '" . ($this->content_type == 'virtual' ? $_SESSION['billto'] : $_SESSION['sendto']) . "'");
$tax_address = xtc_db_fetch_array($tax_address_query);
$this->TAX[$zones_data['class']]=xtc_get_tax_rate($zones_data['class'],$tax_address['entry_country_id'], $tax_address['entry_zone_id']);
} else {
$this->TAX[$zones_data['class']]=xtc_get_tax_rate($zones_data['class']);
}
}
}
// get products Price
function xtcGetPrice($pID, $format = true, $qty, $tax_class, $pPrice, $vpeStatus = 0, $cedit_id = 0) {
// check if group is allowed to see prices
if ($this->cStatus['customers_status_show_price'] == '0')
return $this->xtcShowNote($vpeStatus, $vpeStatus);
// get Tax rate
if ($cedit_id != 0) {
$cinfo = xtc_oe_customer_infos($cedit_id);
$products_tax = xtc_get_tax_rate($tax_class, $cinfo['country_id'], $cinfo['zone_id']);
} else {
$products_tax = $this->TAX[$tax_class];
}
if ($this->cStatus['customers_status_show_price_tax'] == '0')
$products_tax = '';
// add taxes
if ($pPrice == 0)
$pPrice = $this->getPprice($pID);
$pPrice = $this->xtcAddTax($pPrice, $products_tax);
// check specialprice
if ($sPrice = $this->xtcCheckSpecial($pID))
return $this->xtcFormatSpecial($pID, $this->xtcAddTax($sPrice, $products_tax), $pPrice, $format, $vpeStatus);
// check graduated
if ($this->cStatus['customers_status_graduated_prices'] == '1') {
if ($sPrice = $this->xtcGetGraduatedPrice($pID, $qty))
return $this->xtcFormatSpecialGraduated($pID, $this->xtcAddTax($sPrice, $products_tax), $pPrice, $format, $vpeStatus, $pID);
} else {
// check Group Price
if ($sPrice = $this->xtcGetGroupPrice($pID, 1))
return $this->xtcFormatSpecialGraduated($pID, $this->xtcAddTax($sPrice, $products_tax), $pPrice, $format, $vpeStatus, $pID);
}
// check Product Discount
if ($discount = $this->xtcCheckDiscount($pID))
return $this->xtcFormatSpecialDiscount($pID, $discount, $pPrice, $format, $vpeStatus);
return $this->xtcFormat($pPrice, $format, 0, false, $vpeStatus, $pID);
}
function getPprice($pID) {
$pQuery = "SELECT products_price FROM ".TABLE_PRODUCTS." WHERE products_id='".$pID."'";
$pQuery = xtDBquery($pQuery);
$pData = xtc_db_fetch_array($pQuery, true);
return $pData['products_price'];
}
function xtcAddTax($price, $tax) {
$price = $price + $price / 100 * $tax;
$price = $this->xtcCalculateCurr($price);
return round($price, $this->currencies[$this->actualCurr]['decimal_places']);
}
function xtcCheckDiscount($pID) {
// check if group got discount
if ($this->cStatus['customers_status_discount'] != '0.00') {
$discount_query = "SELECT products_discount_allowed FROM ".TABLE_PRODUCTS." WHERE products_id = '".$pID."'";
$discount_query = xtDBquery($discount_query);
$dData = xtc_db_fetch_array($discount_query, true);
$discount = $dData['products_discount_allowed'];
if ($this->cStatus['customers_status_discount'] < $discount)
$discount = $this->cStatus['customers_status_discount'];
if ($discount == '0.00')
return false;
return $discount;
}
return false;
}
function xtcGetGraduatedPrice($pID, $qty) {
if (GRADUATED_ASSIGN == 'true')
if (xtc_get_qty($pID) > $qty)
$qty = xtc_get_qty($pID);
//if (!is_int($this->cStatus['customers_status_id']) && $this->cStatus['customers_status_id']!=0) $this->cStatus['customers_status_id'] = DEFAULT_CUSTOMERS_STATUS_ID_GUEST;
$graduated_price_query = "SELECT max(quantity) as qty
FROM ".TABLE_PERSONAL_OFFERS_BY.$this->actualGroup."
WHERE products_id='".$pID."'
AND quantity<='".$qty."'";
$graduated_price_query = xtDBquery($graduated_price_query);
$graduated_price_data = xtc_db_fetch_array($graduated_price_query, true);
if ($graduated_price_data['qty']) {
$graduated_price_query = "SELECT personal_offer
FROM ".TABLE_PERSONAL_OFFERS_BY.$this->actualGroup."
WHERE products_id='".$pID."'
AND quantity='".$graduated_price_data['qty']."'";
$graduated_price_query = xtDBquery($graduated_price_query);
$graduated_price_data = xtc_db_fetch_array($graduated_price_query, true);
$sPrice = $graduated_price_data['personal_offer'];
if ($sPrice != 0.00)
return $sPrice;
} else {
return;
}
}
function xtcGetGroupPrice($pID, $qty) {
$graduated_price_query = "SELECT max(quantity) as qty
FROM ".TABLE_PERSONAL_OFFERS_BY.$this->actualGroup."
WHERE products_id='".$pID."'
AND quantity<='".$qty."'";
$graduated_price_query = xtDBquery($graduated_price_query);
$graduated_price_data = xtc_db_fetch_array($graduated_price_query, true);
if ($graduated_price_data['qty']) {
$graduated_price_query = "SELECT personal_offer
FROM ".TABLE_PERSONAL_OFFERS_BY.$this->actualGroup."
WHERE products_id='".$pID."'
AND quantity='".$graduated_price_data['qty']."'";
$graduated_price_query = xtDBquery($graduated_price_query);
$graduated_price_data = xtc_db_fetch_array($graduated_price_query, true);
$sPrice = $graduated_price_data['personal_offer'];
if ($sPrice != 0.00)
return $sPrice;
} else {
return;
}
}
function xtcGetOptionPrice($pID, $option, $value) {
$attribute_price_query = "select pd.products_discount_allowed,pd.products_tax_class_id, p.options_values_price, p.price_prefix, p.options_values_weight, p.weight_prefix from ".TABLE_PRODUCTS_ATTRIBUTES." p, ".TABLE_PRODUCTS." pd where p.products_id = '".$pID."' and p.options_id = '".$option."' and pd.products_id = p.products_id and p.options_values_id = '".$value."'";
$attribute_price_query = xtDBquery($attribute_price_query);
$attribute_price_data = xtc_db_fetch_array($attribute_price_query, true);
$dicount = 0;
if ($this->cStatus['customers_status_discount_attributes'] == 1 && $this->cStatus['customers_status_discount'] != 0.00) {
$discount = $this->cStatus['customers_status_discount'];
if ($attribute_price_data['products_discount_allowed'] < $this->cStatus['customers_status_discount'])
$discount = $attribute_price_data['products_discount_allowed'];
}
$price = $this->xtcFormat($attribute_price_data['options_values_price'], false, $attribute_price_data['products_tax_class_id']);
if ($attribute_price_data['weight_prefix'] != '+')
$attribute_price_data['options_values_weight'] *= -1;
if ($attribute_price_data['price_prefix'] == '+') {
$price = $price - $price / 100 * $discount;
} else {
$price *= -1;
}
return array ('weight' => $attribute_price_data['options_values_weight'], 'price' => $price);
}
function xtcShowNote($vpeStatus, $vpeStatus = 0) {
if ($vpeStatus == 1)
return array ('formated' => NOT_ALLOWED_TO_SEE_PRICES, 'plain' => 0);
return NOT_ALLOWED_TO_SEE_PRICES;
}
function xtcCheckSpecial($pID) {
$product_query = "select specials_new_products_price from ".TABLE_SPECIALS." where products_id = '".$pID."' and status=1";
$product_query = xtDBquery($product_query);
$product = xtc_db_fetch_array($product_query, true);
return $product['specials_new_products_price'];
}
function xtcCalculateCurr($price) {
return $this->currencies[$this->actualCurr]['value'] * $price;
}
function calcTax($price, $tax) {
return $price * $tax / 100;
}
function xtcRemoveCurr($price) {
// check if used Curr != DEFAULT curr
if (DEFAULT_CURRENCY != $this->actualCurr) {
return $price * (1 / $this->currencies[$this->actualCurr]['value']);
} else {
return $price;
}
}
function xtcRemoveTax($price, $tax) {
$price = ($price / (($tax +100) / 100));
return $price;
}
function xtcGetTax($price, $tax) {
$tax = $price - $this->xtcRemoveTax($price, $tax);
return $tax;
}
function xtcRemoveDC($price,$dc) {
$price = $price - ($price/100*$dc);
return $price;
}
function xtcGetDC($price,$dc) {
$dc = $price/100*$dc;
return $dc;
}
function checkAttributes($pID) {
if (!$this->showFrom_Attributes) return;
if ($pID == 0)
return;
$products_attributes_query = "select count(*) as total from ".TABLE_PRODUCTS_OPTIONS." popt, ".TABLE_PRODUCTS_ATTRIBUTES." patrib where patrib.products_id='".$pID."' and patrib.options_id = popt.products_options_id and popt.language_id = '".(int) $_SESSION['languages_id']."'";
$products_attributes = xtDBquery($products_attributes_query);
$products_attributes = xtc_db_fetch_array($products_attributes, true);
if ($products_attributes['total'] > 0)
return ' '.strtolower(FROM).' ';
}
function xtcCalculateCurrEx($price, $curr) {
return $price * ($this->currencies[$curr]['value'] / $this->currencies[$this->actualCurr]['value']);
}
/*
*
* Format Functions
*
*
*
*/
function xtcFormat($price, $format, $tax_class = 0, $curr = false, $vpeStatus = 0, $pID = 0) {
if ($curr)
$price = $this->xtcCalculateCurr($price);
if ($tax_class != 0) {
$products_tax = $this->TAX[$tax_class];
if ($this->cStatus['customers_status_show_price_tax'] == '0')
$products_tax = '';
$price = $this->xtcAddTax($price, $products_tax);
}
if ($format) {
$Pprice = number_format($price, $this->currencies[$this->actualCurr]['decimal_places'], $this->currencies[$this->actualCurr]['decimal_point'], $this->currencies[$this->actualCurr]['thousands_point']);
$Pprice = $this->checkAttributes($pID).$this->currencies[$this->actualCurr]['symbol_left'].' '.$Pprice.' '.$this->currencies[$this->actualCurr]['symbol_right'];
if ($vpeStatus == 0) {
return $Pprice;
} else {
return array ('formated' => $Pprice, 'plain' => $price);
}
} else {
return round($price, $this->currencies[$this->actualCurr]['decimal_places']);
}
}
function xtcFormatSpecialDiscount($pID, $discount, $pPrice, $format, $vpeStatus = 0) {
$sPrice = $pPrice - ($pPrice / 100) * $discount;
if ($format) {
$price = '<span class="productOldPrice">'.INSTEAD.$this->xtcFormat($pPrice, $format).'</span><br />'.ONLY.$this->checkAttributes($pID).$this->xtcFormat($sPrice, $format).'<br />'.YOU_SAVE.$discount.'%';
if ($vpeStatus == 0) {
return $price;
} else {
return array ('formated' => $price, 'plain' => $sPrice);
}
} else {
return round($sPrice, $this->currencies[$this->actualCurr]['decimal_places']);
}
}
function xtcFormatSpecial($pID, $sPrice, $pPrice, $format, $vpeStatus = 0) {
if ($format) {
$price = '<span class="productOldPrice">'.INSTEAD.$this->xtcFormat($pPrice, $format).'</span><br />'.ONLY.$this->checkAttributes($pID).$this->xtcFormat($sPrice, $format);
if ($vpeStatus == 0) {
return $price;
} else {
return array ('formated' => $price, 'plain' => $sPrice);
}
} else {
return round($sPrice, $this->currencies[$this->actualCurr]['decimal_places']);
}
}
function xtcFormatSpecialGraduated($pID, $sPrice, $pPrice, $format, $vpeStatus = 0, $pID) {
if ($pPrice == 0)
return $this->xtcFormat($sPrice, $format, 0, false, $vpeStatus);
if ($discount = $this->xtcCheckDiscount($pID))
$sPrice -= $sPrice / 100 * $discount;
if ($format) {
if ($sPrice != $pPrice) {
$price = '<span class="productOldPrice">'.MSRP.$this->xtcFormat($pPrice, $format).'</span><br />'.YOUR_PRICE.$this->checkAttributes($pID).$this->xtcFormat($sPrice, $format);
} else {
$price = FROM.$this->xtcFormat($sPrice, $format);
}
if ($vpeStatus == 0) {
return $price;
} else {
return array ('formated' => $price, 'plain' => $sPrice);
}
} else {
return round($sPrice, $this->currencies[$this->actualCurr]['decimal_places']);
}
}
function get_decimal_places($code) {
return $this->currencies[$this->actualCurr]['decimal_places'];
}
}
?>
Code:
<?php
/* -----------------------------------------------------------------------------------------
$Id: order_details_cart.php 1281 2005-10-03 09:30:17Z mz $
XT-Commerce - community made shopping
http://www.xt-commerce.com
Copyright (c) 2003 XT-Commerce
-----------------------------------------------------------------------------------------
based on:
(c) 2000-2001 The Exchange Project (earlier name of osCommerce)
(c) 2002-2003 osCommerce(order_details.php,v 1.8 2003/05/03); www.oscommerce.com
(c) 2003 nextcommerce (order_details.php,v 1.16 2003/08/17); www.nextcommerce.org
Released under the GNU General Public License
-----------------------------------------------------------------------------------------
Third Party contribution:
Customers Status v3.x (c) 2002-2003 Copyright Elari elari@free.fr | www.unlockgsm.com/dload-osc/ | CVS : http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/elari/?sortby=date#dirlist
Credit Class/Gift Vouchers/Discount Coupons (Version 5.10)
http://www.oscommerce.com/community/contributions,282
Copyright (c) Strider | Strider@oscworks.com
Copyright (c Nick Stanko of UkiDev.com, nick@ukidev.com
Copyright (c) Andre ambidex@gmx.net
Copyright (c) 2001,2002 Ian C Wilson http://www.phesis.org
Released under the GNU General Public License
---------------------------------------------------------------------------------------*/
$module_smarty = new Smarty;
$module_smarty->assign('tpl_path', 'templates/'.CURRENT_TEMPLATE.'/');
// include needed functions
require_once (DIR_FS_INC.'xtc_check_stock.inc.php');
require_once (DIR_FS_INC.'xtc_get_products_stock.inc.php');
require_once (DIR_FS_INC.'xtc_remove_non_numeric.inc.php');
require_once (DIR_FS_INC.'xtc_get_short_description.inc.php');
require_once (DIR_FS_INC.'xtc_format_price.inc.php');
require_once (DIR_FS_INC.'xtc_get_attributes_model.inc.php');
$module_content = array ();
$any_out_of_stock = '';
$mark_stock = '';
for ($i = 0, $n = sizeof($products); $i < $n; $i ++) {
if (STOCK_CHECK == 'true') {
$mark_stock = xtc_check_stock($products[$i]['id'], $products[$i]['quantity']);
if ($mark_stock)
$_SESSION['any_out_of_stock'] = 1;
}
$image = '';
if ($products[$i]['image'] != '') {
$image = DIR_WS_THUMBNAIL_IMAGES.$products[$i]['image'];
}
$module_content[$i] = array ('PRODUCTS_NAME' => $products[$i]['name'].$mark_stock, 'PRODUCTS_QTY' => xtc_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="2"').xtc_draw_hidden_field('products_id[]', $products[$i]['id']).xtc_draw_hidden_field('old_qty[]', $products[$i]['quantity']), 'PRODUCTS_MODEL' => $products[$i]['model'],'PRODUCTS_SHIPPING_TIME'=>$products[$i]['shipping_time'], 'PRODUCTS_TAX' => number_format($products[$i]['tax'], TAX_DECIMAL_PLACES), 'PRODUCTS_IMAGE' => $image, 'IMAGE_ALT' => $products[$i]['name'], 'BOX_DELETE' => xtc_draw_checkbox_field('cart_delete[]', $products[$i]['id']), 'PRODUCTS_LINK' => xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($products[$i]['id'], $products[$i]['name'])), 'PRODUCTS_PRICE' => $xtPrice->xtcFormat($products[$i]['price'] * $products[$i]['quantity'], true), 'PRODUCTS_SINGLE_PRICE' =>$xtPrice->xtcFormat($products[$i]['price'], true), 'PRODUCTS_SHORT_DESCRIPTION' => xtc_get_short_description($products[$i]['id']), 'ATTRIBUTES' => '');
// Product options names
$attributes_exist = ((isset ($products[$i]['attributes'])) ? 1 : 0);
if ($attributes_exist == 1) {
reset($products[$i]['attributes']);
while (list ($option, $value) = each($products[$i]['attributes'])) {
if (ATTRIBUTE_STOCK_CHECK == 'true' && STOCK_CHECK == 'true') {
$attribute_stock_check = xtc_check_stock_attributes($products[$i][$option]['products_attributes_id'], $products[$i]['quantity']);
if ($attribute_stock_check)
$_SESSION['any_out_of_stock'] = 1;
}
$module_content[$i]['ATTRIBUTES'][] = array ('ID' => $products[$i][$option]['products_attributes_id'], 'MODEL' => xtc_get_attributes_model(xtc_get_prid($products[$i]['id']), $products[$i][$option]['products_options_values_name'],$products[$i][$option]['products_options_name']), 'NAME' => $products[$i][$option]['products_options_name'], 'VALUE_NAME' => $products[$i][$option]['products_options_values_name'].$attribute_stock_check);
}
}
}
$total_content = '';
$total =$_SESSION['cart']->show_total();
if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount'] != '0.00') {
if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
$price = $total-$_SESSION['cart']->show_tax(false);
} else {
$price = $total;
}
$discount = $xtPrice->xtcGetDC($price, $_SESSION['customers_status']['customers_status_ot_discount']);
$total_content = $_SESSION['customers_status']['customers_status_ot_discount'].' % '.SUB_TITLE_OT_DISCOUNT.' -'.xtc_format_price($discount, $price_special = 1, $calculate_currencies = false).'<br />';
}
if ($_SESSION['customers_status']['customers_status_show_price'] == '1') {
if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 0) $total-=$discount;
if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) $total-=$discount;
if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) $total-=$discount;
$total_content .= SUB_TITLE_SUB_TOTAL.$xtPrice->xtcFormat($total, true).'<br />';
} else {
$total_content .= NOT_ALLOWED_TO_SEE_PRICES.'<br />';
}
// display only if there is an ot_discount
if ($customer_status_value['customers_status_ot_discount'] != 0) {
$total_content .= TEXT_CART_OT_DISCOUNT.$customer_status_value['customers_status_ot_discount'].'%';
}
if (SHOW_SHIPPING == 'true') {
$module_smarty->assign('SHIPPING_INFO', ' '.SHIPPING_EXCL.'<a href="javascript:newWin=void(window.open(\''.xtc_href_link(FILENAME_POPUP_CONTENT, 'coID='.SHIPPING_INFOS).'\', \'popup\', \'toolbar=0, width=640, height=600\'))"> '.SHIPPING_COSTS.'</a>');
}
if ($_SESSION['customers_status']['customers_status_show_price'] == '1') {
$module_smarty->assign('UST_CONTENT', $_SESSION['cart']->show_tax());
}
$module_smarty->assign('TOTAL_CONTENT', $total_content);
$module_smarty->assign('language', $_SESSION['language']);
$module_smarty->assign('module_content', $module_content);
$module_smarty->caching = 0;
$module = $module_smarty->fetch(CURRENT_TEMPLATE.'/module/order_details.html');
$smarty->assign('MODULE_order_details', $module);
?>
Geändert von Cao-XTC (15.10.2009 um 21:29 Uhr) |
|
|||
|
Hallo, ich habe die zweite Fehlermeldung wegbekommen, indem ich in Zeile 59 von order_cart_details.php den Abschnitt:
'PRODUCTS_TAX' => number_format($products[$i]['tax'], TAX_DECIMAL_PLACES), in 'PRODUCTS_TAX' => number_format($products[$i]['tax'], (int)TAX_DECIMAL_PLACES), geändert habe. Da ich mich aber nicht wirklich mit PHP auskenne, kann das natürlich falsch sein. Wie auch immer, die Fehlermeldung ist danach verschwunden und mir ist sonst auch kein fehlerhaftes Verhalten oder falsche Berechnungen aufgefallen. Grup Dreadnik |
|
|||
|
Hallo Dreadnik, der Fehler ist damit wirklich verschwunden aber ich denke nicht, dass es die richtige Lösung ist. Ich bin zwar auch kein PHP Artist aber für meine Begriffe hat die Änderung auf (int)TAX_DECIMAL_PLACES eigentlich nur verursacht, dass die Variable TAX_DECIMAL_PLACES nicht gelesen wird, weil es keine (int)... Variable gibt. Komisch ist nur, dass es keine Fehlermeldung gibt. Weiss jemand mehr über diese Variable? Wo wird sie definiert und wo ist sie in der Datenbank? Vielleicht liegt da der Fehler.
|
|
|||
|
(Zur Lösung des Problems siehe weiter unten)
Das "(int)" bedeutet, daß PHP den vorgefundenen Wert in eine Ganzzahl umwandelt. Aber zurück zum Anfang: Für die Konstante TAX_DECIMAL_PLACES gibt es noch gar keinen Wert - es existiert einfach kein Eintrag dafür in der Datenbank. PHP greift hier also auf eine nicht-existente Konstante zu. Der number_format-Befehl bekommt somit nicht seine verlangte Ganzzahl und wirft entsprechend einen Fehler. Schreibt man nun ein "(int)" davor, wird eine Ganzzahl erzeugt und es kommt zu keinem Fehler. Diese Lösung verhindert also die Fehlermeldung, löst aber nicht das eigentliche Problem. Wer eine saubere Lösung will, kommt nicht drumherum, diese Konstante im System zu hinterlegen. Das geht so: in der Datenbank-Tabelle "configuration" wird eine neue Zeile eingefügt: Code:
INSERT INTO `configuration` (`configuration_id`, `configuration_key`, `configuration_value`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (NULL, 'TAX_DECIMAL_PLACES', '2', '1', '30', '', '', '', ''); Code:
define('TAX_DECIMAL_PLACES_TITLE' , 'Steuersatz-Dezimalstellen');
define('TAX_DECIMAL_PLACES_DESC' , 'Die Anzahl der Dezimalstellen für den Steuersatz');
|
![]() |
| Lesezeichen |
| Stichworte |
| fehler |
| Themen-Optionen | |
| Ansicht | |
|
|
Ähnliche Themen
|
||||
| Thema | Autor | Forum | Antworten | Letzter Beitrag |
| KELKOO - EILT | Stefan_w | Allgemeine Diskussionen | 0 | 09.12.2005 17:10 |