Jump to content

Plug-ins solutions for templates?


Recommended Posts

I am coming up to speed on the runtime solution for CC.6.

I have read the “literature” for developers regarding extensions and plug-ins, installed the example and visitor stats demos and it all makes sense.  Snippets are nice.

But... (you were waiting for that...) is there a solution for templates that mirrors the hooks for PHP?

Is manual intervention  the only solution?

Thanks, as always, for your help.


Edited by ploughguy
Link to comment
Share on other sites

"Hooks" for the templates?

Aside from the concept that the skins are meant to stand alone, that is, assign data to Smarty variables, then let the skin template code do what it will with that data, means that, currently, you are required to copy a skin template, rename it, and customize it to handle the custom data you gave to it.

That also means you will need to become familiar with any new capabilities that a newer version of CubeCart provides to the skin. For example, CubeCart can now accept an AJAX request for product prices based on the product's options chosen. But it is not critical that any skin implement this, and CubeCart does not force it onto the page that is sent out to the client.

Smarty can use (almost) any PHP function, and can be given access to Classes instantiated by the application. For example, access to the Database class is permissable. (Consult the Smarty docs.)

Please give us a use case for where "hooks" in a skin template file would be necessary, where simply assigning data to a Smarty variable in a CubeCart hook will not work.

Link to comment
Share on other sites

I am thinking about the case where I want to add some functionality to the PHP application (at a hook) that adds fields to a page.

The benefit of the PHP hook is that I can extend the business logic without having to reapply my changes when there is an update.  A similar feature in the templates would allow template updates with similar benefits.  Or are templates never updated?

Edited by ploughguy
Link to comment
Share on other sites

Of the templates, Foundation is the only template included with the CC6 series and is the only template supported by CubeCart Ltd.

CC5 has five or six templates included, but none are actively maintained - neither is the CC5 core code.

A skin written forCC5 can be used by CC6, and Foundation can be used with CC5 (although some of the cool features won't work).

Third-party skins are the responsibility of the third-parties. Some of them do get updated.

There is a technique I have used that allows for something along the lines of what you seem to be describing.

The skins have template variables that can be assigned javascript code. The javascript can add whatever, wherever, knowing the id's of target DOM nodes.

I have added div panels to Kurouto using this technique (similar in appearance and function as the admin screens).

Link to comment
Share on other sites

Seems to me that for ongoing ease of maintenance, a formal solution for template enhancement is required.

Since template developers are able to use any tools they like, it is may not be feasible to develop a universal solution.  

Guiding template developers by establishing template plug-ins as a desirable best practice for template designs, with a catalog of agreed appropriate hook points, seems to me to be an appropriate design goal for the future. Otherwise, the template developers are producing a static component that will pretty definitely be hacked by the store owners, resulting in a maintenance headache whenever a template update is released.

Hooks are great, but without corresponding exits in the templates, the job seems to be only half done.

Is this something that would be useful, or am I blowin' smoke?

Link to comment
Share on other sites

This is something useful. If I read you right, then the Fusion-powered skins (e.g., Blueprint), and other plugin-powered skins (SFWS Custom) seems to provide a germ of a path to skin templates having hooks. These skin plugin control panels basically just allow for show/hide/place boxes and color palettes.

Should the plugin controller be customizable (not encoded/obfuscated), I think the affiliated skins can be loaded with a hook after every written line of HTML (if you want to go that far).

"...the template developers are producing a static component that will pretty definitely be hacked by the store owners."

You say this like it's a bad thing <grin>. Of course, hopefully, unskilled users of the skin can get help from professionals - just like getting help with bookkeeping, tax preparation, marketing, etc.

Link to comment
Share on other sites

Well you may grin, you whiskered exploiter of the wretched and downtrodden...

I am about to put in a lot of time to commit to the platform. All of us need a growing user base that sustains the core open source development and feeds the ravenous hordelet of plug-in artisans and support suppliers such as your beardy, mysterious and contemplative self.

To achieve this, we need a platform that has a reputation for ease of maintenance and a rich catalog of reasonably price options.  We need both of these.  Otherwise Shopify starts to look like the least-risk proposition. 

So, having agreed that it is a good thing, how do we make it happen?

Edited by ploughguy
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...