Jump to content

Edit History

ruisonika

ruisonika

hello guys,
does anybody knows how can i add a manufacturer name in my custom tpl file, i've developed a module and this is my controller
 

<?php
Class pesquisaequipamentoAllproductsModuleFrontController extends ModuleFrontController
{
    public function init()
    {
        $this->page_name = 'allproducts'; // page_name and body id
        $this->display_column_left = true;
        $this->display_column_right = false;
        parent::init();
    } 
    
    public function setMedia()
    {
        parent::setMedia();
        //$this->addCSS(__PS_BASE_URI__.'modules/'.$this->module->name.'/css/'.$this->module->name.'.css');
        $this->addCSS(__PS_BASE_URI__.'modules/'.$this->module->name.'/js/pesquisaconsumiveis--.js');
        //$this->addCSS(__PS_BASE_URI__.'modules/'.$this->module->name.'/css/datatable.css');
         
    } 
    
    public function initContent()
    {
        parent::initContent();
     
        $products_count = $this->module->countAllProducts();
        $this->pagination($products_count); // needs to be here, so that page number and products per page are assigned to "p" and "n"
        $var = $this->module->searchAllProducts();
        //$products_partial = Product::getProducts($this->context->language->id, ((int)$this->p - 1) * (int)$this->n, $this->n, 'name', 'asc');
        $products = Product::getProductsProperties($this->context->language->id, $var);
        
        
        foreach ($products as $key => $product) {
            foreach ($products as $key => $product) {
                $products[$key]['id_image'] = Product::getCover($product['id_product'])['id_image'];
            }
        }
        
        $this->context->smarty->assign(array(
            'products' => $products,
            'homeSize' => Image::getSize('home_default')
            
        ));
        $this->setTemplate('allproducts.tpl');
    }   
}

In my tpl file i only get id_manufacturer

ruisonika

ruisonika

hello guys,
does anybody knows how can i add a manufacturer name in my custom tpl file, i've developed a module and this is my controller
 

<?php
Class pesquisaequipamentoAllproductsModuleFrontController extends ModuleFrontController
{
    public function init()
    {
        $this->page_name = 'allproducts'; // page_name and body id
        $this->display_column_left = true;
        $this->display_column_right = false;
        parent::init();
    } 
    
    public function setMedia()
    {
        parent::setMedia();
        //$this->addCSS(__PS_BASE_URI__.'modules/'.$this->module->name.'/css/'.$this->module->name.'.css');
        $this->addCSS(__PS_BASE_URI__.'modules/'.$this->module->name.'/js/pesquisaconsumiveis--.js');
        //$this->addCSS(__PS_BASE_URI__.'modules/'.$this->module->name.'/css/datatable.css');
         
    } 
    
    public function initContent()
    {
        parent::initContent();
     
        $products_count = $this->module->countAllProducts();
        $this->pagination($products_count); // needs to be here, so that page number and products per page are assigned to "p" and "n"
        $var = $this->module->searchAllProducts();
        //$products_partial = Product::getProducts($this->context->language->id, ((int)$this->p - 1) * (int)$this->n, $this->n, 'name', 'asc');
        $products = Product::getProductsProperties($this->context->language->id, $var);
        
        
        foreach ($products as $key => $product) {
            foreach ($products as $key => $product) {
                $products[$key]['id_image'] = Product::getCover($product['id_product'])['id_image'];
            }
        }
        
        $this->context->smarty->assign(array(
            'products' => $products,
            'homeSize' => Image::getSize('home_default')
            
        ));
        $this->setTemplate('allproducts.tpl');
    }   
}

In my tpl file i only get id_manufacturer

×
×
  • Create New...