Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Add to cart button under product image


  • You cannot reply to this topic
12 replies to this topic

#1 Tasker

  • Community Member
  • 11 posts
  • Real Name:Jack Stone

Posted 03 November 2005, 00:08

This is just a small modification to place an extra "Add to cart" button under the product image.

Open catalog/product_info.php

Find :

<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>

Add After:

<TR><td align="center" class="main"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

That's it, I came up with this after not finding a way on the web, or anywhere else, hope it is of use and
I've coded it correctly. Just backup and try. :-"

#2 Lavaman

  • Community Member
  • 1 posts
  • Real Name:Antony

Posted 02 January 2006, 11:27

Struggling with this I'm afraid. Have added the above code as it says and the 'add to cart' button is now there but it's not 'clickable'. Is there anything else I need to change as well?

Would also like to add a quantity box next to it as I have at the bottom of the page, again I managed to get this showing on the page but can't change the value.

Thanks in advance for any pointers. :)

#3 Tasker

  • Community Member
  • 11 posts
  • Real Name:Jack Stone

Posted 06 January 2006, 02:58

View PostLavaman, on Jan 3 2006, 12:27 AM, said:

Struggling with this I'm afraid. Have added the above code as it says and the 'add to cart' button is now there but it's not 'clickable'. Is there anything else I need to change as well?

Would also like to add a quantity box next to it as I have at the bottom of the page, again I managed to get this showing on the page but can't change the value.

Thanks in advance for any pointers. :)

Afraid I'm not much help Antony, the button should add items to cart, you could try on a "fresh" ie out of the box product_info.php to see if it works there, of course back up your current one, if it works there you could compare the two product_info.php scripts to see if there is any difference between the two that might be affecting the outcome.
I believe there might be a contribution regarding the product quantities thing.

#4 kitchenniche

  • Community Member
  • 431 posts
  • Real Name:Sandra
  • Location:Kelowna, Beautiful British Columbia, Canada

Posted 02 February 2006, 18:08

This is exactly what i was looking for. Works great, thanks a lot
HIM - Dark Light - Out on 26/09/05

#5 charity_products

  • Community Member
  • 1 posts
  • Real Name:Kevin

Posted 09 February 2006, 12:49

View PostTasker, on Jan 6 2006, 02:58 AM, said:

Afraid I'm not much help Antony, the button should add items to cart, you could try on a "fresh" ie out of the box product_info.php to see if it works there, of course back up your current one, if it works there you could compare the two product_info.php scripts to see if there is any difference between the two that might be affecting the outcome.
I believe there might be a contribution regarding the product quantities thing.

Hi,

I used the code below to do something similar. This makes the actual image a clickable add to cart link with text underneath to say Add to cart. Hope it helps!

<script language="javascript"><!--
document.write('<input type="image" src="<?php echo DIR_WS_IMAGES . $product_info['products_image']; ?>" value="submit"><br>Click above to<br>add to cart');
//--></script>
<noscript>
<input type="image" src="<?php echo DIR_WS_IMAGES . $product_info['products_image']; ?>" value="submit">
</noscript>

Best wishes,
Kevin.

#6 spcrafts

  • Community Member
  • 11 posts
  • Real Name:Steven Saunders

Posted 12 May 2006, 10:48

Thanks... Was also just what I was looking for. Simple quick and got the job done without problems. Didn't interfere with any of my mods.

Cheers

#7 ourcoffeebarn

  • Community Member
  • 99 posts
  • Real Name:Peter Esanbock
  • Gender:Male
  • Location:Wisconsin

Posted 04 June 2006, 01:15

Very easy install for hopefully more sales! Some of my descriptions are very long and an add to cart button at the top of the page is just what I needed! :D :thumbsup:
Enjoy Your Coffee!
Pete

#8 khoking

  • Community Member
  • 203 posts
  • Real Name:KOH KHO KING
  • Gender:Male
  • Location:Malaysia

Posted 26 August 2006, 01:26

great tips! The first post modification is fine and it works for my store perfectly! :thumbsup:
Best regards,
Koh Kho King

#9 pkhdirec

  • Community Member
  • 6 posts
  • Real Name:Patrick H

Posted 13 January 2007, 15:36

Thanks a lot Tasker, that works really great. I always wondered about that, as many of my descriptions are a bit long, and I worried the customer would just give up before getting to the "add to cart" at the bottom. Now, all my images have the "add to cart" button below each and every one. Thanks!

#10 blackie83

  • Community Member
  • 9 posts
  • Real Name:alex

Posted 19 January 2007, 04:31

Hi i added the code below for STS and i am not able to click it
using internet explorer, But firefox and opera is looking fine.

#11 bobcast

  • Community Member
  • 5 posts
  • Real Name:bob cast

Posted 28 January 2007, 00:46

View PostTasker, on Nov 2 2005, 05:08 PM, said:

This is just a small modification to place an extra "Add to cart" button under the product image.

Open catalog/product_info.php

Find :

<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>

Add After:

<TR><td align="center" class="main"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

That's it, I came up with this after not finding a way on the web, or anywhere else, hope it is of use and
I've coded it correctly. Just backup and try. :-"

How do I make a link to add a product to the shopping cart, bypassing the description page?

I only have one product for sale. My main page has a picture of that product, with no link. I want a buynow button that adds my product to the cart and pulls the cart page.

I tryed linking the picture with the following but I don't think its the right way and it goes to the description page instead of the shopping cart page. I want shopping cart page with product already added.

<META HTTP-EQUIV="Refresh"
CONTENT="0; URL=http://localhost/catalog/product_info.php?products_id=3?osCsid=">

I think the above screws up the osCid if someone is signed in
Also take me to the product info page.... and that's not what I want.
I want it to go to the page just past that one. The one with the product in the shopping cart on the cart/checkout page.

any sugestions?

#12 JakeWear

  • Community Member
  • 26 posts
  • Real Name:Vicky Toshach

Posted 28 January 2007, 23:31

I fixed the problem with the script (minor... at the very begining you need to remove the open tag for <noscript>) I really like it. However, my items come in different colors and different sizes. Is there a way to move the additional attributes to the top? I'm a novice with PHP.

Thanks
Vicky




View PostTasker, on Nov 2 2005, 06:08 PM, said:

This is just a small modification to place an extra "Add to cart" button under the product image.

Open catalog/product_info.php

Find :

<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>

Add After:

<TR><td align="center" class="main"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

That's it, I came up with this after not finding a way on the web, or anywhere else, hope it is of use and
I've coded it correctly. Just backup and try. :-"

Edited by wheeloftime, 29 January 2007, 02:58.


#13 desklancer.com

  • Community Member
  • 17 posts
  • Real Name:not given
  • Gender:Male

Posted 21 January 2011, 20:53

in product_info.php find
  <span class="buttonAction"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary', null, '1'); ?></span>  

and replace with
<span class="buttonAction"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart'); ?></span>  

usually on line 306

Edited by desklancer.com, 21 January 2011, 20:55.