Jump to content

How to assign list of product to tpl file


Recommended Posts

i have created a custom list of product, then i created  $products_for_template like this

$products = $ids;


        $assembler = new ProductAssembler($this->context);


        $presenterFactory = new ProductPresenterFactory($this->context);

        $presentationSettings = $presenterFactory->getPresentationSettings();

        $presenter = new ProductListingPresenter(

            new ImageRetriever(




            new PriceFormatter(),

            new ProductColorsRetriever(),




        $products_for_template = [];


        foreach ($products as $rawProduct) {

            $products_for_template[] = $presenter->present(






        return $products_for_template;


the problem is when i try to assign this list to the .tpl file it  stop like this 

$content = $this->display(__FILE__,'views/templates/hook/myfile.tpl');

and no error appears it just stop . any Help ?



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More