Welcome Guest, Not a member yet? Register   Sign In
Cart Class - Add another product
#1

[eluser]alan-tucker[/eluser]
Hi

When adding a product to the basket which has already been previously added how can I update the QTY? One issue is production option combinations where they have the same id/sku coder but may have different options of like a colour or/and size etc.

Code:
$data = array(
                             'id'      => $this->input->post('id'),
                             'qty'     => $this->input->post('qty'),
                             'price'   => $this->input->post('price'),
                             'name'    => $this->input->post('name')
                        );
    $this->cart->insert($data);                
    redirect($this->config->item('base_url')."basket/");

Thanks
#2

[eluser]alan-tucker[/eluser]
Sorted, see http://ellislab.com/forums/viewthread/129037/
#3

[eluser]jcavard[/eluser]
[quote author="alan-tucker" date="1253282617"]
Code:
redirect($this->config->item('base_url')."basket/");
[/quote]

Just a tip..
Code:
redirect(site_url("basket/"));
it retreive the same value, only it's shorter to write Wink
#4

[eluser]alan-tucker[/eluser]
thanks will give it a whirl :-)
#5

[eluser]alan-tucker[/eluser]
sends me back to the index/home page, doh.
#6

[eluser]davidbehler[/eluser]
The standard base_url function does not take any arguments, it only returns what's set as base_url in the config. I have an updated version of this function where it actually does take arguments (e.g. to generate urls to images, css files and so on) and I'm pretty sure I've posted it before...

But
Code:
redirect('basket');
// or
redirect(site_url('basket'));
is propably what you want.
#7

[eluser]alan-tucker[/eluser]
Thanks very much for all the help :-)
#8

[eluser]jcavard[/eluser]
[quote author="waldmeister" date="1253294650"]The standard base_url function does not take any arguments, it only returns what's set as base_url in the config. I have an updated version of this function where it actually does take arguments (e.g. to generate urls to images, css files and so on) and I'm pretty sure I've posted it before...

But
Code:
redirect('basket');
// or
redirect(site_url('basket'));
is propably what you want.[/quote]

Right on! I jsut realised I had post the wrong site_url/base_url(). I came to correct my mistake, thanks waldmeister!
#9

[eluser]alan-tucker[/eluser]
just noticed that adding a "/" at the end e.g. redirect(site_url('basket/')); sends me back to domain.com/basket when i would like it to be domain.com/basket/
#10

[eluser]jcavard[/eluser]
[quote author="alan-tucker" date="1253295452"]just noticed that adding a "/" at the end e.g. redirect(site_url('basket/')); sends me back to domain.com/basket when i would like it to be domain.com/basket/[/quote]
CI trims that leading '/'.
try this then
Code:
redirect(base_url() . 'basket/');
it really works this time Wink




Theme © iAndrew 2016 - Forum software by © MyBB