Jump to content

 

rejoicealways

Member Since 09 Oct 2021
Offline Last Active Feb 01 2022 03:01 PM
-----

Topics I've Started

How To Implement Simple Custom Block

31 January 2022 - 02:41 PM

I am using version 4.14 Multivendor

I am attempting to develop a simple custom block so that I can add it to a Layout.  However, I am having difficulty seeing the Block as an option when I go to

Design -> Layouts > choose a layout page -> Choose any Grid to add the block to -> Create New Block

I don't see the block I have developed show up as an optoin.

 

Here is what I have done to try to get it to work.

1) Add an addon

Under app/addons/cl_vendor_askaquestion/addon.xml

I added the following

 

<?xml version="1.0"?>
<addon scheme='3.0'>
<id>cl_vendor_askaquestion</id>
<version>1.0</version>
<priority>100500</priority>
<default_language>en</default_language>
</addon>
 
Then under app/addons/cl_vendor_askaquestion/schemas/block_manager
I added the file
blocks.post.php
With the contents of this file, I was attempting to create the most simple block with template definition.
 
$schema['cl_vendor_askaquestion'] = array (
            'templates' => array(
                            'addons/cl_vendor_askaquestion/cl_block_vendor_askaquestion.tpl' => array(),
                                ),
                'wrappers' => 'blocks/wrappers',
);
 
return $schema;
 
Then under design/themes/responsive/templates/addons/cl_vendor_askaquestion/cl_block_vendor_askaquestion.tpl
The contents of this file is 
{** block-description:cl_block_vendor_askaquestion **}
 
<div>
Test block cl askaquestion
</div>

 

I have also added a .po file for the add-on so that the block would have a name.  Here are the contents of it

 

msgid ""                                                   
msgstr "Project-Id-Version: tygh\n"                        
"Content-Type: text/plain; charset=UTF-8\n"                
"Language-Team: English\n"                                 
"Language: en_US"                                          
                                                           
msgctxt "Addons::name::cl_vendor_askaquestion"             
msgid "CL Vendor Ask A Question Addon"                     
msgstr "CL Vendor Ask A Question Addon"                    
                                                           
msgctxt "Addons::description::cl_vendor_askaquestion"      
msgid "Adds the Ask a Question to Vendor separately"       
msgstr "Adds the Ask a Question to Vendor separately Test" 
                                                           
msgctxt "Languages::block_cl_block_vendor_askaquestion"    
msgid "CL Vendor Ask"                                      
msgstr "CL Vendor Ask"                                     
                                                           
msgctxt "Languages::cl_block_vendor_askaquestion"          
msgid "CL Vendor Ask A Question"                           
msgstr "CL Vendor Ask A Question"                          

 

 

To test this, 

I INSTALL my Add-On and ACTIVATE it.

 

I am browsing to Design -> Layouts > choose a layout page -> Choose any Grid to add the block to -> Create New Block.  I do not see my block

 

I am using a child theme of responsive, but I tried moving the code to it and it still did not work.

 

 

I have cleared the cache both before and after installation.

I have made certain that the file permissions are correct for the files to be read on the server.

 

How might I know if it is even reading the .tpl file or the block definition?  It doesn't seem that it is because the .tpl file doesn't exist in the  cache.

 

Thank you in advance for your help.