NiteFox Posted February 5, 2021 Share Posted February 5, 2021 Afternoon, While diving into the world of plugins, i was just wondering if there is a hook/function or method for plugins to use "pretty" urls on the customer facing side when loading a plugin created page So instead of "?_a=plugin&plugin=plugin_name" it'd be "plugin/plugin_name" or just "plugin_name" getting added to the store URL Cheers, Chris. Quote Link to comment Share on other sites More sharing options...
bsmither Posted February 5, 2021 Share Posted February 5, 2021 Interesting. The 'friendly' URL would have to pass through the web server's rewrite feature to get: index.php?seo_path=plugin_name Then, there must be that 'path' in the CubeCart_seo_urls database table. The query must return a 'type' of thing to go looking for. And if there is more than one of that type, the query must return an integer that identifies which one of that type to find. CubeCart already knows how to process _a=plugin. So, one issue is getting the plugin to insert a record in CubeCart_seo_urls. As with a product, the friendly path is associated with an item_id value. The question remaining is, how to differentiate which plugin. Quote Link to comment Share on other sites More sharing options...
NiteFox Posted February 5, 2021 Author Share Posted February 5, 2021 Yeah I saw the type and id stuff when I was going through the seo class so figured it's more suited to deal with products rather than plugins. I might note it on github unless @Al Brookbanks has any insight into an existing way to accomplish it. Quote Link to comment Share on other sites More sharing options...
bsmither Posted February 5, 2021 Share Posted February 5, 2021 If the plugin has an ID number. For example, this: https://www.cubecart.com/extensions/plugins/absolute-matrix-option-prices-price-list-hide-out-of-stock-matrix-options has a Ref:173/271, which means: Merchant #173, Product #271. The plugin, when it uses the "class.cubecart.display_content" hook, first checks if it is the matching "item_id" from the database query. So, I think it's entirely do-able, but the plugin needs to be coded to check for its name or item_id before running. Quote Link to comment Share on other sites More sharing options...
NiteFox Posted February 5, 2021 Author Share Posted February 5, 2021 Hmmm I'll have a play over the weekend. I used to think the lack of cubecart documentation as a downfall but on a positive note it gets you used to tracing stuff and seeing how it functions. Quote Link to comment Share on other sites More sharing options...
bsmither Posted February 5, 2021 Share Posted February 5, 2021 I just realized... After solving a problem for someone else with SemperFi's "GuestBook" plugin, making a 'friendly' URL for plugins is very possible. 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.