cart codeigniter |
dear all developers CI,
i have a view_cart.php page and the code is below Code: <?php $this->load->view('top') ?> that i want is how to change the quantity when i click +/- and that also will change the quantity cart it self. many thanks before udin
udin_ordinary
Dude! Modularize your code! It's close to impossible to follow what is going on
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
(05-08-2016, 12:36 PM)albertleao Wrote: Dude! Modularize your code! It's close to impossible to follow what is going on dear albertleao here is the main code for increase and decrease the quantity, but its not working.. function minquantity(rowid){ var minquan = parseInt($('#txtquantity_' + rowid).val()) - 1; if(minquan > 0) { //alert(quan); $.ajax({ type: "POST", url: "<?php echo base_url();?>ajax", data: { action: "product_model.update_cart", row_id: rowid, new_qty: minquan} }).done(function( msg ) { var total = parseInt(msg); if(total > 0){ $('#cart_count').html(total); $('#txtquantity_'+rowid).val(minquan); } }); } } function plusquantity(rowid){ var plusquan = parseInt($('#txtquantity_' + rowid).val()) + 1; //alert(quan); $.ajax({ type: "POST", url: "<?php echo base_url();?>ajax", data: { action: "product_model.update_cart", row_id: rowid, new_qty: plusquan} }).done(function( msg ) { var total = parseInt(msg); if(total > 0){ $('#cart_count').html(total); $('#txtquantity_' + rowid).val(plusquan); } }); }
udin_ordinary
(05-09-2016, 06:55 AM)udin_ordinary Wrote:(05-08-2016, 12:36 PM)albertleao Wrote: Dude! Modularize your code! It's close to impossible to follow what is going on dude you have to paste as a code block not just a simple text. Is almost impossible to detect the PHP in all that.
I do Front-End development most of the time
His methods are not going to update anything he posting to the base_url() and no method
to change the values. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |