Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

CSCart 3.0 — Addon / Block Rate Topic   - - - - -

 
  • ninthvector
  • Junior Member
  • Members
  • Join Date: 13-Jun 07
  • 17 posts

Posted 21 August 2012 - 05:18 PM #1

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
if ( !defined('AREA') ) { die('Access denied'); }
$schema['my_addon'] = array (
'content' => array(
  'my_addon_opts' => array(
   'type' => 'function',
   'function' => array('fn_get_my_addon_options')
  ),
),
'templates' => array(
  'addons/my_addon/blocks/my_addon.tpl' => array(),
),
'wrappers' => 'blocks/wrappers',
);

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.

Thank you!

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11358 posts

Posted 21 August 2012 - 06:33 PM #2

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:
<!--- my_addon.tpl-->
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.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • ninthvector
  • Junior Member
  • Members
  • Join Date: 13-Jun 07
  • 17 posts

Posted 21 August 2012 - 09:47 PM #3

Thanks, tbirnseth.

I had <p>some stuff</p> 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.

 
  • ninthvector
  • Junior Member
  • Members
  • Join Date: 13-Jun 07
  • 17 posts

Posted 29 August 2012 - 12:50 AM #4

tbirnseth, do you know how to get a default .php controller for my block/addon? Does it need to be configured in the blocks.post.php? If so, how?

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.

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11358 posts

Posted 29 August 2012 - 05:23 AM #5

In V2 you don't need it to be in the blocks.post.php file. In V3, you do.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • abugasiem
  • Newbie
  • Trial users
  • Join Date: 23-Mar 17
  • 6 posts

Posted 10 April 2017 - 09:49 AM #6

Thank you all it's working, finally I can create custom blocks and assign a module.



 
  • ezshop
  • Newbie
  • Trial users
  • Join Date: 15-Jun 17
  • 1 posts

Posted 15 June 2017 - 12:57 PM #7

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 :) 



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11358 posts

Posted 21 June 2017 - 12:21 AM #8

Make sure you're selecting the All Available Addons tab on tthe addons.manage page.

If not there, then you'll have to post more details about the location and content of you addon.xml file.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19685 posts

Posted 21 June 2017 - 05:54 AM #9

Please find more information about addons here

 

http://docs.cs-cart....dons/index.html


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.