robert_pdx Posted August 9, 2006 Share Posted August 9, 2006 I have been assigned the task of surveying osCommerce to see if my company wants to use this as a shopping cart. I've been playing with it a bit, and I've run into a bit of a snag, that I'm sure an experienced pro could answer. We'd like it to have the functionality of selecting an item from an external site/server (it's an online database, but I can add a dynamic form to the that output to send a query string into osCommerce). In a nutshell, we sell one product but it comes in thousands of "flavors". I'm passing in products_id and action=add_product but I keep getting "Your shopping cart is empty!" Does it require me to pass a session ID, or is there a better way to do this? Thanks, Robert Link to comment Share on other sites More sharing options...
robert_pdx Posted August 9, 2006 Author Share Posted August 9, 2006 Just to be clear, I should mention that I'm passing this info into product_info.php Link to comment Share on other sites More sharing options...
robert_pdx Posted August 9, 2006 Author Share Posted August 9, 2006 Found this link. http://www.oscommerce.com/community/contributions,2657 buy_now and products_id sent to index.php will do the trick. Link to comment Share on other sites More sharing options...
robert_pdx Posted August 9, 2006 Author Share Posted August 9, 2006 My next pool of quicksand - Having added on the "Option Type Feature" contribution, I'd like to incorporate this into the Buy Now so that the text field I have associated with the product is automatically populated based on the offsite link parameters. e.g. Dynamically generated list has little submit forms for each row, submitting the form passes the value for the product attribute. In the product_info.php page, the input field is given the name id[txt_6] but even after URL encoding the brackets, I can't get it to populate the attribute field if I pass that along to index.php with products_id=<value> and action=buy_now. Any help is appreciated. Link to comment Share on other sites More sharing options...
robert_pdx Posted August 9, 2006 Author Share Posted August 9, 2006 Success! Passing info from an external link into the osCommerce shopping cart, including attributes (using contribution "Option Type Feature 1.7.2"): I viewed the source HTML in my web browser on the "product_info.php" screen (item details) to determine that the name of my parameter of interest was "id[txt_6]". This will of course depend on your particular database status at the time you create your new attributes. The following form will correctly add the item plus the attribute value from an external location/site (example with products_id of 195 and my attributes parameter name of id[txt_6] ): <form name="cart_quantity" action="http://yoururl.here.com/product_info.php?products_id=195&action=add_product" method="post"> <input type="hidden" name="products_id" value="195"> <input type="hidden" name="id[txt_6]" value="special attribute data here"> <input type="submit" value="Buy Now"> </form> It's strange to pass a parameter both by the GET/query string method and the POST method, but that's the way to get it to work.... ========================== "I was told I could listen at a reasonable volume while I did my collating...." Link to comment Share on other sites More sharing options...
robert_pdx Posted August 19, 2006 Author Share Posted August 19, 2006 BAH! This method works, except if you click Update, it loses the optional values. Anyone who could shed some light on this would be greatly appreciated. Robert Link to comment Share on other sites More sharing options...
dittones Posted August 19, 2006 Share Posted August 19, 2006 Dear Robert pdx Your problem is that when the update is made it uses the product id to retrieve the info from the database and repop the shopping cart...Remember that you have two modes to deal with...1) When the user is not logged in and add to the shopping cart. 2) when the user has product in the shopping cart and the is forced to log in or set up an account...3) The user is logged in and puts items in the cart... The term used which I call it is soft shopping cart...Much Coding is required to do it and a good understanding of Oscommerce system... But it can be done... I hope this helps Dittone.com Roman Link to comment Share on other sites More sharing options...
robert_pdx Posted August 19, 2006 Author Share Posted August 19, 2006 After much sleuthing, I tracked the trouble down to square brackets being present in one of the data fields. general.php: In tep_get_all_get_params() I added a preg_replace() to strip these brackets from $value. Works well now. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.