Welcome Guest, Not a member yet? Register   Sign In
Cart Class - Update price?
#1

[eluser]KazooSoft[/eluser]
Hey all,

I have a complicated product which basicly gets cheaper the more you buy... Many around. To do this im handling a If statment which will determing every time the cart is updated. It works perfectly for the add product, but not when updating.

Whats wrong with this?
Code:
$data = array(  
        'rowid' => $item[$i],
        'price'   => $cost,
        'qty'   => $qty[$i]                              
        );  
$this->cart->update($data);


Is it not possible to update the price?
#2

[eluser]KazooSoft[/eluser]
For the record. It produces no errors and $cost is calculated earlier on perfectly.
#3

[eluser]KazooSoft[/eluser]
If anyone has a better solution i had to do this.. Its a big bodjey:

Code:
for($i=0;$i < $total;$i++)  
            {  
            //echo $total;                
                if($name[$i] = 'LeXii') // If it is LeXii do our super magic
                    {
                        
                        $cost = $this->lexii_calc($qty[$i]);
                        
                        
                        $data = array(
                              'rowid'     => $item[$i],
                              'qty'       => 0,
                              'price'   => $cost,
                              'name'    => $name
                              );  
                        $this->cart->update($data);
                        
                        $data2 = array(
                              'id'      => $id[$i],
                              'qty'       => $qty[$i],
                              'price'   => $cost,
                              'name'    => $name[$i]
                              );  
                        $this->cart->insert($data2);
                           //echo $cost;                        
                        //echo $name[$i];
                        //print_r($data);
                    } else {                
                
                        // Create an array with the products rowid's and quantities.  
                        $data = array(  
                              'rowid' => $item[$i],
                              'qty'   => $qty[$i]
                           );
                        $this->cart->update($data);
                      }
                   // Update the cart with the new information  
                
            }




Theme © iAndrew 2016 - Forum software by © MyBB