tg_shp_cart_ajax

The Responsive Minimal tg shp cart ajax function.

Description

tg_shp_cart_ajax( (constant) $action_type = false ); 

Parameters (1)

0. $action_type — Optional. (constant) => false
The action type.

Usage

  1. if ( !function_exists( 'tg_shp_cart_ajax' ) ) { 
  2. require_once '/functions/taxonomies.php'; 
  3.  
  4. // The action type. 
  5. $action_type = false; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = tg_shp_cart_ajax($action_type); 
  9.  

Defined (1)

The function is defined in the following location(s).

/functions/taxonomies.php  
  1. function tg_shp_cart_ajax($action_type=false) { 
  2. $action_type=($action_type==='')?false:$action_type; 
  3. if (isset ($_POST['action_type']) or $action_type!==false ) { 
  4. $_POST['action_type']=($action_type!==false )?$action_type:$_POST['action_type']; 
  5. $id=$_POST['tg_id_product']; 
  6. switch($_POST['action_type']) { 
  7. case 'tg_shp_add':/**aade un producto*/ 
  8. case 'tg_shp_remove':/**elimina los items de un producto*/ 
  9. case 'tg_shp_delete':/**borra un producto*/ 
  10. $return =tg_action_shp_cart($id, $action_type); 
  11. break; 
  12. case 'get_all_items': 
  13. $return =tg_action_shp_cart('', $action_type); 
  14. break; 
  15. if ($action_type!==false) { 
  16. return $return; 
  17. }else{ 
  18. exit;