Jump to content

How to assign list of product to tpl file


ZiedDams

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(

                $this->context->link

            ),

            $this->context->link,

            new PriceFormatter(),

            new ProductColorsRetriever(),

            $this->context->getTranslator()

        );

 

        $products_for_template = [];

 

        foreach ($products as $rawProduct) {

            $products_for_template[] = $presenter->present(

                $presentationSettings,

                $assembler->assembleProduct($rawProduct),

                $this->context->language

            );

        }

        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 ?

 

 

Link to comment
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...