Hirm Posted December 18, 2007 Report Share Posted December 18, 2007 Hallo, ich habe folgendes Problem: Die Druckversion einer Bestellung soll neben dem Artikelpreis auch noch die dem Artikel zugehörige Steuerklasse enthalten. Die Variable dazu habe ich gefunden: products_tax_class_id in der Tabelle products. Man müsste also theoretisch nur diese Variable auslesen und in die print_order.html einbauen. In Anlehnung an das Posting von Tuvalu (http://www.xt-commerce.com/forum/showthread.php?t=44616&highlight=rechnung) habe ich versucht, seinen Code für mein problem umzuschreiben, doch irgendwie habe ich da was falsch gemacht. Kann sich den Code bitte jemand angucken und mir Tipps dazu geben, was ich falsch gemacht habe. Hier der Code von print_order.php: $order_query=xtc_db_query("SELECT products_id, orders_products_id, products_model, products_name, final_price, products_quantity FROM ".TABLE_ORDERS_PRODUCTS." WHERE orders_id='".(int)$_GET['oID']."'"); $order_data=array(); while ($order_data_values = xtc_db_fetch_array($order_query)) { $short_query = xtc_db_query("SELECT products_tax_class_id FROM ".TABLE_PRODUCTS." WHERE products_id=".$order_data_values['products_id']."]); $short_result = xtc_db_fetch_array($short_query); $attributes_query = xtc_db_query("SELECT products_options, products_options_values, price_prefix, options_values_price FROM ".TABLE_ORDERS_PRODUCTS_ATTRIBUTES." WHERE orders_products_id='".$order_data_values['orders_products_id']."'"); $attributes_data = ''; $attributes_model = ''; while ($attributes_data_values = xtc_db_fetch_array($attributes_query)) { $attributes_data .= '<br />'.$attributes_data_values['products_options'].':'.$attributes_data_values['products_options_values']; $attributes_model .= '<br />'.xtc_get_attributes_model($order_data_values['products_id'], $attributes_data_values['products_options_values'],$attributes_data_values['products_options']); } $order_data[]=array( 'PRODUCTS_MODEL' => $order_data_values['products_model'], 'PRODUCTS_NAME' => $order_data_values['products_name'], 'PRODUCTS_ATTRIBUTES' => $attributes_data, 'PRODUCTS_ATTRIBUTES_MODEL' => $attributes_model, 'PRODUCTS_PRICE' => xtc_format_price_order($order_data_values['final_price'],1,$order->info['currency']), 'PRODUCTS_QTY' => $order_data_values['products_quantity'], 'PRODUCTS_TAX_CLASS_ID' => $short_result['products_tax_class_id']); }[/PHP] Dankeschön im Voraus Andreas Link to comment Share on other sites More sharing options...
Numerobis Posted December 18, 2007 Report Share Posted December 18, 2007 Du mußt die Steuer schon auch abfragen. Aber natürlich nicht aus der products, sondern aus der orders_products. Das ist die Query am Anfang. Das Feld heißt wohl products_tax und gibt die Prozent als 19.0000 aus. Das ist dann kein Steuerklassenidentifikator, sondern der Prozentsatz dazu. Gruß Numerobis Link to comment Share on other sites More sharing options...
Hirm Posted December 18, 2007 Author Report Share Posted December 18, 2007 hallo Numerobis danke für die schnelle antwort. werde ich probieren. schönen tag noch Andreas Link to comment Share on other sites More sharing options...
Hirm Posted December 19, 2007 Author Report Share Posted December 19, 2007 hallo nochmals habe die änderung an der bestellinformation so hinbekommen, wie ich wollte. zu jedem artikel wird der entsprechende ust-satz angezeigt. für alle, die es interessiert, hier ist der code, den ich dazu verwendet habe: print_order.php <?php /* ----------------------------------------------------------------------------------------- $Id: print_order.php 1166 2005-08-21 00:52:02Z mz $ XT-Commerce - community made shopping http://www.xt-commerce.com Copyright (c) 2003 XT-Commerce ----------------------------------------------------------------------------------------- based on: (c) 2003 nextcommerce (print_order.php,v 1.1 2003/08/19); www.nextcommerce.org Released under the GNU General Public License ---------------------------------------------------------------------------------------*/ require('includes/application_top.php'); // include needed functions require_once(DIR_FS_INC .'xtc_get_order_data.inc.php'); require_once(DIR_FS_INC .'xtc_get_attributes_model.inc.php'); require_once(DIR_FS_INC .'xtc_not_null.inc.php'); require_once(DIR_FS_INC .'xtc_format_price_order.inc.php'); $smarty = new Smarty; $order_query_check = xtc_db_query("SELECT customers_id FROM ".TABLE_ORDERS." WHERE orders_id='".(int)$_GET['oID']."'"); $order_check = xtc_db_fetch_array($order_query_check); // if ($_SESSION['customer_id'] == $order_check['customers_id']) // { // get order data include(DIR_WS_CLASSES . 'order.php'); $order = new order($_GET['oID']); $smarty->assign('address_label_customer',xtc_address_format($order->customer['format_id'], $order->customer, 1, '', '<br />')); $smarty->assign('address_label_shipping',xtc_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br />')); $smarty->assign('address_label_payment',xtc_address_format($order->billing['format_id'], $order->billing, 1, '', '<br />')); $smarty->assign('csID',$order->customer['csID']); // get products data $order_query=xtc_db_query("SELECT products_id, orders_products_id, products_model, products_name, final_price, products_price, products_quantity, products_tax FROM ".TABLE_ORDERS_PRODUCTS." WHERE orders_id='".(int)$_GET['oID']."'"); $order_data=array(); while ($order_data_values = xtc_db_fetch_array($order_query)) { $attributes_query=xtc_db_query("SELECT products_options, products_options_values, price_prefix, options_values_price FROM ".TABLE_ORDERS_PRODUCTS_ATTRIBUTES." WHERE orders_products_id='".$order_data_values['orders_products_id']."'"); $attributes_data=''; $attributes_model=''; while ($attributes_data_values = xtc_db_fetch_array($attributes_query)) { $attributes_data .='<br />'.$attributes_data_values['products_options'].':'.$attributes_data_values['products_options_values']; $attributes_model .='<br />'.xtc_get_attributes_model($order_data_values['products_id'],$attributes_data_values['products_options_values']); } $order_data[]=array( 'PRODUCTS_MODEL' => $order_data_values['products_model'], 'PRODUCTS_NAME' => $order_data_values['products_name'], 'PRODUCTS_ATTRIBUTES' => $attributes_data, 'PRODUCTS_ATTRIBUTES_MODEL' => $attributes_model, 'PRODUCTS_PRICE' => xtc_format_price_order($order_data_values['final_price'],1,$order->info['currency']), 'PRODUCTS_SINGLE_PRICE' => xtc_format_price_order($order_data_values['products_price'],1,$order->info['currency']), 'PRODUCTS_QTY' => $order_data_values['products_quantity'], 'PRODUCTS_TAX' => xtc_format_price_order($order_data_values['products_tax'], 2,'')); } // get order_total data $oder_total_query=xtc_db_query("SELECT title, text, class, value, sort_order FROM ".TABLE_ORDERS_TOTAL." WHERE orders_id='".$_GET['oID']."' ORDER BY sort_order ASC"); $order_total=array(); while ($oder_total_values = xtc_db_fetch_array($oder_total_query)) { $order_total[]=array( 'TITLE' => $oder_total_values['title'], 'CLASS'=> $oder_total_values['class'], 'VALUE'=> $oder_total_values['value'], 'TEXT' => $oder_total_values['text']); if ($oder_total_values['class']='ot_total') $total=$oder_total_values['value']; } // assign language to template for caching $smarty->assign('language', $_SESSION['language']); $smarty->assign('logo_path',HTTP_SERVER . DIR_WS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/img/'); $smarty->assign('oID',$_GET['oID']); if ($order->info['payment_method']!='' && $order->info['payment_method']!='no_payment') { include(DIR_FS_CATALOG.'lang/'.$_SESSION['language'].'/modules/payment/'.$order->info['payment_method'].'.php'); $payment_method=constant(strtoupper('MODULE_PAYMENT_'.$order->info['payment_method'].'_TEXT_TITLE')); $smarty->assign('PAYMENT_METHOD',$payment_method); } $smarty->assign('COMMENTS', $order->info['comments']); $smarty->assign('DATE',xtc_date_long($order->info['date_purchased'])); $smarty->assign('order_data', $order_data); $smarty->assign('order_total', $order_total); // dont allow cache $smarty->caching = false; $smarty->template_dir=DIR_FS_CATALOG.'templates'; $smarty->compile_dir=DIR_FS_CATALOG.'templates_c'; $smarty->config_dir=DIR_FS_CATALOG.'lang'; $smarty->display(CURRENT_TEMPLATE . '/admin/print_order.html'); // } else { // $smarty->display(CURRENT_TEMPLATE . '/error_message.html'); // } ?>[/PHP] print_order.html [PHP]<table style="border-bottom:1px solid;" width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>{#heading_products#}</strong></font></td> </tr> <tr> <td> <table width="100%" border="0" cellpadding="3" cellspacing="0" bgcolor="f1f1f1"> <tr> <td colspan="2" style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><div align="center"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">{#head_units#}</font></strong></div></td> <td style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">{#head_products#}</font></strong></td> <td style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">{#head_artnr#}</font></strong></td> <td style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">{#head_single_price#}</font></strong></td> <td style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;" width="150"><div align="right"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">{#head_price#}</font></strong></div></td> <td style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;" width="150"><div align="right"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">UST-Satz</font></strong></div></td> </tr> {foreach name=aussen item=order_values from=$order_data} <tr> <td width="20" style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">{$order_values.PRODUCTS_QTY}</font></div></td> <td width="20" style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">x</font></div></td> <td style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>{$order_values.PRODUCTS_NAME}</strong><em>{$order_values.PRODUCTS_ATTRIBUTES}</em></font></td> <td style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">{$order_values.PRODUCTS_MODEL}<em>{$order_values.PRODUCTS_ATTRIBUTES_MODEL}</em></font></td> <td style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">{$order_values.PRODUCTS_SINGLE_PRICE}</font></div></td> <td style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;" width="150"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">{$order_values.PRODUCTS_PRICE}</font></div></td> <td style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;" width="150"><div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">{$order_values.PRODUCTS_TAX} %</font></div></td> </tr> {/foreach} </table> </td> </tr> </table>[/PHP] Schönen tag noch Andreas Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.