Sorry if this have been asked before and maybe it's a dumb question:
But is it possible to output the Google Store Locator in a block instead of using the store-locator page?

Can someone give me some tips how I can make this possible?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

atiba created an issue. See original summary.

fotograafinge’s picture

I wondered the same. I need a block that I can display on multiple pages. But making a block in the store-locator view, only shows sore data but no map.

atiba’s picture

Component: Miscellaneous » User interface
Category: Support request » Feature request
FileSize
989 bytes

I'm changing this issue from 'Support request' to 'Feature request' because I think a lot of people like to see the store locator in a block. It's also suggested here.

Therefore, it's easy to implement so why not right? :)
I got the store locator working in a block by making a custom module.

I'm not a module developer so my module is far from perfect but it works. So fotograafinge, if you're in a hurry and really need your store locator in a block - You can give my custom module a try.

fotograafinge’s picture

Thnx Atiba ! It does the trick :-) Maybe not perfect to a module developer, which I'm also not. But for me it's great !!!
Thanks again.

EDIT: I responded too quickly. The page is now shown as a block, but the page itself is gone. And ... my stores won't show. The throbber stays on "loading". So I only see the map and my current location, but the stores aren't loaded somehow.

And yes, this seems like a much needed feature for a lot of people.

atiba’s picture

Hmm, my custom module doesn't alter the store-locator page. It just uses the callback function of the Google Store Locator module that generates the content and puts it in a block. Did you clear the cache and run cron?
Also, check the block permissions of the Google Store Locator. Be sure to select "All pages except for...". I hope it helps.

fotograafinge’s picture

I cleared the cache, I ran cron, ... and I logged out and back in, and now the store locator page is back.

My block has the right permissions. But it only show the map. And the map moves to my locaties (or the location I type in). But the stores don't show. There it keeps showing "loading". (or "laden" in dutch)

loading

I had a problem with this on my page when I installed GSL, but with a patch from https://www.drupal.org/node/2528458 I got it working. Maybe that is causing issues?

fotograafinge’s picture

I found what is causing the problem in the block

F.e. when the block was displayed on node/5, it was looking for the Location Export View dealers/json (original name was dealer-locator/json, but I changed that) but relative to node/5 en not relative to my site.

GET http://localhost:3000/node/5/dealers/json 404 (Not Found)

Solution: I changed Path to Store Location data to /dealers/json (I forgot the /) in my advanced setting for the GSL module. Everything works fine now !!

(everyone can make stupid mistakes ;-))

atiba’s picture

Making mistakes is a good thing! Hah.
Good to know it's working fine now!

mrP’s picture

Adding a default block to this module is a great idea for increasing its flexibility.

mrP’s picture

Status: Active » Needs review
FileSize
817 bytes

Attached is a patch based on @atiba's work in #3 to provide a block that renders the output of the google store locator page.

mrP’s picture

FileSize
815 bytes

Resubmitted to remove tab.

natanmoraes’s picture

I've re-rolled the patch

  • rodrigoeg committed 05a6146 on 7.x-1.x authored by natanmoraes
    Issue #2634376 by mrP, natanmoraes, atiba, fotograafinge: Display GSL in...
rodrigoeg’s picture

Status: Needs review » Fixed

Patch applied to latest dev version

@natanmoraes, I have made some small changes to your patch, only to keep the array instantiation consistent in the module.

  • rodrigoeg committed 22938da on 7.x-1.x authored by natanmoraes
    Issue #2634376 by mrP, natanmoraes, atiba, fotograafinge, rodrigoeg:...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.