I'm trying to create a custom addon that I can install and then implement as a 'Block'. I'd like to be able to add this block to various locations via the block manager. The other thing I need is for this block to be associated with a controller where I can perform various logic and connections to a DB.
I've been trying to create my own addon using one of the pre existing addons as a model. I've picked apart files like init.php, func.php, and the files in the schemas folder. I also have a my_addon.tpl in place in the skins/basic/customer/addons/my_addon/blocks/my_addon.tpl.
This is what I have in my schemas file: blocks.post.php
The addon installs fine, and then when I create a new block to put in a location via the blocks manager my block shows up as an option. I create it and specify the template. It's listed as _my_addon.tpl.
However, my problem is that nothing shows up in my store. It doesn't appear that the my_addon.tpl is being shown or working properly.
I'm really lost at the moment and if anyone could shed some light on this I'd really appreciate it. Maybe someone has a bare bones addon with only the files and content needed to install and render the block in the store, and that is connected to a php controller file.
What is in that location within the page where the block you created has been applied?
Suggest you add a comment to your block of:
So you can search the page source for 'my_addon.tpl'. This will tell you that the block is loading.
Alternatively you can simply add a {debug} at the top of your my_addon.tpl file which should pop-up the debugger (variable listing, not really a debugger).
If you're seeing the block in the block manager and creating the block and then adding that resulting block to a location, it should all be there. But not knowing anything about the content of my_addon.tpl, can't really say.
in the .tpl. And I added the addon block to various locations like default, homepage, etc.
I duplicated another addon and got it working, and am now trying to whittle it down to only what I need. I'm still confused as to why this latest go has worked and my original addon doesn't work.
Thanks for the {debug} tip I'll be sure to use that to help me track things down.
I'll continue to update here as I figure things out.
[color=#282828][font=arial, verdana, tahoma, sans-serif] tbirnseth, do you know how to get a default .php controller for my block/addon? Does it need to be configured in the [/font][/color][color=#282828][font=arial, verdana, tahoma, sans-serif]blocks.post.php? If so, how?[/font][/color]
[color=#282828][font=arial, verdana, tahoma, sans-serif]I understand the concept of dispatch controller.mode but I don't see how that applies to a block, because a block can exist on any location/'page'. But I still need a controller for my block. [/font][/color]
Hi! Help me please. Can't found info about how to create addon on cs-cart 4.3.9. I create folder for addon, xml and write similar names, but module doesn't appear in module list in administrators panel. Or give me the link, where I can learn about it, if I do something wrong.
Sorry for bad english, please. I'm trying to learn :)
I’m also struggling to figure out how to add a custom addon block which will be available to a layout. The link ecomlabs posted omits this, unfortunately, and I can’t find it anywhere else in the current documentation. It’s strange to me that it would be left out. Does anybody have a link to a complete guide to how to do this? Or is there any hope it will be added to the documentation?
Big CS-Cart Update is Here
Experience the New Admin Panel with Dark Theme