Вообщем я реализовал то, что хотел вот так,
<?php if ($product_in_cart) { ?>
<a href="<?php echo $cart; ?>"><?php echo $text_cart; ?></a>
<?php } else { ?>
<input type="button" value="<?php echo $button_cart; ?>" id="button-cart" class="button" />
<?php } ?>
но есть проблемка, когда товар добавляется кнопка сразу не меняется, а если обновить страницу то принимает вид который должен быть. Если я правильно думаю нужно поправить скрипт который вшит в product.tpl
$('#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();
if (json['error']) {
if (json['error']['option']) {
for (i in json['error']['option']) {
$('#option-' + i).after('<span class="error">' + json['error']['option'][i] + '</span>');
}
}
if (json['error']['profile']) {
$('select[name="profile_id"]').after('<span class="error">' + json['error']['profile'] + '</span>');
}
}
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').load('index.php?route=module/cart #cart > *');
//$('html, body').animate({ scrollTop: 0 }, 'slow');
}
}
});
});
Подскажите прав я или нет.