Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

external html page linking to adding product to cart?


westmidsguy

Recommended Posts

Posted

Okay so I have a external html page and I have a buy now hyperlink how do I link that so that the product is added to the shopping cart#?

Posted

1. Create your product - this will simply be the product that you want added to the Cart. Easy enough. Make a note of the Product ID - as we'll need this in our "adding" code!

 

2. Create a new blank file called "addproduct.php" and save it into the same directory as your normal base files (index.php, product_info.php and all the rest). You can name it whatever you want really.

 

3. Add the following code to the file you created in Step 2:

 

<?php
 require('includes/application_top.php');
 $cart->add_cart(28);
 tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL'));
?>

 

4. Save the file. Visit in your browser and you will end up at your site Shopping Cart, with nothing other than Product ID 28 (or whatever ID you used in this line of code: $cart->add_cart(28);) in your Cart.

 

If your product has options attached to it, it's slightly more difficult, but still straightforward.

Posted

but i have a external html page and has a buy now text link I want this link to add the product to cart?

will the code u gave do this?

Archived

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

×
×
  • Create New...