westmidsguy Posted November 18, 2009 Posted November 18, 2009 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#?
multimixer Posted November 18, 2009 Posted November 18, 2009 Is this external page completely standalone, or does it "play" inside a .php page getting called by <?php include("mypage.html"); ?> ? My community profile | Template system for osCommerce - New: Responsive | Feedback channel
burt Posted November 18, 2009 Posted November 18, 2009 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.
westmidsguy Posted November 18, 2009 Author Posted November 18, 2009 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?
burt Posted November 18, 2009 Posted November 18, 2009 <a href="http://yourdomain.com/store/addproduct.php">buy it</a> You could have just tried it?
westmidsguy Posted November 19, 2009 Author Posted November 19, 2009 I will try all this shortly and feedback to you how it goes
Recommended Posts
Archived
This topic is now archived and is closed to further replies.