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

Post by parkookk » Mon Jul 03, 2023 11:20 pm

JAY6390 wrote:
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
Hi, Does anyone know how can I remove it from OC3038 please?

User avatar
Active Member

Posts

Joined
Thu Jan 17, 2013 11:56 pm
Location - london

Post by straightlight » Mon Jul 03, 2023 11:34 pm

parkookk wrote:
Mon Jul 03, 2023 11:20 pm
JAY6390 wrote:
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
Hi, Does anyone know how can I remove it from OC3038 please?
- catalog/view/theme/<your_theme>/template/product/category.twig:

Code: Select all

<button type="button" onclick="cart.add('{{ product.product_id }}', '{{ product.minimum }}');"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md">{{ button_cart }}</span></button>
Same in catalog/view/theme/<your_theme>/template/extension/module/category.twig file (also depending on the custom theme you might use).

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: stefansmith129 and 205 guests