Where Are The Controllers For The Block Templates?

When going to Design -> Layouts and selecting to see a block options I can select one of the templates for the block.

I created a new template for products.

By placing it under themes/responsive/templates/blocks/products I managed to make it appear as a selectable template.

Then by adding an entry to the app/schemas/block_manager/templates.php I can edit the "settings" shown for my template.

But I can't seem to find where to put the controller for this template. Since my template is a clone of the "products_scroller.tpl" it is showing some of the elements, but the images are missing so I am assuming that the required data is not being passed to it.

When going to Design -> Layouts and selecting to see a block options I can select one of the templates for the block.

I created a new template for products.

By placing it under themes/responsive/templates/blocks/products I managed to make it appear as a selectable template.

Then by adding an entry to the app/schemas/block_manager/templates.php I can edit the "settings" shown for my template.

But I can't seem to find where to put the controller for this template. Since my template is a clone of the "products_scroller.tpl" it is showing some of the elements, but the images are missing so I am assuming that the required data is not being passed to it.

Hello Oscar,

For creating template you should complete next steps.

1. Create new addon.
2. In this addon create file app/addons/name_addon/schemas/block_manager/block.post.php

$schema['your_block'] = array (
        'content' => array (
            'items' => array (
                'type' => 'enum',
                'object' => 'products',
                'items_function' => 'fn_get_products',
                'remove_indent' => true,
                'hide_label' => true,
                'fillings' => array (
                    'manually' => array (
                        'picker' => 'pickers/products/picker.tpl',
                        'picker_params' => array (
                            'type' => 'links',
                        ),
                    ),
                    'newest' => array (
                        'params' => array (
                            'sort_by' => 'timestamp',
                            'sort_order' => 'desc',
                            'request' => array (
                                'cid' => '%CATEGORY_ID%'
                            )
                        )
                    ),
                    'recent_products' => array (
                        'params' => array (
                            'apply_limit' => true,
                            'session' => array (
                                'pid' => '%RECENTLY_VIEWED_PRODUCTS%'
                            ),
                            'request' => array (
                                'exclude_pid' => '%PRODUCT_ID%'
                            ),
                            'force_get_by_ids' => true,
                        ),
                    ),
                    'most_popular' => array (
                        'params' => array (
                            'popularity_from' => 1,
                            'sort_by' => 'popularity',
                            'sort_order' => 'desc',
                            'request' => array (
                                'cid' => '%CATEGORY_ID'
                            )
                        ),
                    ),
                ),
            ),
        ),
    'templates' => array (
        'addons/name_addon/blocks/products_block.tpl' => array(),
    ),
    'wrappers' => 'blocks/wrappers',
    'cache' => array(
        'update_handlers' => array(
            'banners', 'banner_descriptions', 'banner_images'
        )
    )
);

return $schema;

3. Create file here design/name_your_theme/templates/addons/name_addon/blocks/products_block.tpl

4. Activate this addon.

It should be work. Or you can give us temporary ftp access and we will check this problem.

Best regards, Alt-team.

In the templates.php just add bulk_modifier parameter for block items after settings:

        'bulk_modifier' => array (
            'fn_gather_additional_products_data' => array (
                'products' => '#this',
                'params' => array (
                    'get_icon' => true,
                    'get_detailed' => true,
                    'get_options' => true,
                ),
            ),
        ),

This code will get additional information (images) about products from the database