Hi all,
I am developing a flash module which will allow users to choose options of the item, then I need the flash object to add the item in the cart with the selected options.
I tryied to generate an add to cart url from flash but it is not working:
index.php?route=checkout/cart/update&product_id=28&quantity=1
or
index.php?route=checkout/cart&product_id=40&quantity=1
Any idea on how to do this?
I am running opencart 1.5
For Iphone/iPad we're developing an HTML5 alternative, we have this flash object which allows users to choose the color and see the color changing in the image, moreover they are able to rotate the image
well, the add to cart buttons use a javascript onlick event
addToCart('4'); // where 4 is the product_id for simple products (no options)
However, for products with options, the following Ajax is used to post data
Haven't tested this, but in theory, you should be able to post json encoded data to: index.php?route=checkout/cart/update to achieve the same result ?
addToCart('4'); // where 4 is the product_id for simple products (no options)
However, for products with options, the following Ajax is used to post data
Code: Select all
<script type="text/javascript"><!--
$('#button-cart').bind('click', function() {
$.ajax({
url: 'index.php?route=checkout/cart/update',
type: 'post',
data: $('.product-info input[type=\'text\'], .product-info input[type=\'hidden\'], .product-info input[type=\'radio\']:checked, .product-info input[type=\'checkbox\']:checked, .product-info select, .product-info textarea'),
dataType: 'json',
success: function(json) {
$('.success, .warning, .attention, information, .error').remove();
if (json['error']) {
if (json['error']['warning']) {
$('#notification').html('<div class="warning" style="display: none;">' + json['error']['warning'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
$('.warning').fadeIn('slow');
}
for (i in json['error']) {
$('#option-' + i).after('<span class="error">' + json['error'][i] + '</span>');
}
}
if (json['success']) {
$('#notification').html('<div class="attention" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
$('.attention').fadeIn('slow');
$('#cart_total').html(json['total']);
$('html, body').animate({ scrollTop: 0 }, 'slow');
}
}
});
});
//--></script>
Who is online
Users browsing this forum: No registered users and 71 guests