Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Zip Code Store Locator or Google Map Store Locator


Go to End
Reply


16 Posts   7249 Views

Avatar
dalesaurus

Community Member, 283 Posts

3 November 2009 at 5:01pm

That should totally work. Nothing complicated going on. Are you using $allowed_actions by any chance? Can you attach your whole php file?

Avatar
socks

Community Member, 190 Posts

3 November 2009 at 10:32pm

Tried to find documentation that explained $allowed_actions but didn't see any.

Avatar
dalesaurus

Community Member, 283 Posts

5 November 2009 at 6:23pm

Oh maaan socks you have all kinds of problems.

1. Your class names don't match your file names, this won't be an issue in 2.4 but it is in 2.3 and below
2. You copied my psudo code which doesn't actually work. The DataObject::get call should throw all kinds of errors
3. You are calling the controller action in your template as a control

You are missing a whole lot of Silverstripe 101 in the attached code.

Brush up on tutorial 2 for the controller
http://doc.silverstripe.org/doku.php?id=tutorial:2-extending-a-basic-site

And for the template rendering hit up tutorial 4
http://doc.silverstripe.org/doku.php?id=tutorial:4-site-search#showing_the_results

Avatar
socks

Community Member, 190 Posts

5 November 2009 at 8:06pm

Edited: 05/11/2009 8:07pm

How'd I go from so close to not knowing the basics. I had this working fine when I actually had a page type GoogleMapXml.php and a page in the CMS, but trying to by-pass the CMS and spit out the DataObjects directly to a template is something I haven't done before. Since I still don't see documentation that explains this well enough I'm not sure what to do besides ask for help.

1. Your class names don't match your file names, this won't be an issue in 2.4 but it is in 2.3 and below

If you're talking about Page5.php doesn't match my Page class..that's this forum renaming my file.

I'll just start another thread and see if someone else can help.

thank you.

Avatar
AdamJ

Community Member, 145 Posts

5 November 2009 at 8:09pm

I'll just start another thread and see if someone else can help.

Whats wrong with this thread?

Avatar
dalesaurus

Community Member, 283 Posts

6 November 2009 at 9:30am

Aww c'mon socks, don't stomp off and pout. Building off the last post I wrote with code addressing point 3:

GoogleMapXml.ss

<?xml version="1.0" encoding="UTF-8"?>
<markers>
<% control Stores %>
   <marker address="$Address" city="$City" state="$State" zip="$Zip" phone="$Phone" lat="$Lat" lng="$Lng" delivery="$Delivery" notation="$Notation"></marker>
<% end_control %>
</markers>

This is all explained in detail with working code examples here, except you are returning a DataSet of StoreLocations instead of Search Results: http://doc.silverstripe.org/doku.php?id=tutorial:4-site-search#showing_the_results

Avatar
pixel888

Community Member, 1 Post

6 November 2010 at 5:26am

Hello Guys,

Here is ready to use USA/Canada Store Locator solution.
http://www.php4script.com/store-locator-script/

I hope it will helpfull someone

Avatar
tzeller

Community Member, 26 Posts

21 March 2011 at 6:38am

Oi socks did you finally realized the store locator?

This is exactly what i need to do at the moment.

Thks for your feedback.

Go to Top