daily pastebin goal
61%
SHARE
TWEET

Untitled

a guest Jan 20th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. A PHP Error was encountered
  2. Severity: Notice
  3. Message: Undefined property: Special_cart::$db
  4. Filename: core/Model.php
  5. Line Number: 51
  6.    
  7. modules
  8. --boxes
  9. ----controller
  10. ----models
  11. ----views
  12.    
  13. <?=modules::run('boxes/special_cart/index');?>
  14.    
  15. class Special_cart extends CI_Controller
  16. {
  17.     public function __construct()
  18.     {
  19.         parent::__construct();
  20.  
  21.     }  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.     public function index()
  28.     {
  29.         if ($this->session->userdata('cart'))
  30.         {
  31.             # get product id's and each quantity
  32.  
  33.             $cart_product_list = array_count_values($this->session->userdata('cart'));
  34.  
  35.             # get list of product_id
  36.             $product_list = array_keys($cart_product_list);
  37.  
  38.             # get product details
  39.             $this->load->model('productmodel');
  40.             $this->load->model('stockmodel');
  41.  
  42.             $cart_products = $this->productmodel->cart_get_products_details($product_list);
  43.             $final_cart_array = array();
  44.  
  45.             foreach($cart_products as $cart_product){
  46.                 $product_stock = $this->stockmodel->view_product_stock($cart_product["id"]);
  47.                 if(empty($product_stock) || $product_stock["UNITS"]<=0)
  48.                     $cart_product["UNITS"] = 0;
  49.                 else{
  50.                     if($cart_product_list[$cart_product["id_web"]]>$product_stock["UNITS"])
  51.                         $cart_product["UNITS"] = $product_stock["UNITS"];
  52.                     else{
  53.                         $cart_product["UNITS"] = $cart_product_list[$cart_product["id_web"]];
  54.                     }
  55.                 }
  56.                 $final_cart_array[] = $cart_product;
  57.  
  58.             }
  59.  
  60.             $refresh_cart_array = array();
  61.  
  62.  
  63.             foreach($final_cart_array as $cart_product){
  64.  
  65.                 for($i=1;$i<=$cart_product["UNITS"];$i++){
  66.                     $refresh_cart_array[] = $cart_product["id_web"];
  67.                 }
  68.  
  69.             }
  70.  
  71.  
  72.             $this->load->view("special_cart",array(
  73.                                                 'refresh_cart_array'        => $refresh_cart_array,
  74.                                                 'final_cart_array' => $final_cart_array
  75.                                                 ));
  76.  
  77.  
  78.  
  79.  
  80.  
  81.                 } else {
  82.                 $this->load->view("special_cart",array(
  83.                                                     'refresh_cart_array'        => NULL,
  84.                                                     'final_cart_array' => NULL
  85.                                                     ));
  86.  
  87.                     }
  88.             }  
  89.  
  90. }
  91.    
  92. $autoload['libraries'] = array('database');
  93.    
  94. $this->load->database();
  95.    
  96. public function __consturct()
  97. {
  98.     parent::__construct();
  99.     $this->load->database('default');
  100. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top