eggwane Posted April 29, 2019 Share Posted April 29, 2019 Hello, I'm trying to build a function which returns a string with products' url for a specific Manufacturer. Here is my code in ManufacturerController.php : static public function getProductsImgToDisplay($id_manufacturer){ global $cookie; $sql ="select id_product from "._DB_PREFIX_."product where id_manufacturer=".$id_manufacturer.";"; $sql_output = Db::getInstance()->ExecuteS($sql); $output = ""; foreach ($sql_output as $row){ $id_product = $row["id_product"]; $product = new Product(id_product, false, $cookie->id_lang); //$img = $product->getCover($product->id); //$img_url =$this->context->link->getImageLink($product->link_rewrite, (int)$img['id_image'], 'small_default'); $output .= $id_product."-"; $output .= $product->id."\n"; } return $sql."->".$output."|"; } Here I'm just testing if the variable $product is well defined but it seems to not work because I have this output for example : select id_product from ps_product where id_manufacturer=890;->4707- 4708- 4717- 4718- 5311- 5312- 5483- 5503- | The sql resquest worked and the ids are good but it seems that the constructor Product doesnt build correctly the $product variable? Thanks for your help :) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now