Post by nestor2509 » Thu Nov 19, 2015 6:19 am

Hi!

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',

...
and the one used in a single product page and with options:

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',

...
Having modified the second one I realized that if I didn't pass any product_id to the PHP function add in cart.php. I'm new with JSON and objects in JQUERY, is it posible to pass the object with the options adding the required parameter produt_id.

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

Newbie

Posts

Joined
Thu Nov 19, 2015 6:08 am

Post by pankaj3745 » Thu Jan 28, 2016 5:40 pm

Can you please upload your .tpl file where this javascript is placed? Or PM me

Or you can mail me the file
pnaik7790@gmail.com

Premier Сasual Dating


Newbie

Posts

Joined
Sun Nov 15, 2015 3:59 pm
Location - GB
Who is online

Users browsing this forum: No registered users and 111 guests