Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do I move the "Add the Cart" button to the top of the page?


onecatnomice

Recommended Posts

I wonder if anyone can help please.

 

When users click the "Buy Now" button they are taken to the Product Information page. The "Add to Cart" button is at the bottom of the page. If the page has a lot of information about the product the button is "below the fold" i.e. not visible on the screen.

 

Is it possible to add another "Add to Cart" at the top of the page so users don't have to scroll down to find it? If so how?!

 

Many thanks. :)

Link to comment
Share on other sites

In product_info.php, around line #94, change:

 

<td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>

 

to:

 

<td class="pageHeading" align="right" valign="top"><?php echo $products_price . '<br />' . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>

 

This will put an additional "Add to Cart" button below the price.

For ALL problems, please review this link first -> osCommerce Knowledge Base

Link to comment
Share on other sites

You are very welcome. I'd been wanting to do this also, but had forgotten to. You jogged my memory.

 

I've tweaked the code even further to display the add'l button only if the description length is larger than a set number of characters.

 

<td class="pageHeading" align="right" valign="top"><?php echo $products_price; if (strlen($product_info['products_description']) > ADD_TO_CART_BUTTON) { echo '<br />' . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);}; ?></td>

 

I added a config item, but you can just replace 'ADD_TO_CART_BUTTON' with a sane value. 0 to always show it and about 1000 works to keep from having to scroll down the page to find the bottom button.

For ALL problems, please review this link first -> osCommerce Knowledge Base

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...