Author Topic: Display this request's results in a new block  (Read 1418 times)

Offline mistertom

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Display this request's results in a new block
« 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

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4282
  • Karma: +283/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Display this request's results in a new block
« Reply #1 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
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline mistertom

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Display this request's results in a new block
« Reply #2 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

 

Powered by SMFPacks Social Login Mod