Pós edição......
Código: Selecionar todos
//--></script>
<script type="text/javascript"><!--
$('#button-cart').bind('click', function() {
$.ajax({
url: 'index.php?route=checkout/cart/add',
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();
$('.option input, .option textarea').removeClass("input-error");
if (json['error']) {
if (json['error']['option']) {
for (i in json['error']['option']) {
$('#option-' + i + ' input, #option-' + i + ' textarea').addClass("input-error");
$('#option-' + i).after('<span class="error" style="clear:both;position:relative;margin-top:8px;padding-bottom:4px">' + json['error']['option'][i] + '</span>');
}
}
}
if (json['success']) {
window.location='index.php?route=checkout/cart';
}
}
});
});
//--></script>Arquivo Commom.js
Código: Selecionar todos
function addToCart(product_id, quantity) {
quantity = typeof(quantity) != 'undefined' ? quantity : 1;
$.ajax({
url: 'index.php?route=checkout/cart/add',
type: 'post',
data: 'product_id=' + product_id + '&quantity=' + quantity,
dataType: 'json',
success: function(json) {
$('.success, .warning, .attention, .information, .error').remove();
if (json['redirect']) {
location = json['redirect'];
}
if (json['success']) {
window.location='index.php?route=checkout/cart';
}
}
});
}Não funcionou....

