|
|||
|
Ja, gut Frage, dass w?rde mich ebenfalls brennend interessieren. Ich denke, dass da ein Eingriff in den Code erforderlich ist, wovon ich leider 0 Plan habe.
Firmenkunden nehmen st?ndig meine Bruttopreis als Nettopreis, um z.B. per Fax zu bestellen. Das ist nat?rlich nicht ?ber f?r den Umsatz , macht aber mehr Arbeit als Spa?. Meine Privatkunden interessiert nat?rlich mehr der Bruttopreis.F?r eine L?sung oder einen Anstoss (z.B. in welcher Datei man ansetzen muss) w?re ich auch extrem dankbar. Gr??e Marcus |
|
|||
|
habe mal bei oscommerce nachgesehen. Da funktioniert das durch einen Eintrag ein die currencies.php im Ordern includes. Leider kann man das nicht 1:1 ?bernehmen, vielmehr es funktioniert so bei xtc nicht.
Welche Datei muss ich angehen, um das Problem zu l?sen? F?r eine Antwort w?re ich dankbar. Marcus |
|
|||
|
F?r einige Seiten hab ichs jetzt hinbekommen. War nicht ganz so leicht. Man muss da in einigen Dateien PHP ein bisschen ver?ndern. Es gibt eine Datei xtc_get_products_price.php. Dort hab ich zB eine zweite Funktion eingebaut, die den netto Preis ausgibt. Dann kommen da noch viele kleine andere Schritte, um den den Nettopreis anzuzeigen. Bin jetzt noch dabei, die restlichen stellen zu bearbeiten, wo der netto Preis auch noch erscheinen soll.
bis dann Helmut |
|
|||
|
Hallo,
danke, danke f?r euer Lob. Es kann sein, dass ich mal noch weitere Shops mit XTC machen werde. Aber nicht bevor ich noch mehr ?ber die Funktionsweise herausgefunden hab. Da sind schon noch einige Dinger drin, die ich noch nicht nachvolziehen kann. Aber man lernt ja nie! Aus! ;-)) Nettopreis: Ich hab festgestellt, dass die Preis erst aus der Datenbank geholt werden, dann wird er formatiert und erst dann ins Template geschrieben. Und da muss man ansetzten. Zuerst mal kommt in "xtc_add_tax.inc.php" diese Funktion zus?tzlich rein. Code:
function xtc_addno_tax($price, $tax)
{
return $price;
}
In der Datei "xtc_get_products_price.inc.php" hab ich folgende Funktion hinzugef?gt: Code:
function xtc_get_products_price_netto($products_id,$price_special_netto,$quantity)
{
// check if customer is allowed to see prices (if not -> no price calculations , show error message)
if ($_SESSION['customers_status']['customers_status_show_price'] == '1') {
// load price data into array for further use!
$product_price_query = xtc_db_query("SELECT products_price,
products_discount_allowed,
products_tax_class_id
FROM ". TABLE_PRODUCTS ."
WHERE
products_id = '".$products_id."'");
$product_price_netto = xtc_db_fetch_array($product_price_query);
$price_data_netto=array();
$price_data_netto=array(
'PRODUCTS_PRICE'=>$product_price_netto['products_price'],
'PRODUCTS_DISCOUNT_ALLOWED'=>$product_price_netto['products_discount_allowed'],
// 'PRODUCT_TAX_CLASS_ID'=>$product_price_netto['products_tax_class_id'],
'PRODUCT_TAX_CLASS_ID'=>'',
'PRODUCTS_PRICE_NETTO'=>$product_price_netto['products_price']
);
// get tax rate for tax class
$products_tax=xtc_get_tax_rate($price_data_netto['PRODUCT_TAX_CLASS_ID']);
// check if user is allowed to see tax rates
if ($_SESSION['customers_status']['customers_status_show_price_tax'] =='0') {
$products_tax='';
} // end $_SESSION['customers_status']['customers_status_show_price_tax'] =='0'
// check if special price is aviable for product (no product discount on special prices!)
if ($special_price_netto=xtc_get_products_special_price($products_id)) {
$special_price_netto= (xtc_addno_tax($special_price,$products_tax));
$price_data_netto['PRODUCTS_PRICE']= (xtc_add_tax($price_data['PRODUCTS_PRICE'],$products_tax));
$price_string_netto=xtc_format_special_price($special_price_netto,$price_data_netto['PRODUCTS_PRICE'],$price_special_netto,$calculate_currencies=true,$quantity,$products_tax);
}
else {
// if ($special_price=xtc_get_products_special_price($products_id))
// Check if there is another price for customers_group (if not, take norm price and calculte discounts (NOTE: no discount on group PRICES(only OT DISCOUNT!)!
$group_price_query_netto=xtc_db_query("SELECT personal_offer
FROM personal_offers_by_customers_status_".$_SESSION['customers_status']['customers_status_id']."
WHERE products_id='".$products_id."'");
$group_price_data_netto=xtc_db_fetch_array($group_price_query_netto);
// if we found a price, everything is ok if not, we will use normal price
if ($group_price_data_netto['personal_offer']!='' and $group_price_data_netto['personal_offer']!='0.0000') {
$price_string_netto=$group_price_data_netto['personal_offer'];
// check if customer is allowed to get graduated prices
if ($_SESSION['customers_status']['customers_status_graduated_prices']=='1'){
// check if there are graduated prices in db
// get quantity for products
// modifikations for new graduated prices
$qty=xtc_get_qty($products_id);
if (!xtc_get_qty($products_id)) $qty=$quantity;
$graduated_price_query_netto=xtc_db_query("SELECT max(quantity)
FROM personal_offers_by_customers_status_".$_SESSION['customers_status']['customers_status_id']."
WHERE products_id='".$products_id."'
AND quantity<='".$qty."'");
$graduated_price_data_netto=xtc_db_fetch_array($graduated_price_query);
// get singleprice
$graduated_price_query_netto=xtc_db_query("SELECT personal_offer
FROM personal_offers_by_customers_status_".$_SESSION['customers_status']['customers_status_id']."
WHERE products_id='".$products_id."'
AND quantity='".$graduated_price_data_netto['max(quantity)']."'");
$graduated_price_data_netto=xtc_db_fetch_array($graduated_price_query_netto);
$price_string_netto=$graduated_price_data_netto['personal_offer'];
} // end $_SESSION['customers_status']['customers_status_graduated_prices']=='1'
// $price_string_netto= (xtc_add_tax($price_string_netto,$products_tax));//*$quantity;
}
else {
// if ($group_price_data['personal_offer']!='' and $group_price_data['personal_offer']!='0.0000')
$price_string_netto= (xtc_add_tax($price_data_netto['PRODUCTS_PRICE'],$products_tax)); //*$quantity;
$price_string_netto= $price_string_netto;
// check if product allows discount
if ($price_data_netto['PRODUCTS_DISCOUNT_ALLOWED'] != '0.00') {
$discount_netto=$price_data_netto['PRODUCTS_DISCOUNT_ALLOWED'];
// check if group discount > max. discount on product
if ($discount_netto > $_SESSION['customers_status']['customers_status_discount']) {
$discount_netto=$_SESSION['customers_status']['customers_status_discount'];
}
// calculate price with rabatt
$rabatt_string_netto = $price_string_netto - ($price_string_netto/100*$discount_netto);
if ($price_string_netto==$rabatt_string_netto) {
$price_string_netto=xtc_format_price($price_string_netto*$quantity,$price_special,$calculate_currencies=true);
} else {
$price_string_netto=xtc_format_special_price($rabatt_string_netto,$price_string_netto,$price_special_netto,$calculate_currencies=false,$quantity,$products_tax);
}
return $price_string_netto;
break;
}
}
// format price & calculate currency
$price_string_netto=xtc_format_price($price_string_netto*$quantity,$price_special_netto,$calculate_currencies=true);
}
}
else {
// return message, if not allowed to see prices
$price_string_netto=NOT_ALLOWED_TO_SEE_PRICES;
} // end ($_SESSION['customers_status']['customers_status_show_price'] == '1')
return $price_string_netto;
}
Dann wird der Einzelpreis in "xtc_get_single_prducts_price.inc.php" gebaut: Code:
function xtc_get_single_products_price_netto($products_id,$price_special,$quantity)
{
// check if customer is allowed to see prices (if not -> no price calculations , show error message)
if ($_SESSION['customers_status']['customers_status_show_price'] == '1') {
// load price data into array for further use!
$product_price_query = xtc_db_query("SELECT products_price,
products_discount_allowed,
products_tax_class_id
FROM ". TABLE_PRODUCTS ."
WHERE
products_id = '".$products_id."'");
$product_price = xtc_db_fetch_array($product_price_query);
$price_data=array();
$price_data=array(
'PRODUCTS_PRICE'=>$product_price['products_price'],
'PRODUCTS_DISCOUNT_ALLOWED'=>$product_price['products_discount_allowed'],
'PRODUCT_TAX_CLASS_ID'=>$product_price['products_tax_class_id']
);
// get tax rate for tax class
$products_tax=xtc_get_tax_rate($price_data['PRODUCT_TAX_CLASS_ID']);
// check if user is allowed to see tax rates
if ($_SESSION['customers_status']['customers_status_show_price_tax'] =='0') {
$products_tax='';
} // end $_SESSION['customers_status']['customers_status_show_price_tax'] =='0'
// check if special price is aviable for product (no product discount on special prices!)
if ($special_price=xtc_get_products_special_price($products_id)) {
$special_price= (xtc_addno_tax($special_price,$products_tax));
$price_data['PRODUCTS_PRICE']= (xtc_addno_tax($price_data['PRODUCTS_PRICE'],$products_tax));
$price_string=xtc_format_special_price($special_price,$price_data['PRODUCTS_PRICE'],$price_special,$calculate_currencies=true,$quantity,$products_tax);
} else { // if ($special_price=xtc_get_products_special_price($products_id))
// Check if there is another price for customers_group (if not, take norm price and calculte discounts (NOTE: no discount on group PRICES(only OT DISCOUNT!)!
$group_price_query=xtc_db_query("SELECT personal_offer
FROM personal_offers_by_customers_status_".$_SESSION['customers_status']['customers_status_id']."
WHERE products_id='".$products_id."'");
$group_price_data=xtc_db_fetch_array($group_price_query);
// if we found a price, everything is ok if not, we will use normal price
if ($group_price_data['personal_offer']!='' and $group_price_data['personal_offer']!='0.0000')
{
$price_string=$group_price_data['personal_offer'];
// check if customer is allowed to get graduated prices
if ($_SESSION['customers_status']['customers_status_graduated_prices']=='1'){
// check if there are graduated prices in db
// get quantity for products
$graduated_price_query=xtc_db_query("SELECT max(quantity)
FROM personal_offers_by_customers_status_".$_SESSION['customers_status']['customers_status_id']."
WHERE products_id='".$products_id."'
AND quantity<='".$quantity."'");
$graduated_price_data=xtc_db_fetch_array($graduated_price_query);
// get singleprice
$graduated_price_query=xtc_db_query("SELECT personal_offer
FROM personal_offers_by_customers_status_".$_SESSION['customers_status']['customers_status_id']."
WHERE products_id='".$products_id."'
AND quantity='".$graduated_price_data['max(quantity)']."'");
$graduated_price_data=xtc_db_fetch_array($graduated_price_query);
$price_string=$graduated_price_data['personal_offer'];
} // end $_SESSION['customers_status']['customers_status_graduated_prices']=='1'
$price_string= (xtc_addno_tax($price_string,$products_tax));
} else { // if ($group_price_data['personal_offer']!='' and $group_price_data['personal_offer']!='0.0000')
$price_string= (xtc_addno_tax($price_data['PRODUCTS_PRICE'],$products_tax));
// check if product allows discount
if ($price_data['PRODUCTS_DISCOUNT_ALLOWED'] != '0.00') {
$discount=$price_data['PRODUCTS_DISCOUNT_ALLOWED'];
// check if group discount > max. discount on product
if ($discount > $_SESSION['customers_status']['customers_status_discount']) {
$discount=$_SESSION['customers_status']['customers_status_discount'];
}
// calculate price with rabatt
$price_string = $price_string - ($price_string/100*$discount);
}
}
// format price & calculate currency
$price_string=xtc_format_price($price_string,$price_special,$calculate_currencies=true);
}
} else {
// return message, if not allowed to see prices
$price_string=NOT_ALLOWED_TO_SEE_PRICES;
} // end ($_SESSION['customers_status']['customers_status_show_price'] == '1')
return $price_string;
Zeile 86 Code:
$products_price_netto=xtc_get_products_price_netto($product_info['products_id'], $price_special=1, $quantity=1); Code:
$info_smarty->assign('PRODUCTS_PRICE_NETTO',$products_price_netto);
Zeile 94 Code:
'PRODUCTS_PRICE_NETTO' => xtc_get_products_price_netto($new_products['products_id'],$price_special=1,$quantity=1), Code:
'PRODUCTS_PRICE_NETTO' => xtc_get_products_price_netto($new_products['products_id'],$price_special=1,$quantity=1), Und nun geht's daran, die Nettopreise in die Templates einzubauen, damit sie auch angezeigt werden. Dazu mehr im n?chsten Abschnitt |
|
|||
|
In allen Templates sind Platzhalter eingebaut. Z.B. {$module_data.PRODUCTS_PRICE} . Wenn man sich die vorhergenden Schritte ansieht, kann man feststellen, wie die Platzhalter f?r den Nettopreis aussehen m?ssen. N?mlich: {$module_data.PRODUCTS_PRICE_NETTO}.
Also muss man s?mtliche HTML-Seite nach diesen Platzhaltern durchst?bern und den Platzhalter mit dem "PRICE_NETTO" dazu einbauen. Dann erscheint auf den Saiten der Nettopreis. So hab ich's hinbekommen. Ob das jetzt gut oder schlecht ist, weis ich nicht. Hautpsache es funktioniert und die Funktionen des Shops werden nicht beeintr?chtigt. Wen's interessiert, dort kann man sich das anschauen: Well-Fine-Shop bis dann Helmut |
![]() |
| Lesezeichen |
| Stichworte |
| anzeigen, brutto, nettopreise |
| Themen-Optionen | |
| Ansicht | |
|
|