[ Index ]
 

Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/includes/classes/ -> shopping_cart.php (sommaire)

File contains just the shopping cart class

Copyright: Copyright 2003-2006 Zen Cart Development Team
Copyright: Portions Copyright 2003 osCommerce
License: http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
Version: $Id: shopping_cart.php 4884 2006-11-05 00:32:55Z ajeh $
Poids: 1879 lignes (85 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 1 fichier
 includes/classes/upload.php

Définit 1 class

shoppingCart:: (39 méthodes):
  shoppingCart()
  restore_contents()
  reset()
  add_cart()
  update_quantity()
  cleanup()
  count_contents()
  get_quantity()
  in_cart()
  remove()
  remove_all()
  get_product_id_list()
  calculate()
  attributes_price()
  attributes_price_onetime_charges()
  attributes_weight()
  get_products()
  show_total()
  show_weight()
  generate_cart_id()
  get_content_type()
  unserialize()
  in_cart_mixed()
  in_cart_mixed_discount_quantity()
  in_cart_check()
  gv_only()
  free_shipping_items()
  free_shipping_prices()
  free_shipping_weight()
  actionUpdateProduct()
  actionAddProduct()
  actionBuyNow()
  actionMultipleAddProduct()
  actionNotify()
  actionNotifyRemove()
  actionCustomerOrder()
  actionRemoveProduct()
  actionCartUserAction()
  adjust_quantity()


Classe: shoppingCart  - X-Ref

shoppingCart()   X-Ref
constructor method

Simply resets the users cart.
return: void

restore_contents()   X-Ref
Method to restore cart contents

For customers who login, cart contents are also stored in the database.
{TABLE_CUSTOMER_BASKET et al}. This allows the system to remember the
contents of their cart over multiple sessions.
This method simply retrieve the content of the databse store cart
for a given customer. Note also that if the customer already has
some items in their cart before thet login, these are merged with
the stored contents.

return: void

reset($reset_database = false)   X-Ref
Method to reset cart contents

resets the contents of the session cart(e,g, empties it)
Depending on the setting of the $reset_database parameter will
also empty the contents of the database stored cart. (Only relevant
if the customer is logged in)

param: boolean whether to reset customers db basket
return: void

add_cart($products_id, $qty = '1', $attributes = '', $notify = true)   X-Ref
Method to add an item to the cart

This method is usually called as the result of a user action.
As the method name applies it adds an item to the uses current cart
and if the customer is logged in, also adds to the database sored
cart.

param: integer the product ID of the item to be added
param: decimal the quantity of the item to be added
param: array any attributes that are attache to the product
param: boolean whether to add the product to the notify list
return: void

update_quantity($products_id, $quantity = '', $attributes = '')   X-Ref
Method to update a cart items quantity

Changes the current quamtity of a certain item in the cart to
a new value. Also updates the database sored cart if customer is
logged in.

param: mixed product ID of item to update
param: decimal the quantity to update the item to
param: array product atributes attached to the item
return: void

cleanup()   X-Ref
Method to clean up carts contents

For various reasons, the quantity of an item in the cart can
fall to zero. This method removes from the cart
all items that have reached this state. The database-stored cart
is also updated where necessary

return: void

count_contents()   X-Ref
Method to count total number of items in cart

Note this is not just the number of distinct items in the cart,
but the number of items adjusted for the quantity of each item
in the cart, So we have had 2 items in the cart, one with a quantity
of 3 and the other with a quantity of 4 our total number of items
would be 7

return: total number of items in cart

get_quantity($products_id)   X-Ref
Method to get the quantity of an item in the cart

param: mixed product ID of item to check
return: decimal the quantity of the item

in_cart($products_id)   X-Ref
Method to check whether a product exists in the cart

param: mixed product ID of item to check
return: boolean

remove($products_id)   X-Ref
Method to remove an item from the cart

param: mixed product ID of item to remove
return: void

remove_all()   X-Ref
Method remove all products from the cart

return: void

get_product_id_list()   X-Ref
Method return a comma separated list of all products in the cart

return: string

calculate()   X-Ref
Method to calculate cart totals(price and weight)

return: void

attributes_price($products_id)   X-Ref
Method to calculate price of attributes for a given item

param: mixed the product ID of the item to check
return: decimal the pice of the items attributes

attributes_price_onetime_charges($products_id, $qty)   X-Ref
Method to calculate one time price of attributes for a given item

param: mixed the product ID of the item to check
param: decimal item quantity
return: decimal the pice of the items attributes

attributes_weight($products_id)   X-Ref
Method to calculate weight of attributes for a given item

param: mixed the product ID of the item to check
return: decimal the weight of the items attributes

get_products($check_for_valid_cart = false)   X-Ref
Method to return details of all products in the cart

param: boolean whether to check if cart contents are valid
return: array

show_total()   X-Ref
Method to calculate total price of items in cart

return: decimal Total Price

show_weight()   X-Ref
Method to calculate total weight of items in cart

return: decimal Total Weight

generate_cart_id($length = 5)   X-Ref
Method to generate a cart ID

param: length of ID to generate
return: string cart ID

get_content_type($gv_only = 'false')   X-Ref
Method to calculate the content type of a cart

param: boolean whether to test for Gift Vouchers only
return: string

unserialize($broken)   X-Ref
Method to unserialize a cart object


in_cart_mixed($products_id)   X-Ref
Method to calculate item quantity, bounded the mixed/min units settings

param: boolean product id of item to check
return: deciaml

in_cart_mixed_discount_quantity($products_id)   X-Ref
Method to calculate item quantity, bounded the mixed/min units settings

param: boolean product id of item to check
return: deciaml

in_cart_check($check_what, $check_value='1')   X-Ref
Method to calculate the number of items in a cart based on an abitrary property

$check_what is the fieldname example: 'products_is_free'
$check_value is the value being tested for - default is 1
Syntax: $_SESSION['cart']->in_cart_check('product_is_free','1');

param: string product field to check
param: mixed value to check for
return: integer number of items matching restraint

gv_only()   X-Ref
Method to check whether cart contains only Gift Vouchers

return: mixed value of Gift Vouchers in cart

free_shipping_items()   X-Ref
Method to return the number of free shipping items in the cart

return: decimal

free_shipping_prices()   X-Ref
Method to return the total price of free shipping items in the cart

return: decimal

free_shipping_weight()   X-Ref
Method to return the total weight of free shipping items in the cart

return: decimal

actionUpdateProduct($goto, $parameters)   X-Ref
Method to handle cart Action - update product

param: string forward destination
param: url parameters

actionAddProduct($goto, $parameters)   X-Ref
Method to handle cart Action - add product

param: string forward destination
param: url parameters

actionBuyNow($goto, $parameters)   X-Ref
Method to handle cart Action - buy now

param: string forward destination
param: url parameters

actionMultipleAddProduct($goto, $parameters)   X-Ref
Method to handle cart Action - multiple add products

param: string forward destination
param: url parameters

actionNotify($goto, $parameters)   X-Ref
Method to handle cart Action - notify

param: string forward destination
param: url parameters

actionNotifyRemove($goto, $parameters)   X-Ref
Method to handle cart Action - notify remove

param: string forward destination
param: url parameters

actionCustomerOrder($goto, $parameters)   X-Ref
Method to handle cart Action - Customer Order

param: string forward destination
param: url parameters

actionRemoveProduct($goto, $parameters)   X-Ref
Method to handle cart Action - remove product

param: string forward destination
param: url parameters

actionCartUserAction($goto, $parameters)   X-Ref
Method to handle cart Action - user action

param: string forward destination
param: url parameters

adjust_quantity($check_qty, $products, $message=false)   X-Ref
Pas de description



Généré le : Mon Nov 26 16:45:43 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics