Guest Posted November 20, 2004 Share Posted November 20, 2004 Hi, I have been searching for a while and trying to figure out a way to simply link a button on another part of my site to add a certain item to the oscommerce shopping cart. Are there any contributions out there that can help with this, or is there a simple way to find the link that the "add to cart" button uses in oscommerce for each particular item? Thank you very much for your help in advance, ykol20 :-) Link to comment Share on other sites More sharing options...
Guest Posted November 20, 2004 Share Posted November 20, 2004 There is no way to externally link unless you force cookie use. Link to comment Share on other sites More sharing options...
Guest Posted November 20, 2004 Share Posted November 20, 2004 I've seen some other sites do it, what is the script that the button uses to add the item to the shopping cart? I basically want that particular button, just moved to a different page proabably in the same directory, not even a completely different site. Then the customer would use the same oscommerce checkout process from that point on. I want to have all of the products in the database and accessible through oscommerce. Then have another few pages displaying the products a little bit nicer in flash and linking the "add to cart" links to their respective oscommerce "add to cart" links. I am not sure if it is possible but I am pretty sure that I've seen other sites do it, unless I am misunderstanding something. Thanks for the reply :-) Link to comment Share on other sites More sharing options...
Guest Posted November 20, 2004 Share Posted November 20, 2004 OK...create a form that sends POST data to www.yourdomain.com/product_info.php?action=add_product The logic in application_top.php relies on the GET paramter "action" to determine whether to add, update, buy now, etc. but takes the product_id as POST data. Also, you need to pass a POST id if there is an associated attribute or product option. Good luck! Link to comment Share on other sites More sharing options...
burt Posted November 20, 2004 Share Posted November 20, 2004 I made a script that can do this. Click http://www.a1jewelrystore.com/buy.php/15 for example usage (this links to my "work in progress" site and is not a way to get visitors as it is not yet live!). Download the attached .php file. Upload it to the same level as the rest of your pages. Use it like this: http://www.your-domain.com/buy.php/XX Where XX is the number of the product you want people off-site to put directly into their cart. Ex: <a target="_blank" href="http://www.a1jewelrystore.com/buy.php/15">Buy Frantic</a> Link to comment Share on other sites More sharing options...
burt Posted November 20, 2004 Share Posted November 20, 2004 Here's the attachment. It went wrong on the previous post, so hopefully it'll work this time :blush: Link to comment Share on other sites More sharing options...
Guest Posted November 20, 2004 Share Posted November 20, 2004 OK...create a form that sends POST data to www.yourdomain.com/product_info.php?action=add_product The logic in application_top.php relies on the GET paramter "action" to determine whether to add, update, buy now, etc. but takes the product_id as POST data. Also, you need to pass a POST id if there is an associated attribute or product option. Good luck! <{POST_SNAPBACK}> Thanks, how do I easily find the product id? And could give a few more details? Sorry for all of the questions, I am relatively new to oscommerce and php. Thanks for the help tho... Link to comment Share on other sites More sharing options...
burt Posted November 24, 2004 Share Posted November 24, 2004 The attached code snippet will allow you to link to your shopping cart from off-site. If the product has options, it will display the "product_info.php" page to allow the customer to choose the relevant attributes/options. If the product has no attributes/options, the product is placed directly into the shopping cart. Instructions: -------------- 1/ Download the attached code snippet. 2/ Upload it to your webspace on the same level as your shopping_cart.php, product_info.php etc etc pages. 3/ Link to it like this: http://www.whatever-your-domain-is.com/buy.php/XX or like this: <a href="http://www.whatever-your-domain-is.com/buy.php/XX">Buy my Product</a> 4/ Change XX in the above example to whatever product_id you want to use. And obviously put in your correct Domain Name! 5/ Done. Link to comment Share on other sites More sharing options...
SGershon Posted November 24, 2004 Share Posted November 24, 2004 Very, very nice! Thanks for this, Gary! If at first you don't succeed, you must be a programmer. Tip Posted: Languageless Reviews Link to comment Share on other sites More sharing options...
Guest Posted November 24, 2004 Share Posted November 24, 2004 Very nice script Burt!! Elegant solution :) Link to comment Share on other sites More sharing options...
burt Posted November 25, 2004 Share Posted November 25, 2004 No problem, it's something I wrote a while back for a client. I have another one which gives an instant memorable URL. Thus: <?php /* go.php Copyright (c) 2004 osCBooks Released under the GNU General Public License */ require('includes/application_top.php'); $id = (integer) substr($_SERVER['PATH_INFO'], 1); header("Location: " . HTTP_SERVER . DIR_WS_HTTP_CATALOG . FILENAME_PRODUCT_INFO . "?products_id=" . $id); exit; ?> Usage: 1/ Copy/paste the code into a new file named go.php 2/ Upload the new go.php file to your webspace on the same level as your shopping_cart.php, product_info.php etc etc pages. 3/ Link to it like this: http://www.whatever-your-domain-is.com/go.php/XX 4/ Change XX in the above example to whatever product_id you want to go to. And obviously put in your correct Domain Name! 5/ Done. This is much easier than saying (perhaps to a client on the phone): Sure, see my blue widget at www.my-store.com/product_info.php?products_id=123 Now you can say: Sure, see my blue widget at www.my-store.com/go.php/123 Link to comment Share on other sites More sharing options...
concepts Posted October 12, 2007 Share Posted October 12, 2007 For some reason I tried this <a href="http://www.zelikovitz.com/buy.php/596">CLICK HERE TO ADD TO CART</a> and it does not add to the cart... I put the buy.php in the root directory . Any ideas? The attached code snippet will allow you to link to your shopping cart from off-site. If the product has options, it will display the "product_info.php" page to allow the customer to choose the relevant attributes/options. If the product has no attributes/options, the product is placed directly into the shopping cart. Instructions: -------------- 1/ Download the attached code snippet. 2/ Upload it to your webspace on the same level as your shopping_cart.php, product_info.php etc etc pages. 3/ Link to it like this: http://www.whatever-your-domain-is.com/buy.php/XX or like this: <a href="http://www.whatever-your-domain-is.com/buy.php/XX">Buy my Product</a> 4/ Change XX in the above example to whatever product_id you want to use. And obviously put in your correct Domain Name! 5/ Done. Link to comment Share on other sites More sharing options...
xcandyman Posted December 19, 2008 Share Posted December 19, 2008 Hi, Is there any way of the cart remembering what you've added to the cart? For example I use the url http://www.mydomain.com/buy.php/3 It will add item 3 to my basket But then if I add http://www.mydomain.com/buy.php/5 in the url it removes the 'item 3' and places item 5 and uses a new osCsid. Is it possible to add multiple products this way? Thanks Link to comment Share on other sites More sharing options...
xcandyman Posted December 22, 2008 Share Posted December 22, 2008 Anyone? Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.