Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add To Cart on Existing Pages


user444

Recommended Posts

Hello everyone,

 

I've been searching the forums here and the internet for a few days now trying to find out how to do what I need, and have been met with very little progress. Here's my situation, my client already has a website with existing pages for each product he sells (20-30 at this time). He wants to improve his sales by allowing customers to purchase directly off his site (rather than having to call in to place an order).

 

What I want to be able to do is have the user click 'add to cart' on the product pages that already exist, and then from there link directly to the cart page in OSC. My client finds the layout of the OSC pages not to his liking, and rather than wait to have those pages re-designed to match the current layout, he feels it a much better idea to use the existing pages. I understand that I will need to have the session ID maintained from as soon as the user enters the site (and in order to prepare for this I have moved the entire site contents into my OSC root folder). What I need someone to tell me is which code from index.php in OSC do I need to add to my existing pages in order to have all the 'hidden' cart functionality that the user doesn't see function on all existing product pages.

 

Ultimately my goal is to have the site flow as such > user enters www.domain.com and site main page comes up and they can begin browsing > user reads about products, and then finds the one they want > select quantity from drop-down list > click 'add to cart' > be directed to the shopping cart page in OSC to finish checkout process.

 

I am on a tight time frame here and any help that could be offered would be much appreciated.

 

Thanks in Advance

Link to comment
Share on other sites

The "overhead" in osCommerce is done in /includes/application_top.php

 

The osC files "require" this right up front:

 

A code excerpt:

 

<?php
/*
 $Id: index.php,v 1.1 2003/06/11 17:37:59 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

It keeps the session ID and does all the overhead tasks.

 

In your osC Admin you'll need to set "Display Cart After Adding Product" to false on the Configuration page.

 

If it's true you get sent to the shopping cart page after adding a product. Set false, you get sent back to the referring page.

 

A sample of the HTML used for the "Add to cart" might look something like this:

 

<form name="cart_quantity" action="http://www.website.com/catalog/product_info.php?products_id=63&action=add_product" method="post">
 <tr>
<td>
  <input type="hidden" name="products_id" value="63">
  <input type="image" src="includes/languages/english/images/buttons/button_in_cart.gif" border="0" alt="Add to Cart" title=" Add to Cart ">
</td><
 /tr>
</form>

 

In that code products_id=63 and value="63" defines the product from the osC DB.

 

This ought to give you a starting point.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

  • 1 month later...

Hi,

 

This is "exactly" what I want to do, too:

Put an "Add to Shopping Cart" button onto existing web pages.

 

I've looked through the docs and the FAQ and have successfully installed OSC into /catalog, but from here on I'm lost. Is there any info out there? This must be a frequent question.

 

Thanks

Link to comment
Share on other sites

The problem with putting Add To Cart buttons outside of osCommerce is that if the product has attributes then it goes to the Product Info page anyway, because that's where you select the attribute.

 

Vger

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...