14 minutes ago, endriu107 said:In your code I don't see code I post before, and this code you share is incomplete, I didn't have time to guess what you have or haven't. I think you should look at the ps_featuredproducts modules.
Good luck
Here is the full code of controller called by the Request data button:
<?php class probaFcont2ModuleFrontController extends ModuleFrontController { public function __construct() { parent::__construct(); } public function initContent() { $this->ajax = true; parent::initContent(); } public function displayAjax() { $valtozo = Tools::getValue('method'); $hossztxt = Tools::getValue('hossz'); $hossz = (float)$hossztxt; $hossz = $hossz*2; $this->context->smarty->assign(array( 'ujhossz' => $hossz) ); $link = new Link;//because getImageLInk is not static function $feszultseg=12; $multi=array('0' => array('reference'=>'name1', 'power'=>12, 'link'=>'link12')); $multi2=array('0' => array('reference'=>'name1', 'power'=>12, 'link'=>'link12')); unset($multi['0']); unset($multi2['0']); function cmp($a, $b) { if($a['power'] == $b['power']) { return 0; } return ($a['power'] < $b['power']) ? -1 : 1; } $productId="47"; $lang_id = (int) Configuration::get('PS_LANG_DEFAULT'); $product = new Product($productId, $lang_id); // get product object with id $name = $product->id_category_default; //var_dump($productData); //$Product::getProductsProperties((int)$id_lang, $result); //$categories = $productData->getCategories(); //var_dump($categories); $product_features = $product->getfeatures(); $prfeatures = $product->getFrontFeatures($this->context->language->id); $nev="meg nem tudom"; $szamlalo1=0; $szamlalo2=0; $szamlalo3=0; //var_dump($prfeatures); //ITT MOST A GPV POWER TAPOKAT GYUJTOM LE ES KIIRATOM A NEVUKET $id_category=48; $category = new Category($id_category); $productok = $category->getProducts($lang_id, 0, 1000, 'id_product', 'asc'); $products = Product::getProductsProperties($this->context->language->id,$productok); $product= $products[0]; //valojaban ezt kapom a getProducts al $szamiszami=0; //szamlalo a multi2 masolathoz ami valojaban a productok roviditett valtozata $kakukk=0; foreach ($productok as $termek) { if((int)trim($termek[features][1][value],"V")==$feszultseg) { $szam=(int)trim(trim($termek[features][3][value],"W/m"),"W"); if($szam > 75) { $kakukk++; $productData = new Product($termek["id_product"], false, $lang_id); // get product object with id $cover = Product::getCover($productData->id); $kepPath = $link->getImageLink($productData->link_rewrite, $image['id_image'], 't'); $multi[$productData->id]=array( 'name'=>$productData->name, 'reference'=>$productData->reference, 'netprice'=>$productData->price, 'price'=>$termek['price'], 'price_no_tax'=>$termek['price_tax_exc'], 'power'=>$szam, 'link'=>$productData->link_rewrite, 'quantity'=>Product::getQuantity($productData->id, 0), 'cover' =>$cover, 'imgPath'=>$kepPath, 'power2'=>$termek[features][3][value] ); $multi2[$szamiszami]=$termek; $szamiszami++; } } //$azonosito=$termek["id_product"]; $productData = new Product($termek["id_product"], false, $lang_id); // get product object with id $prfeatures = $productData->getFrontFeatures($this->context->language->id); //$product_price = $productData->getPrice(Product::$_taxCalculationMethod == PS_TAX_INC); } //tomb sorbarakasa es kiiratasa ************start uasort($multi,cmp); //tomb sorbarakasa es kiiratasa *************vege $this->context->smarty->assign( array( 'sajatmulti'=>$multi, 'test1'=> $szamlalo1, 'test2'=> $szamlalo2, 'test3'=> $szamlalo3, 'masolat'=>$multi2, 'kakukk'=>$kakukk, 'product'=>$product )); //this is a copy of themes/default/product-list.tpl //$this->setTemplate("catalog/_partials/listing/product-list.tpl"); //die(Tools::jsonEncode(array('result' => $valtozo))); die($this->context->smarty->fetch(_PS_MODULE_DIR_.'proba/views/templates/front/ajax.tpl')); } } ?>
I checked the ps_featuredproducts modules , but could not figure out how that could help.
My template does not get the full data and I do not know how to produce that.
My code contains a lot of experiments, this is why I did not put the entire before.
I am looking for how to give to the template the full product data which includes all of the data needed for the templates.
.png.022b5452a8f28f552bc9430097a16da2.png)