[ Index ]

PHP Cross Reference of phpwcms V1.5.0 _r431 (28.01.12)

title

Body

[close]

/include/inc_module/mod_shop/inc/ -> cart.parse.inc.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2012 Oliver Georgi <oliver@phpwcms.de> // All rights reserved.
   6   
   7     This script is part of PHPWCMS. The PHPWCMS web content management system is
   8     free software; you can redistribute it and/or modify it under the terms of
   9     the GNU General Public License as published by the Free Software Foundation;
  10     either version 2 of the License, or (at your option) any later version.
  11    
  12     The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
  13     A copy is found in the textfile GPL.txt and important notices to the license 
  14     from the author is found in LICENSE.txt distributed with these scripts.
  15    
  16     This script is distributed in the hope that it will be useful, but WITHOUT ANY 
  17     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  18     PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  19   
  20     This copyright notice MUST APPEAR in all copies of the script!
  21  *************************************************************************************/
  22  
  23  // ----------------------------------------------------------------
  24  // obligate check for phpwcms constants
  25  if (!defined('PHPWCMS_ROOT')) {
  26     die("You Cannot Access This Script Directly, Have a Nice Day.");
  27  }
  28  // ----------------------------------------------------------------
  29  
  30  $order_process  = str_replace('{CURRENCY_SYMBOL}', html_entities($_shopPref['shop_pref_currency']), $order_process);
  31  $order_process  = str_replace('{WEIGHT_UNIT}', html_entities($_shopPref['shop_pref_unit_weight']), $order_process);
  32  
  33  $subtotal['float_net']        = $subtotal['net'];
  34  $subtotal['float_gross']    = $subtotal['gross'];
  35  
  36  $subtotal['net']    = number_format($subtotal['net'], $_tmpl['config']['price_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']);
  37  $subtotal['vat']    = number_format($subtotal['vat'], $_tmpl['config']['price_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']);
  38  $subtotal['gross']    = number_format($subtotal['gross'], $_tmpl['config']['price_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']);
  39  
  40  $order_process  = str_replace('{SUBTOTAL_NET}', $subtotal['net'], $order_process);
  41  $order_process  = str_replace('{SUBTOTAL_VAT}', $subtotal['vat'], $order_process);
  42  $order_process  = str_replace('{SUBTOTAL_GROSS}', $subtotal['gross'], $order_process);
  43  
  44  $subtotal['float_shipping_net']        = $subtotal['shipping_net'];
  45  $subtotal['float_shipping_gross']    = $subtotal['shipping_gross'];
  46  
  47  $subtotal['shipping_net']    = number_format($subtotal['shipping_net'], $_tmpl['config']['price_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']);
  48  $subtotal['shipping_vat']    = number_format($subtotal['shipping_vat'], $_tmpl['config']['price_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']);
  49  $subtotal['shipping_gross']    = number_format($subtotal['shipping_gross'], $_tmpl['config']['price_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']);
  50  
  51  $order_process  = str_replace('{SHIPPING_NET}', $subtotal['shipping_net'], $order_process);
  52  $order_process  = str_replace('{SHIPPING_VAT}', $subtotal['shipping_vat'], $order_process);
  53  $order_process  = str_replace('{SHIPPING_GROSS}', $subtotal['shipping_gross'], $order_process);
  54  
  55  $subtotal['float_weight']    = $subtotal['weight'];
  56  
  57  $subtotal['weight']    = number_format($subtotal['weight'], $_tmpl['config']['weight_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']);
  58  $order_process         = str_replace('{SUBTOTAL_WEIGHT}', $subtotal['weight'], $order_process);
  59  
  60  
  61  // calculate discount
  62  if(empty($_shopPref['shop_pref_discount']['discount']) || empty($_shopPref['shop_pref_discount']['percent'])) {
  63      
  64      $subtotal['float_discount_net']        = 0;
  65      $subtotal['float_discount_vat']        = 0;
  66      $subtotal['float_discount_gross']    = 0;
  67      
  68  } else {
  69  
  70      $subtotal['float_discount_net']        = round($subtotal['float_net'] * $_shopPref['shop_pref_discount']['percent'] / 100, 2);
  71      $subtotal['float_discount_gross']    = round($subtotal['float_gross'] * $_shopPref['shop_pref_discount']['percent'] / 100, 2);
  72      $subtotal['float_discount_vat']        = $subtotal['float_discount_gross'] - $subtotal['float_discount_net'];
  73  
  74  }
  75  $subtotal['discount_percent']         = number_format(round($_shopPref['shop_pref_discount']['percent'],1), $_tmpl['config']['price_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']);
  76  $subtotal['total_discount_net']        = number_format($subtotal['float_discount_net'], $_tmpl['config']['price_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']);
  77  $subtotal['total_discount_vat']        = number_format($subtotal['float_discount_vat'], $_tmpl['config']['price_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']);
  78  $subtotal['total_discount_gross']    = number_format($subtotal['float_discount_gross'], $_tmpl['config']['price_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']);
  79  
  80  //$order_process  = str_replace('{DISCOUNT}', $subtotal['discount_percent'], $order_process);
  81  $order_process  = str_replace('{DISCOUNT_NET}', $subtotal['total_discount_net'], $order_process);
  82  $order_process  = str_replace('{DISCOUNT_VAT}', $subtotal['total_discount_vat'], $order_process);
  83  $order_process  = str_replace('{DISCOUNT_GROSS}', $subtotal['total_discount_gross'], $order_process);
  84  
  85  
  86  // calculate low oder surcharge
  87  $_shopPref['shop_pref_loworder']['under'] = floatval($_shopPref['shop_pref_loworder']['under']);
  88  if(empty($_shopPref['shop_pref_loworder']['loworder']) || empty($_shopPref['shop_pref_loworder']['charge']) || $subtotal['float_net'] > $_shopPref['shop_pref_loworder']['under']) {
  89      
  90      $subtotal['float_loworder_net']        = 0;
  91      $subtotal['float_loworder_vat']        = 0;
  92      $subtotal['float_loworder_gross']    = 0;
  93      
  94  } else {
  95  
  96      $subtotal['float_loworder_net']        = $_shopPref['shop_pref_loworder']['charge'];
  97      $subtotal['float_loworder_gross']    = round( $subtotal['float_loworder_net'] * ( 1 + ($_shopPref['shop_pref_loworder']['vat'] / 100) ), 2 );
  98      $subtotal['float_loworder_vat']        = $subtotal['float_loworder_gross'] - $subtotal['float_loworder_net'];
  99      
 100  }
 101  $subtotal['total_loworder_net']        = number_format($subtotal['float_loworder_net'], $_tmpl['config']['price_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']);
 102  $subtotal['total_loworder_vat']        = number_format($subtotal['float_loworder_vat'], $_tmpl['config']['price_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']);
 103  $subtotal['total_loworder_gross']    = number_format($subtotal['float_loworder_gross'], $_tmpl['config']['price_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']);
 104  
 105  $order_process  = str_replace('{LOWORDER_NET}', $subtotal['total_loworder_net'], $order_process);
 106  $order_process  = str_replace('{LOWORDER_VAT}', $subtotal['total_loworder_vat'], $order_process);
 107  $order_process  = str_replace('{LOWORDER_GROSS}', $subtotal['total_loworder_gross'], $order_process);
 108  
 109  
 110  // now sum everything
 111  $subtotal['float_total_net']    = $subtotal['float_net'] + $subtotal['float_shipping_net'] + $subtotal['float_loworder_net'] - $subtotal['float_discount_net'];
 112  $subtotal['float_total_gross']    = $subtotal['float_gross'] + $subtotal['float_shipping_gross'] + $subtotal['float_loworder_gross'] - $subtotal['float_discount_gross'];
 113  $subtotal['float_total_vat']    = $subtotal['float_total_gross'] - $subtotal['float_total_net'];
 114  
 115  $subtotal['total_net']        = number_format($subtotal['float_total_net'], $_tmpl['config']['price_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']);
 116  $subtotal['total_vat']        = number_format($subtotal['float_total_vat'], $_tmpl['config']['price_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']);
 117  $subtotal['total_gross']    = number_format($subtotal['float_total_gross'], $_tmpl['config']['price_decimals'], $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep']);
 118  
 119  $order_process  = str_replace('{TOTAL_NET}', $subtotal['total_net'], $order_process);
 120  $order_process  = str_replace('{TOTAL_VAT}', $subtotal['total_vat'], $order_process);
 121  $order_process  = str_replace('{TOTAL_GROSS}', $subtotal['total_gross'], $order_process);
 122  
 123  
 124  $order_process = render_cnt_template($order_process, 'LOWORDER', $subtotal['float_loworder_net'] != 0 ? 1 : '');
 125  $order_process = render_cnt_template($order_process, 'DISCOUNT', $subtotal['float_discount_net'] != 0 ? $subtotal['discount_percent'] : '');
 126  
 127  // Is Shipping?
 128  $order_process = render_cnt_template($order_process, 'SHIPPING', $subtotal['float_shipping_net'] > 0 ? 1 : '');
 129  
 130  ?>


Generated: Sun Jan 29 16:31:14 2012 Cross-referenced by PHPXref 0.7.1