AbanteCart Community

Shopping Cart Operations => Support => Template Support => Topic started by: mistertom on May 28, 2018, 11:24:25 AM

Title: Display this request's results in a new block
Post by: mistertom on May 28, 2018, 11:24:25 AM
Hello !

I would like to display the results from this request in a new block (on the footer for example):
" SELECT DISTINCT tag FROM `vvvvvv_product_tags` where language_id = 2 order by tag ASC "

Do you know how i can do that ?

Best regards,

Christophe
Title: Re: Display this request's results in a new block
Post by: abantecart on May 28, 2018, 07:37:02 PM
Hi Christophe,

You need to create a controller and template for the block. If you like to have a model, you can create that as well, or you can have your query done in the controller.

Register your controller with the blocks tables.

You can use developer tools extension to help you with adding a block.

https://abantecart.atlassian.net/wiki/spaces/DOC/pages/17957120/Templates+Overview

See blocks section
https://abantecart.atlassian.net/wiki/spaces/DOC/pages/17957130/Template+development+guide
Title: Re: Display this request's results in a new block
Post by: mistertom on May 29, 2018, 09:24:59 AM
Hello !

Thanks for your reply.

So, i started to create a simple echo 'hello world' to test the display in a block.
I would like to add it on the footer top.

I created 2 files, one for the controller (tags.php), then a tpl file (tags.tpl).
Then, i went to the database and added a new entry on the blocks's table
(block_txt_id => tags ; controller => blocks/tags) >> block_id => 32

After that, i added a new entry on block_template's table
(block_id => 32 ; parent_block_id => 7)


Then, i went to the admin to add this block on the default page layout
This new block is not available on the footer top's list
but he's well listed on the blocks listing.

I think that i skipped something but i don't know what...

Thanks for your help.

All the best,

Christophe