Stock Class Reference

List of all members.

Public Member Functions

Static Public Member Functions

  • static check_inline ($product)
    Control d'une ligne de stock, utilisable dans les boucle produits.
  • static mark_inline ()
    Sortie visuel alert stock / hors stock A utiliser apres l'appel de la methode check_inline.
  • static check_cart ()
    Control complet.

Static Private Attributes


Detailed Description

Definition at line 16 of file Stock.php.


Constructor & Destructor Documentation

Stock::__construct (  ) 

Definition at line 22 of file Stock.php.

00022                                {
00023   }


Member Function Documentation

static Stock::check_cart (  )  [static]

Control complet.

Returns:
bool false = erreur true = ok

Definition at line 69 of file Stock.php.

00069                                      {
00070     global $cart;
00071 
00072     $any_out_of_stock = false;
00073     if (_cst_bool('STOCK_CHECK')) {
00074       $products = $cart->get_products();
00075       for ($i=0, $n=sizeof($products); $i<$n; $i++) {
00076         $any_out_of_stock = self::check_inline($products[$i]);
00077       }
00078       // Out of Stock Et achat hors stock non autorisé
00079       if  (!_cst_bool('STOCK_ALLOW_CHECKOUT') && ($any_out_of_stock == true) ) {
00080         return false;
00081       }
00082     }
00083     return true;
00084   }

Stock::check_inline ( product  )  [static]

Control d'une ligne de stock, utilisable dans les boucle produits.

Parameters:
$product array (quantity, id, track_stock, attributes)
Returns:
bool
  • false = ok
  • true = alert

no check stock

no check stock , product dispo sur commande

check stock

Definition at line 34 of file Stock.php.

Referenced by check_cart(), and shoppingCart::init_draw().

00034                                                {
00035     $attributes= (is_array($product['attributes']) ? $product['attributes'] : array() );
00036 
00037     switch($product['track_stock']) {
00038       case 0: 
00039         self::$marck=0;
00040       break;
00041       case 2: 
00042         self::$marck=1;
00043       break;
00044       case 1: 
00045       default:
00046         self::$marck=( ((tep_get_products_stock($product['id'],$attributes) - $product['quantity'] ) < 0)? 2 : 0);
00047     }
00048      return (in_array(self::$marck, array(2,1) ) )? true : false;
00049   }

Stock::mark_inline (  )  [static]

Sortie visuel alert stock / hors stock A utiliser apres l'appel de la methode check_inline.

Definition at line 56 of file Stock.php.

Referenced by shoppingCart::init_draw().

00056                                       {
00057     if(self::$marck==0) return ;
00058     elseif(self::$marck==2) return ' <span class="markProductOutOfStock">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</span>';
00059     elseif(self::$marck==1) return ' <span class="markProductOutOfStock">' . STOCK_MARK_PRODUCT_NO_STOCK . '</span>';
00060   }


Member Data Documentation

Stock::$marck [static, private]

string

Definition at line 20 of file Stock.php.


The documentation for this class was generated from the following file: