ssnb Posted July 5, 2009 Share Posted July 5, 2009 This is the support forum for the following contribution: Store Locator V1 **** INTRODUCTION ********* This contribution will enable you to include drop down boxes that let your users select their nearest retail stores / stockists - without displaying all of them at once (useful if you don't want a large page full of contact details etc). This package contains all the files, but it does not explain how to create a new page - you will have to do that yourself (there are plenty of forum pages dedicated to explaining how to do that). Alternatively, you might want to install this package on an existing page (such as contact us) This script uses a database table to store the list of cities and contact details etc and at the moment - a separate admin page that allows you to populate the table. V2 could move the admin side into OSC admin - but I don't have the time for that right now and it works great as it is. Demo: http://www.sk8factoryshop.com/mydealer.php This script was originally created by Jennifer - http://www.scriptygoddess.com and modified a lot by me. 10 minute install and no OSC files modified. AS ALWAYS, BACK UP YOUR DB FIRST !! I will help where I can.... Quote Link to comment Share on other sites More sharing options...
spooks Posted July 5, 2009 Share Posted July 5, 2009 Looks good, do you have a link to the contribution? Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
ssnb Posted July 6, 2009 Author Share Posted July 6, 2009 And here is the link to the Contribution http://addons.oscommerce.com/info/6859 Quote Link to comment Share on other sites More sharing options...
ssnb Posted July 6, 2009 Author Share Posted July 6, 2009 Looks good, do you have a link to the contribution? You're too quick for me ;-) it's here: http://addons.oscommerce.com/info/6859 Cheers Quote Link to comment Share on other sites More sharing options...
spooks Posted July 6, 2009 Share Posted July 6, 2009 Thanks, can't wait to try it out, sorry if I was too eager!! Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
multimixer Posted July 6, 2009 Share Posted July 6, 2009 (edited) Hi, great thing you did, exactly what I was looking for, thank you very much. Some first feedback: 1) Installation is an 5 minute issue, there are no osc files affected really, just some addings 2) There must be an issue with adminadd.php and adminedit.php When trying to add a store, I'm getting always the message "there was an error etc", and also nothing new appears in my database When adding directly a store into the database table, then everything is fine, I can find the store again when watching the retailers.php When deleting this store again (via admin), then it works also, no store anymore in the database, so the admindelete.php works fine But we need this to add stores, not just to delete them, right? :) Edited July 6, 2009 by multimixer Quote My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
ssnb Posted July 6, 2009 Author Share Posted July 6, 2009 Hi, great thing you did, exactly what I was looking for, thank you very much. Some first feedback: 1) Installation is an 5 minute issue, there are no osc files affected really, just some addings 2) There must be an issue with adminadd.php and adminedit.php When trying to add a store, I'm getting always the message "there was an error etc", and also nothing new appears in my database When adding directly a store into the database table, then everything is fine, I can find the store again when watching the retailers.php When deleting this store again (via admin), then it works also, no store anymore in the database, so the admindelete.php works fine But we need this to add stores, not just to delete them, right? :) Hello, thanks for your feedback. Did you download the second package? The first had an error in it. Just in case, here is the code for those two files - just replace what you have. adminadd.php <?php session_start(); include('config.php'); include('logindetect.php'); if (isset($_POST['submit'])) { //connect to database include('db.php'); //add entry if (mysql_query("INSERT INTO storelocator(`store`, `url`, `address`, `address2`, `city`, `state`, `zip`, `phone`, `email`) VALUES ('".trim($_POST['store'])."', '".trim($_POST['url'])."', '".trim($_POST['address'])."', '".trim($_POST['address2'])."', '".trim(ucwords(strtolower($_POST['city'])))."', '".$_POST['state']."', '".trim($_POST['zip'])."', '".trim($_POST['phone'])."', '".trim($_POST['email'])."')")) { $msg = "Entry added successfully"; } else { $msg = "There was an error adding the entry. Please try again."; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Dealer Directory - Admin - Add a Store</title> <script type="text/JavaScript"> <!-- function validRequired(formField,fieldLabel,alertmsg) { var result = true; if (formField.value == "") { if (alertmsg == "") { alert('Please enter the ' + fieldLabel +'.'); } else { alert(alertmsg); } formField.focus(); result = false; } return result; } function validate() { if (!validRequired(document.addstore.store,"store name","")) { return false; } if (!validRequired(document.addstore.address,"store's address","")) { return false; } if (!validRequired(document.addstore.city,"store's city","")) { return false; } if (!validRequired(document.addstore.state,"store's state","")) { return false; } if (!validRequired(document.addstore.zip,"store's zipcode","")) { return false; } } //--> </script> </head> <body> <?php include("adminnavigation.php"); ?> <h1>Dealer Directory - Admin - Add a Store</h1> <?php if (isset($msg)) { echo "<p style='color: red;'>".$msg."</p>"; } ?> <p>Fill out the fields below to add a store location:<br /> (* indicates a required field) </p> <form name="addstore" action="adminadd.php" method="post" onSubmit="return validate();"> <table width="500" border="0" cellspacing="0" cellpadding="0" class="formtable"> <tr> <td class="label">Store Name *</td> <td class="field"><input name="store" type="text" id="store" style="width:400px;" /></td> </tr> <tr> <td class="label">URL</td> <td class="field"><input name="url" type="text" id="url" style="width:400px;"/><br /> *please include http://</td> </tr> <tr> <td class="label">Address Line 1 *</td> <td class="field"><input name="address" type="text" id="address" style="width:400px;"/></td> </tr> <tr> <td class="label">Address Line 2</td> <td class="field"><input name="address2" type="text" id="address2" style="width:400px;"/></td> </tr> <tr> <td class="label">City *</td> <td class="field"><input name="city" type="text" id="city" style="width:250px;"/></td> </tr> <tr> <td class="label">Country:</td> <td><select name="state"> <option value="">Please select...</option> <option value="New Zealand">New Zealand</option> <option value="Australia">Australia</option> <option value="Europe">Europe</option> <option value="North America">North America</option> <option value="Asia">Asia</option> <option value="Elsewhere">Elsewhere</option> </select></td> </tr> <tr> <td class="label">Post Code *</td> <td class="field"><input name="zip" type="text" id="zip" /></td> </tr> <tr> <td class="label">Phone</td> <td class="field"><input name="phone" type="text" id="phone" /></td> </tr> <tr> <td class="label">Email</td> <td class="field"><input name="email" type="text" id="email" /></td> </tr> <tr> <td class="label"></td> <td class="field"><input name="submit" type="submit" value="Add Store" /></td> </tr> </table> </form> </body> </html> adminedit.php <?php session_start(); include('config.php'); include('logindetect.php'); if (!isset($_GET['id'])) { header("Location: listallstores.php"); } include('db.php'); if (isset($_POST['submit'])) { //add entry if (mysql_query("UPDATE storelocator set `store`='".trim($_POST['store'])."', `url`='".trim($_POST['url'])."', `address`='".trim($_POST['address'])."', `address2`='".trim($_POST['address2'])."', `city`='".trim(ucwords(strtolower($_POST['city'])))."', `state`='".$_POST['state']."', `zip`='".trim($_POST['zip'])."', `phone`='".trim($_POST['phone'])."', `email`='".trim($_POST['email'])."' where `id`='".$_POST['id']."';")) { $msg = "Entry updated successfully"; } else { $msg = "There was an error updating the entry. Please try again."; } } $result = mysql_query("SELECT * from storelocator where `id` = '".$_GET['id']."';"); $row = mysql_fetch_array($result); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Dealer Directory - Admin - Edit a Store</title> <script type="text/JavaScript"> <!-- function validRequired(formField,fieldLabel,alertmsg) { var result = true; if (formField.value == "") { if (alertmsg == "") { alert('Please enter the ' + fieldLabel +'.'); } else { alert(alertmsg); } formField.focus(); result = false; } return result; } function validate() { if (!validRequired(document.addstore.store,"store name","")) { return false; } if (!validRequired(document.addstore.address,"store's address","")) { return false; } if (!validRequired(document.addstore.city,"store's city","")) { return false; } if (!validRequired(document.addstore.state,"store's state","")) { return false; } if (!validRequired(document.addstore.zip,"store's zipcode","")) { return false; } } //--> </script> </head> <body> <?php include("adminnavigation.php"); ?> <h1>Dealer Directory - Admin - Edit a Store</h1> <?php if (isset($msg)) { echo "<p style='color: red;'>".$msg."</p>"; } ?> <p>Edit the store entry below:<br /> (* indicates a required field)</p> <form name="addstore" action="adminedit.php?id=<?=$_GET['id']; ?>" method="post" onSubmit="return validate();"> <table width="500" border="0" cellspacing="0" cellpadding="0" class="formtable"> <tr> <td class="label">Store Name *</td> <td class="field"><input name="store" type="text" id="store" value="<?=$row['store']; ?>" style="width:400px;" /></td> </tr> <tr> <td class="label">URL<br /> include http://</td> <td class="field"><input name="url" type="text" id="url" value="<?=$row['url']; ?>" style="width:400px;" /></td> </tr> <tr> <td class="label">Address Line 1 *</td> <td class="field"><input name="address" type="text" id="address" value="<?=$row['address']; ?>" style="width:400px;" /></td> </tr> <tr> <td class="label">Address Line 2</td> <td class="field"><input name="address2" type="text" id="address2" value="<?=$row['address2']; ?>" style="width:400px;" /></td> </tr> <tr> <td class="label">City *</td> <td class="field"><input name="city" type="text" id="city" value="<?=$row['city']; ?>" style="width:400px;" /></td> </tr> <tr> <td class="label">Country</td> <td><select name="state"> <option value="">Please select...</option> <option value="New Zealand">New Zealand</option> <option value="Australia">Australia</option> <option value="Europe">Europe</option> <option value="North America">North America</option> <option value="Asia">Asia</option> <option value="Elsewhere">Elsewhere</option> </select> <script type="text/javascript"> for (var i=0; i < document.addstore.state.length; i++) { if (document.addstore.state[i].value == "<?=$row['state']; ?>") { document.addstore.state[i].selected = true; } } </script></td> </tr> <tr> <td class="label">Post Code *</td> <td class="field"><input name="zip" type="text" id="zip" value="<?=$row['zip']; ?>" /></td> </tr> <tr> <td class="label">Phone</td> <td class="field"><input name="phone" type="text" id="phone" value="<?=$row['phone']; ?>" /></td> <tr> <td class="label">email</td> <td class="field"><input name="email" type="text" id="email" value="<?=$row['email']; ?>" /></td> </tr> <tr> <td class="label"><input type="hidden" name="id" value="<?=$_GET['id']; ?>" /></td> <td class="field"><input name="submit" type="submit" value="Update Store" /></td> </tr> </table> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
multimixer Posted July 7, 2009 Share Posted July 7, 2009 Hi, thank you for the reply I installed the second package and also compared what I have with your postings. The files are identical So, the problem remain - I can not add a store via the admin (error message and no database update) - I can see stores that I added directly in the database pressing "list stores". I can see them also on the customers side at retailers.php - I can not edit the stores (error message and no database update) - I can delete a store when pressing "delete" Where could the problem be? I'm breaking my head. Well, I'm not a programmer, but still. Did other people installed this here? How does it work? Ahhh, such a great thing and I can not bring it to work Quote My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
ssnb Posted July 8, 2009 Author Share Posted July 8, 2009 Hi, thank you for the reply I installed the second package and also compared what I have with your postings. The files are identical So, the problem remain - I can not add a store via the admin (error message and no database update) - I can see stores that I added directly in the database pressing "list stores". I can see them also on the customers side at retailers.php - I can not edit the stores (error message and no database update) - I can delete a store when pressing "delete" Where could the problem be? I'm breaking my head. Well, I'm not a programmer, but still. Did other people installed this here? How does it work? Ahhh, such a great thing and I can not bring it to work Sounds like a problem with adminadd and adminedit.php Works fine for me, can't see why it doesn't for you. You could try using the original code here: http://www.scriptygoddess.com/downloads/storelocator.zip Cheers Quote Link to comment Share on other sites More sharing options...
ssnb Posted July 27, 2009 Author Share Posted July 27, 2009 So, the problem remain Did you have any success? Keen to know if you found a bug? Quote Link to comment Share on other sites More sharing options...
multimixer Posted July 28, 2009 Share Posted July 28, 2009 Did you have any success? Keen to know if you found a bug? Hi Yes, I took the original code and everything remains as is. I tried this and that and no result. There must be a connection problem to the database n adminadd and adminedit. I have to confess hat I didn't invest much time in this after my last trials, because of other things to do, but I'll give it one more try next week. My final plan is to display this on checkout-shipping.php (additional to the original retailers.php) and combine it with the "store pick up" option that I have, so that if somebody choose this option, he can choose also in what store to pick up the stuff. I dn't know if somebody else took this contribution and how it works, would be great to know Quote My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
ssnb Posted July 28, 2009 Author Share Posted July 28, 2009 Hi Yes, I took the original code and everything remains as is. I tried this and that and no result. There must be a connection problem to the database n adminadd and adminedit. I have to confess hat I didn't invest much time in this after my last trials, because of other things to do, but I'll give it one more try next week. My final plan is to display this on checkout-shipping.php (additional to the original retailers.php) and combine it with the "store pick up" option that I have, so that if somebody choose this option, he can choose also in what store to pick up the stuff. I dn't know if somebody else took this contribution and how it works, would be great to know Can you provide me with a link so I can take a look? Thanks Sol Quote Link to comment Share on other sites More sharing options...
multimixer Posted July 28, 2009 Share Posted July 28, 2009 Can you provide me with a link so I can take a look? Thanks Sol Yes, you can click here Quote My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
ssnb Posted July 28, 2009 Author Share Posted July 28, 2009 Yes, you can click here OK I replied to your PM Quote Link to comment Share on other sites More sharing options...
multimixer Posted July 29, 2009 Share Posted July 29, 2009 Good news: The problem is SOLVED !! I'll explain what happened: You (ssnb) send me via email a previous version of adminadd.php. The only difference to the recent was the "email" in the sql query. Uploading this file everything worked fine: I could add stores, but I could not edit them. why? Because in adminedit.php there was still the "email" in sql query. Going to the database to see whats going on, things got clear: There was no "email" field. Adding manually an email field solved the problem totally. Now the recent version(including "email") of adminadd.php and adminedit.php work perfectly. What caused the problem? The .sql file in the package do not create an email field in the Database, probably it belongs to the old set of files. Now everything works perfect, you did a great thing sol. And thank you very much for your support and time. I'll keep the forum here posted on modifications and integrations I'll do with this great tool. Quote My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
ssnb Posted July 29, 2009 Author Share Posted July 29, 2009 Good news: The problem is SOLVED !! I'll explain what happened: You (ssnb) send me via email a previous version of adminadd.php. The only difference to the recent was the "email" in the sql query. Uploading this file everything worked fine: I could add stores, but I could not edit them. why? Because in adminedit.php there was still the "email" in sql query. Going to the database to see whats going on, things got clear: There was no "email" field. Adding manually an email field solved the problem totally. Now the recent version(including "email") of adminadd.php and adminedit.php work perfectly. What caused the problem? The .sql file in the package do not create an email field in the Database, probably it belongs to the old set of files. Now everything works perfect, you did a great thing sol. And thank you very much for your support and time. I'll keep the forum here posted on modifications and integrations I'll do with this great tool. Excellent! Thanks for the good news. AHHHH the SQL file must have been incorrect. I will update the package now. Thanks - Sol Quote Link to comment Share on other sites More sharing options...
ssnb Posted July 29, 2009 Author Share Posted July 29, 2009 V1.2 uploaded now - with the correct SQL instructions. http://addons.oscommerce.com/info/6859 Thanks Sol Quote Link to comment Share on other sites More sharing options...
rollout Posted September 16, 2009 Share Posted September 16, 2009 Hello Sol, I have taken a cut at adding a storelocator maintenance box in the Admin area. I would be happy to send a zip of the work to you for your consideration. I also have a screenshot that I can email if you wish. Regards, Rollout Quote Link to comment Share on other sites More sharing options...
roberthpchao Posted April 19, 2017 Share Posted April 19, 2017 Hi Alan, Your script is great. I like to extend 2 more selection. Start from manufacturer, product, state, city. If I imitate getcities.php and change into manufacturer and product. Then modify getstores.php and index.php. Add 2 column in the database table. Will it be possible? Can you give some suggestion? Thanks a lot, Robert Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.