Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add to cart button under product image


Guest

Recommended Posts

Posted

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. :-"

  • 1 month later...
Posted

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. :)

Posted
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 weeks later...
Posted
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.

  • 3 months later...
Posted

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

  • 4 weeks later...
Posted

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:

Life Is Too Short,

Enjoy Your Coffee!

Pete

  • 2 months later...
Posted

great tips! The first post modification is fine and it works for my store perfectly! :thumbsup:

Best regards,

Koh Kho King

  • 4 months later...
Posted

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!

  • 2 weeks later...
Posted
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?

Posted

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

 

 

 

 

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. :-"

  • 3 years later...
Posted

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...