osCommerce is a great tool for developers to create complete e-commerce websites in a flash. But sometimes we don’t always need the entire store to be osCommerce. Sometimes we already have a beautifully designed website and we just want to use the osCommerce shopping cart and e-commerce abilities. Unfortunately, osCommerce does not have any features or versions that allow you to just install the shopping cart.
But in fact, there is a pretty quick and easy way to integrate osCommerce with your website.
Note: This article assumes you’ve already added your products to the osCommerce database.
Steps
1: Initialize the osCommerce variables
When a user first adds a product to your shopping cart, osCommerce assigns a shopping cart to them based on a cookie it sets. But before it will do that, it checks to see if a cookie named “cookie_test” was accepted. If it was accepted, it will assign a cookied named “osCsid” which will serve to uniquely identify your users. But if this cookie is not set the user will be directed to the infamous “cookie usage” page. For that reason, and some others, you must do the following to every page of your website that a user may go to.
At the very top of every page on your website, add the following code: . And yes, this means all of your .html pages will need to be converted to .php files.
2: Create your template
Take one of your webpages that you would like the osCommerce pages to look like and remove its content and keep only the essential design elements and navigation you need. Essentially, you’re creating a template for your website.
3: Customize the osCommerce pages
Take your newly created template and save it with the same name as the osCommerce page you want to customize. For example, if you want to make the shopping cart integrate with your template, name the page shopping_cart.php but ensure it’s in a different directory so you do not write over the original. Now, open the original file that came with osCommerce (shopping_cart.php in our example) and copy the code from the very beginning to right before the tags. Now paste this code to the top of the the page you created from your template. Next, you’ll want to take any of the javascript found between the tags in the original file and paste those in between the tags of your new file. Finally, scroll down your original file until you see the code. Copy the text between
and and paste it into the spot you designated for osCommerce output in the file you created from your template.
Now the page’s look should match your website well, but you may need to make some additional tweaks in your stylesheet to match any classes the osCommerce code is using.
Then just upload your new page and overwrite the original. Repeat this until all of the osCommerce pages have been customized.
4: Add osCommerce to your products pages
In order to allow users to add your products to the shopping cart, you need to do one simple step to be able to add the product to the cart. Open your products page and add the following underneath each item:
This form will allow a product to be added to the cart. It determines which product to add based on the value supplied in the [textbox] tag. Your products_id is determined by the value you specified for you product when you added it to
the database.



