Post by lashman » Sat Apr 28, 2012 6:56 am

Hi,
OC V1.5.2.1
When clicking Category and it brings up the products list page, it has a add to cart button against each product, I would prefer customers to go to the product details page before they can add to cart, is there a possible way of doing this? I am not a coder but can follow instructions.
Thank You.

Active Member

Posts

Joined
Sun Feb 21, 2010 9:02 pm
Location - North Yorkshire

Post by JAY6390 » Sun Apr 29, 2012 8:58 pm

Removing this

Code: Select all

<input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" />
from your theme category template will do it

Code: Select all

/catalog/view/theme/default/template/product/category.tpl
(assuming you're using the default theme). Custom themes may vary, but should work pretty similarly

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by chris.dempsey » Wed May 02, 2012 7:29 pm

Also needs both instances of the line:
html += ' <div class="cart">' + $(element).find('.cart').html() + '</div>';

removed as well otherwise the javascript function on the same page outputs 'null' to screen.

New member

Posts

Joined
Wed Apr 04, 2012 6:43 pm

Post by GoGo OpenCart » Wed May 02, 2012 8:06 pm

chris.dempsey wrote:Also needs both instances of the line:
html += ' <div class="cart">' + $(element).find('.cart').html() + '</div>';

removed as well otherwise the javascript function on the same page outputs 'null' to screen.
No, you don't need to remove that one, and it won't output "null", because you are not removing the whole DIV section, but only the button ;)

See all my extensions: https://www.opencart.com/index.php?rout ... 20OpenCart


User avatar
Active Member

Posts

Joined
Mon Nov 14, 2011 11:30 pm

Post by webgeeze » Fri Apr 12, 2013 9:30 pm

I disagree with the last comment on this page. I suffered the null issue until I commented out the two lines as stated by chris

I change these from
html += ' <div class="cart">' + $(element).find('.cart').html() + '</div>';

to
<!-- html += ' <div class="cart">' + $(element).find('.cart').html() + '</div>'; -->

and the cart button removed without getting the null notice.

OpenCart 1.5.5.1

Joomla & Wordpress Specialist
E-Commerce Specialist
SEO Consultant

Freephone: 0800 756 9975
Website: www.awebserver.co.uk


Newbie

Posts

Joined
Tue Oct 09, 2012 4:41 pm
Location - Northampton

Post by GoGo OpenCart » Fri Apr 12, 2013 9:35 pm

webgeeze wrote:I disagree with the last comment on this page. I suffered the null issue until I commented out the two lines as stated by chris

I change these from
html += ' <div class="cart">' + $(element).find('.cart').html() + '</div>';

to
<!-- html += ' <div class="cart">' + $(element).find('.cart').html() + '</div>'; -->

and the cart button removed without getting the null notice.

OpenCart 1.5.5.1
It's because you've removed:

Code: Select all

      <div class="cart">
        <input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" />
      </div>
If you've removed just:

Code: Select all

        <input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" />
then there's no need to remove the code you've mentioned, and there will be no "null"...

See all my extensions: https://www.opencart.com/index.php?rout ... 20OpenCart


User avatar
Active Member

Posts

Joined
Mon Nov 14, 2011 11:30 pm

Post by Wahaj » Wed Nov 11, 2015 7:37 am

If I would like to redirect it to product detail page instead of adding product to cart then what should I do

Newbie

Posts

Joined
Tue Nov 03, 2015 5:17 am
Who is online

Users browsing this forum: No registered users and 25 guests