smack-a-bro
smack-a-bro

Reputation: 741

Remove add to cart notification on OpenCart product pages

When adding a product to the cart in OpenCart a notification pops up on the top of the page. I would like to remove this notification BUT only on the product pages.

Is there a way to easily do this? I have searched up and down with no luck.

Upvotes: 0

Views: 1425

Answers (1)

You Old Fool
You Old Fool

Reputation: 22941

A better understanding of how Opencart is structured, and some javascript basics will be very helpful for you. Reading this would be a good place to start for the application structure: http://docs.opencart.com/developer/module/

Disclaimer: I wouldn't recommend this. how will the customer know that clicking the button worked and actually did something?

That being said, the code in question lies in: catalog/view/theme/{your theme}/template/product/product.tpl

Depending on your version or theme you should look for this code (below is example of OC v1.5.6.4):

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'); 
}

And comment or remove lines like this:

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'); 
}

Make sure to leave the $('#cart-total').html(json['total']); line as it updates the mini cart module.

Upvotes: 2

Related Questions