[ Indice ]

Riferimento incrociato di Joomla! 1.5.14 - VM 1.1.4

Servizio fornito da VMItalia
Classe:   Funzione:   Variabile:   Costante:  
Storico Ricerche +

titolo

Corpo

[chiudi]

/administrator/components/com_virtuemart/html/ -> savedbasket.php (sorgente)

   1  <?php
   2  if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
   3  /**

   4  * This file is the CART handler. It calculates the totals and

   5  * uses the basket templates to show the listing to the user

   6  * 

   7  * This version of the basket allows to change quantities and delete products from the cart

   8  * The ro_basket (=read only) doesn't allow that.

   9  * 

  10  * @version $Id: basket.php 774 2007-03-16 12:09:11 +0000 (Fri, 16 Mar 2007) soeren_nb $

  11  * @package VirtueMart

  12  * @subpackage html

  13  * @copyright Copyright (C) 2004-2009 soeren - All rights reserved.

  14  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php

  15  * VirtueMart is free software. This version may have been modified pursuant

  16  * to the GNU General Public License, and as distributed it includes or

  17  * is derivative of works licensed under the GNU General Public License or

  18  * other free or open source software licenses.

  19  * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.

  20  *

  21  * http://virtuemart.net

  22  */
  23  mm_showMyFileName( __FILE__ );
  24  
  25  require_once (CLASSPATH. 'ps_product.php' );
  26  $ps_product = new ps_product;
  27  require_once (CLASSPATH. 'ps_checkout.php' );
  28  $ps_checkout = new ps_checkout;
  29  require_once (CLASSPATH . 'ps_shipping_method.php' );
  30  
  31  global $weight_total, $total, $tax_total, $order_tax_details, $discount_factor;
  32  
  33  /* make sure this is the checkout screen */

  34  if ($cart["idx"] == 0) {
  35      $basket_html = $VM_LANG->_('PHPSHOP_EMPTY_CART');
  36      $checkout = False;
  37  }
  38  else {
  39      $checkout = True;
  40  
  41      $total = 0;
  42      // Added for the zone shipping module

  43      $vars["zone_qty"] = 0;
  44      $weight_total = 0;
  45      $weight_subtotal = 0;
  46      $tax_total = 0;
  47      $shipping_total = 0;
  48      $shipping_tax = 0;
  49      $order_total = 0;
  50      $discount_before=$discount_after=$show_tax=$shipping=false;
  51      $product_rows = Array();
  52  
  53      for ($i=0;$i<$cart["idx"];$i++) {
  54          // Added for the zone shipping module

  55          $vars["zone_qty"] += $cart[$i]["quantity"];
  56  
  57          if ($i % 2) $product_rows[$i]['row_color'] = "sectiontableentry2";
  58          else $product_rows[$i]['row_color'] = "sectiontableentry1";
  59  
  60          // Get product parent id if exists

  61          $product_parent_id=$ps_product->get_field($cart[$i]["product_id"],"product_parent_id");
  62  
  63          // Get flypage for this product

  64          $flypage_id = $product_parent_id;
  65          if($flypage_id == 0) {
  66              $flypage_id = $cart[$i]["product_id"];
  67          }
  68          $flypage = $ps_product->get_flypage($flypage_id);
  69          $category_id=$cart[$i]["category_id"];
  70          // Build URL based on whether item or product

  71          if ($product_parent_id) {
  72              $url = $sess->url(URL . basename($_SERVER['PHP_SELF'])."?page=shop.product_details&flypage=$flypage&product_id=$product_parent_id&category_id=$category_id");
  73          }
  74          else {
  75              $url = $sess->url(URL . basename($_SERVER['PHP_SELF'])."?page=shop.product_details&flypage=$flypage&product_id=" . $cart[$i]["product_id"]."&category_id=$category_id");
  76          }
  77  
  78          $product_rows[$i]['product_name'] = "<a href=\"$url\"><strong>"
  79          . shopMakeHtmlSafe($ps_product->get_field($cart[$i]["product_id"], "product_name"))
  80          . "</strong></a><br />"
  81          . $ps_product->getDescriptionWithTax( $cart[$i]["description"], $cart[$i]["product_id"] );
  82  
  83          // Display attribute values if this an item

  84          $product_rows[$i]['product_attributes'] = "";
  85          if ($product_parent_id) {
  86              $db_detail=$ps_product->attribute_sql($cart[$i]["product_id"],$product_parent_id);
  87              while ($db_detail->next_record()) {
  88                  $product_rows[$i]['product_attributes'] .= "<br />" . $db_detail->f("attribute_name") . "&nbsp;";
  89                  $product_rows[$i]['product_attributes'] .= "(" . $db_detail->f("attribute_value") . ")";
  90              }
  91          }
  92          $product_rows[$i]['product_sku'] = $ps_product->get_field($cart[$i]["product_id"], "product_sku");
  93  
  94          /* WEIGHT CALCULATION */

  95          $weight_subtotal = ps_shipping_method::get_weight($cart[$i]["product_id"]) * $cart[$i]['quantity'];
  96          $weight_total += $weight_subtotal;
  97  
  98          /* Product PRICE */

  99          $my_taxrate = $ps_product->get_product_taxrate($cart[$i]["product_id"], $weight_subtotal);
 100          $tax = $my_taxrate * 100;
 101  
 102          $price = $ps_product->get_adjusted_attribute_price($cart[$i]["product_id"], $cart[$i]["description"]);
 103          $price["product_price"] = $GLOBALS['CURRENCY']->convert( $price["product_price"], $price["product_currency"] );
 104          
 105          if( $auth["show_price_including_tax"] == 1 ) {
 106              $product_price = $price["product_price"] * ($my_taxrate+1);
 107          } else {
 108              $product_price = $price["product_price"];
 109          }
 110  
 111          $product_price = round( $product_price, 2 );
 112          $product_rows[$i]['product_price'] = $GLOBALS['CURRENCY_DISPLAY']->getFullValue($product_price);
 113  
 114          /* SUBTOTAL CALCULATION */

 115          $subtotal = $product_price * $cart[$i]["quantity"];
 116  
 117          $total += $subtotal;
 118          $product_rows[$i]['subtotal'] = $GLOBALS['CURRENCY_DISPLAY']->getFullValue($subtotal);
 119          $product_rows[$i]['subtotal_with_tax'] = $GLOBALS['CURRENCY_DISPLAY']->getFullValue($subtotal * ($my_taxrate+1));
 120  
 121          if (!empty($my_taxrate) && MULTIPLE_TAXRATES_ENABLE=='1') {
 122  
 123              if( $auth["show_price_including_tax"] == 1 ) {
 124                  eval( "\$message = \"".$VM_LANG->_('PHPSHOP_INCLUDING_TAX')."\";" );
 125                  $product_rows[$i]['subtotal'] .= "&nbsp;".$message;
 126              }
 127              else {
 128                  $product_rows[$i]['subtotal'] .= "&nbsp;(+ $tax% ".$VM_LANG->_('PHPSHOP_CART_TAX').")";
 129              }
 130          }
 131  
 132          // UPDATE SAVED CART / DELETE FROM SAVED CART

 133          $action_url = $mm_action_url.basename($_SERVER['PHP_SELF']);
 134          $product_rows[$i]['update_form'] = '<form action="'. $action_url .'" method="post" style="display: inline;">
 135          <input type="hidden" name="option" value="com_virtuemart" />
 136          <input type="text" title="'. $VM_LANG->_('PHPSHOP_CART_UPDATE') .'" class="inputbox" size="4" maxlength="4" name="quantity" value="'.$cart[$i]["quantity"].'" />
 137          <input type="hidden" name="page" value="'. $page .'" />
 138      <input type="hidden" name="func" value="savedCartUpdate" />
 139      <input type="hidden" name="product_id" value="'. $cart[$i]["product_id"] .'" />
 140      <input type="hidden" name="prod_id" value="'. $cart[$i]["product_id"] .'" />
 141      <input type="hidden" name="Itemid" value="'. $sess->getShopItemid() .'" />
 142      <input type="hidden" name="description" value="'. stripslashes($cart[$i]["description"]).'" />
 143      <input type="image" name="update" title="'. $VM_LANG->_('PHPSHOP_CART_UPDATE') .'" src="'. VM_THEMEURL .'images/update_quantity_cart.png" alt="'. $VM_LANG->_('PHPSHOP_UPDATE') .'" align="middle" />
 144    </form>';
 145          $product_rows[$i]['delete_form'] = '<form action="'.$action_url.'" method="post" name="delete" style="display: inline;">
 146      <input type="hidden" name="option" value="com_virtuemart" />
 147      <input type="hidden" name="page" value="'. $page .'" />
 148      <input type="hidden" name="Itemid" value="'. $sess->getShopItemid() .'" />
 149      <input type="hidden" name="func" value="savedCartDelete" />
 150      <input type="hidden" name="product_id" value="'. $cart[$i]["product_id"] .'" />
 151      <input type="hidden" name="description" value="'. $cart[$i]["description"].'" />
 152        <input type="image" name="delete" title="'. $VM_LANG->_('PHPSHOP_CART_DELETE') .'" src="'. VM_THEMEURL .'images/remove_from_cart.png" alt="'. $VM_LANG->_('PHPSHOP_CART_DELETE') .'" align="middle" />
 153    </form>';
 154      } // End of for loop through the Cart

 155  
 156      $total = $total_undiscounted = round($total, 5);
 157      $vars["total"] = $total;
 158      $subtotal_display = $GLOBALS['CURRENCY_DISPLAY']->getFullValue($total);
 159  
 160          /* SHOW TAX */

 161      if (!empty($_REQUEST['ship_to_info_id']) || ps_checkout::tax_based_on_vendor_address() ) {
 162  
 163          $show_tax = true;
 164  
 165          if ($weight_total != 0 or TAX_VIRTUAL=='1') {
 166              $order_taxable = $ps_checkout->calc_order_taxable($vars);
 167              $tax_total = $ps_checkout->calc_order_tax($order_taxable, $vars);
 168          } else {
 169              $tax_total = 0;
 170          }
 171          if( $auth['show_price_including_tax']) {
 172              $tax_total *= $discount_factor;
 173          }
 174          $tax_total += $shipping_tax;
 175          $tax_total = round( $tax_total, 5 );
 176          $tax_display = $GLOBALS['CURRENCY_DISPLAY']->getFullValue($tax_total);
 177  
 178          $tax_display .= ps_checkout::show_tax_details( $order_tax_details );
 179      }
 180  
 181      
 182      // Attention: When show_price_including_tax is 1,

 183      // we already have an order_total including the Tax!

 184      if( $auth["show_price_including_tax"] == 0 ) {
 185          $order_total += $tax_total;
 186          $total_undiscounted += $tax_total;
 187      }
 188      $order_total += $shipping_total + $total;
 189      $total_undiscounted += $shipping_total;
 190  
 191  
 192      $net_amount_display = $GLOBALS['CURRENCY_DISPLAY']->getFullValue($order_total-$tax_total);
 193      $order_total_display = $GLOBALS['CURRENCY_DISPLAY']->getFullValue($order_total);
 194      if( $show_basket ) {
 195          ob_start();
 196          if( $auth["show_price_including_tax"] == 1) {
 197              include  (VM_THEMEPATH."templates/basket/basket_b2c.html.php");            
 198          }
 199          else {
 200              include  (VM_THEMEPATH."templates/basket/basket_b2b.html.php");
 201          }
 202          $basket_html = ob_get_contents();
 203          ob_end_clean();
 204      }
 205  
 206  }
 207  
 208  ?>


Generato il: Mon Oct 19 20:29:27 2009 Generato con PHPXref 0.7