View Single Post
  #3  
Old 03-20-2014, 04:04 AM
  vasilis's Avatar 
vasilis vasilis is offline
 

X-Adept
  
Join Date: Feb 2009
Posts: 758
 

Default Re: Pass additional charge to order data

  • I really need to pass this additional handling fee in the 'xcart_orders' table, I guess, so I can retrieve it both in the Order Details admin section and in the screen invoice and email notifications. (This additional charge is programmatically calculated for each product in the order, depending on the shipping address and the price of the product).
    For example, the 'order_data.tpl' template which renders the order details in the invoices, uses the '$order.extra' variable for displaying various types of order data that are stored in the 'extra' field of the 'xcart_orders' table, if I am correct.
    So, it seems to me that the more correct way is to pass this additional charge in this field ('extra') via the func_place_order() function, inside the '$extra' argument, so then I can retrieve it back wherever I need.
    Any comments on this?
  • On the other hand, I also need to pass this charge to the cart totals amount, so it sums up with the rest charges (subtotal + shipping cost + tax + additional charge).
    Up to now, I have tried passing it in the 'include/checkout.php' script, which has the '$cart['total_cost']' variable in scope and thus, I add it to it. But in this case, I wonder if the included additional charge passes in the cart total cost till the end.
    I was thinking if I should use 'cart_calculate_totals.php', passing it inside some insert data array, from those used in the script. Would this route be more correct, instead of passing it to the 'include/checkout.php' script, as referred above?
Reply With Quote