Fórum OpenCart Brasil

Por um e-commerce livre, confiável e profissional

Suporte geral sobre problemas técnicos para OpenCart v1.x.
#38094
Boa tarde, estou com um probleminha o meu botão comprar da pagina inicial e o buscar parou de funcionar, eu já fiz alteração no aquivo common, na linha:url: 'index.php?route=checkout/cart/add/',

Mas não resolveu.

Obrigado.
#38111
Coloca o código abaixo no arquivo catalog/view/theme/javascript/common.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']) {
				$('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
				
				$('.success').fadeIn('slow');
				
				$('#cart-total').html(json['total']);
				
				$('html, body').animate({ scrollTop: 0 }, 'slow'); 
			}	
		}
	});
}
#38133
pode ser antes de function addCompare()
#38260
Varia de tema para tema, mais o padrão é catalog/view/theme/*/stylesheet/stylesheet.css
#47757
valdeir2000 escreveu:Coloca o código abaixo no arquivo catalog/view/theme/javascript/common.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']) {
				$('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
				
				$('.success').fadeIn('slow');
				
				$('#cart-total').html(json['total']);
				
				$('html, body').animate({ scrollTop: 0 }, 'slow'); 
			}	
		}
	});
}

Bom dia. Utilizo o opencart 1.5.6.1, mas o botão comprar não funciona na página index.php. Nas outras páginas, como home, carrinho de compras, etc. o botão funciona normalmente. Por gentileza, tem alguma dica do que possa estar acontecendo?

http://www.mercadolivreloja.com.br/