WordPress.org

Ready to get started?Download WordPress

Forums

Store Locator Plus
Request for new extension hooks (15 posts)

  1. don benjamin
    Member
    Posted 1 year ago #

    Hi,

    I've been working on an extension to the store-locator-le plugin to allow the locations to be populated from an external source. I've got it working from the code as it is, but I'm worried some of what I've done may break with future updates to the code. If you could make a few modifications to the core this would make my extension much more stable.

    I've posted a patch here:

    http://pastebin.com/dGvCwDvG

    Let me know if there's a better format for this.

    Basically I've added in two hooks to inform my plugin when the location data is inserted/edited, and I've removed the check in "getFieldValue()" which returns nothing when adding a location.

    The first two should be safe enough. I'm not entirely sure of the implications of the change to getFieldValue(), but without it I can't see a way to add default values to new locations.

    Thanks for all your hard work,
    Don

    http://wordpress.org/extend/plugins/store-locator-le/

  2. Charleston Software Associates
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for the input, Don.

    You can follow code updates and grab them at github:
    https://github.com/charlestonsoftware

    I will look at this and see what I can do. If you create a plugin you think others will want to use, contact me privately and we can discuss listing it on the CSA website, the monthly newsletter, and the in-plugin news feed. http://www.charlestonsw.com/mindset/contact-us/

  3. Charleston Software Associates
    Member
    Plugin Author

    Posted 1 year ago #

    Coming in 3.8.19 - your new action hooks...

    http://www.charlestonsw.com/support/documentation/technical-documentation/store-locator-plus/slp-action-hooks-and-filters/location-management-actions-filters/

    getFieldValue(<fld>,true) will execute as you desire.

    /**
              * Return the value of the field specified for the current location.
              * @param string $fldname - a location field
              * @param boolean $blankifnull - if true return '' if fldname===null
              * @return string - value of the field
              */
             function getFieldValue($fldname=null,$blankifnull = false) {
                 if ($blankifnull && ($fldname === null)) { return ''; }
                 if (($fldname === null) || ($this->addingLocation)) { return ''; }
                 return $this->currentLocation[$fldname];
             }
  4. don benjamin
    Member
    Posted 1 year ago #

    Hi,

    That's great news, thanks.

    Although, I think I may not have been clear on what I needed from the getFieldValue($fldname) function.

    Basically my problem is that I want to over-ride the values for new locations. i.e. I want the add location form to come up with pre-populated values.

    Currently there is a hook "slp_edit_location_data" which lets me over-ride the values when editing existing locations, but this hook is ignored when adding new locations, because the "getFieldValue()" function always returns an empty string.

    I'm looking for a way to have the value returned from that function even if $this->addingLocation is true.

    Maybe a filter a filter would be less intrusive than my original suggestion, something like:

    if (($fldname === null) || apply_filters('slp_nopopulate_adding_form',$this->addingLocation))

    I hope that makes sense,

    Thanks,
    Don

  5. Charleston Software Associates
    Member
    Plugin Author

    Posted 1 year ago #

    Ok - so you want to pre-populate EXISTING fields, not new ones, correct?

    The new getFieldValue will allow presets on new fields only. I will need to think about existing fields.

  6. don benjamin
    Member
    Posted 1 year ago #

    Hi,

    Yes, that's correct, I want to be able to populate store name, zip code, address etc.

    Hope that's possible.

    Thanks again for all the hard work.

  7. fort123
    Member
    Posted 1 year ago #

    dont forget to add the rebuild te "store-pages" function. Otherwise info is updates but not the store-page itself. It would be nice btw if the store_page directory could be a dynamic name.

  8. Charleston Software Associates
    Member
    Plugin Author

    Posted 1 year ago #

    I need to do a lot of stuff to store pages... I'm trying to extricate that code but it is fairly well inter-woven. I'm hoping to make it 100% separated like the other add-ons... which means you'll be able to basically "take that over" with any other plugin.

    I'm hoping to work on the store pages hook soon. Just starting some 3.9 patches (found a nasty bug on WPMU sites where add-on packs are disabled).

    BTW - when you get the new add-ons sorted out I'd be happy to add them to my store as well to increase exposure. Ping me at http://www.charlestonsw.com/mindset/contact-us/ if you are interested in that possibility.

  9. Charleston Software Associates
    Member
    Plugin Author

    Posted 1 year ago #

    I've been adding a LOT of new action hooks & filters that are coming in v3.9. They are documented here on the new "Store Pages", "Plugin Management", and "Location Management" consolidated pages... complete with source code syntax highlighting.

    http://www.charlestonsw.com/support/documentation/technical-documentation/store-locator-plus/slp-action-hooks-and-filters/

    The latest updates are always on GitHub.
    https://github.com/charlestonsoftware

    I think you'll find some of them helpful & more are coming as I update some of the add-on packs.

  10. fort123
    Member
    Posted 1 year ago #

    wow, you give up some of your spare time here. Good work. Btw you want to make the store_pages plugin unpaid? Or did i make a misread. What about the guys (like me) that paid for it?

  11. fort123
    Member
    Posted 1 year ago #

    btw maybe to much to ask

    but maybe its an idea to add the town asswell
    like in your sample

    Use the Permalinks Starts With setting to change the default base URL from /store_pages/<storename> to whatever is appropriate for your site. If all of your locations are for rum distilleries change the setting to rum_distiller and the WordPress URL becomes something like /rum_distiller/matusalem.

    Seo it would even be better if it would be like: /rum_distiller/new_york/matusalem

  12. Charleston Software Associates
    Member
    Plugin Author

    Posted 1 year ago #

    @fort123 - Store pages is paid, just not a separate .zip file that needs to be purchased, downloaded, & installed. Previously you only needed to enter a license key, however the license system is much harder to manage. As "just one guy" the buy & download a zip is much easier to maintain.

    The town won't be in the initial Store Pages 3.9 release. Maybe in a later release but I don't want to over-complicate the permalink system at this point. Get the simpler version out and make sure it works first.

    The "auto rebuild" will come later as well. For now if you change store data you will need to rebuild the store page by hand. HOWEVER, that said.... the way it works will be different. I'm adding "page templates" this weekend for Store Pages.

    Follow my blog (or Facebook) for the daily dev updates... I've now started using my blog for that and it pushes the "daily update" to FB, Twitter, and Linked In.
    http://www.charlestonsw.com/news-and-info/

  13. Charleston Software Associates
    Member
    Plugin Author

    Posted 1 year ago #

    @don -

    I think this new SLP 3.9 "slp_addlocation_fieldvalue" filter will do the "pre-load the add location fields" trick you are looking for.

    I've added no less than a dozen new action hooks & filters to help with location management. It has made it a lot easier to do some more advanced location interaction for things like the upcoming Store Pages overhaul I've been working on. That will launch right after the SLP 3.9 launch.

    I'm almost ready for a first round of beta testing. I'll send it out to the Beta Tester list. If anyone else wants to play with SLP 3.9 send me a note.

  14. Charleston Software Associates
    Member
    Plugin Author

    Posted 1 year ago #

    @fort123 - Check out the new "Page Template" setting coming in Store Pages v3.9.

    The default page template for Store Pages will use the new "storepage field..." shortcode. That makes those page elements "live". Edit the location data & it is reflected the next time a user loads/views the store page. No need to re-create pages that use this new shortcode. Old style legacy pages with fixed content will need to be rebuilt though.

    http://www.charlestonsw.com/support/documentation/store-locator-plus/pao-store-pages/

  15. don benjamin
    Member
    Posted 1 year ago #

    Great, that looks spot on. I will update my plugin and let you know once I've got it all packaged up.

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.