I'm trying to get multiple products on one single page. Some products have options some not, what I'm trying to do y somehow merge this two default function of opencart using javascript:
'
The one used to add an object without options:
Code: Select all
$.ajax({
url: 'index.php?route=checkout/cart/add',
type: 'post',
data: 'product_id=' + product_id + '&quantity=' + (typeof(quantity) != 'undefined' ? quantity : 1),
dataType: 'json',
...
Code: Select all
$.ajax({
url: 'index.php?route=checkout/cart/add',
type: 'post',
data: $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea'),
dataType: 'json',
...
I've tried to set product_id to a default and known product and everything works, I just need to pass that parameter in order to everything work.
Thank you for your help