Jump to content

Multiples Manufacturers


Recommended Posts

Hi,

 

I need, through the database, to have several "manufacturers" as well as categories for a product.

 

So I created a table containing two fields, ps_product_manufacturer : id_product id_manufacturer and I filled it.

 

In file classes / product.php, I added:

 

public function getProductManufacturers($id_product)
{
$sql = '
	SELECT m.`id_manufacturer`, m.`name`
	FROM '._DB_PREFIX_.'manufacturer m
	LEFT JOIN '._DB_PREFIX_.'product_manufacturer pm ON (pm.id_manufacturer = m.id_manufacturer)
	WHERE pm.`id_product`='p.id_product;

	$result = Db::getInstance()->ExecuteS($sql);

	if ($result) {
		foreach ($result as $row) {
			$row['auteur'] = $auteur['id_manufacturer'];
			$auteurs[] = $row;
		}
		return $auteurs;
	}
}

 

Smarty does create a variable "authors", but empty -> authors = null

 

I zapped it?

Edited by LeGhe (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...