Jump to content

prestashop search array and query


Recommended Posts

okay i have a question. i would like to know where the array for the search is. i am trying to have it pull a number from another table and i cant find the array or the query for the search , im trying to get it to pull a part number along side the product that they searched for 

Link to comment
Share on other sites

okay so i have edited it and i would like to know how do i get the part number out of it now ? here is my code 

$sql = 'SELECT *
				FROM `'._DB_PREFIX_.'category_group` cg
				INNER JOIN `'._DB_PREFIX_.'category_product` cp ON cp.`id_category` = cg.`id_category`
				INNER JOIN `'._DB_PREFIX_.'category` c ON cp.`id_category` = c.`id_category`
				INNER JOIN `'._DB_PREFIX_.'product` p ON cp.`id_product` = p.`id_product`
				INNER JOIN `'._DB_PREFIX_.'product_part_number` ON p. `id_product` = `ID`
				'.Shop::addSqlAssociation('product', 'p', false).'
				WHERE c.`active` = 1
					AND product_shop.`active` = 1
					AND product_shop.`visibility` IN ("both", "search")
					AND product_shop.indexed = 1
					AND cg.`id_group` '.(!$id_customer ?  '= 1' : 'IN (
						SELECT id_group FROM '._DB_PREFIX_.'customer_group 
						WHERE id_customer = '.(int)$id_customer.'


do i need to echo it ? or add it to the array?

Link to comment
Share on other sites

This query is a part of the find function. what i did what i added a line of code to the query which is this line of code

INNER JOIN `'._DB_PREFIX_.'product_part_number` ON p. `id_product` = `ID`

Im not sure if that is even correct but it does work . what i am trying to ask and now i see i wasnt very clear is what do i add to the code so when the product shows it also shows the part number which is in the "product_part_number" table? i dont know how to get it to display that part number ? do i need to add some code to the product-list.tpl file ? 

Link to comment
Share on other sites

I was able to track the issue down further and the results array is getting the data from `'._DB_PREFIX_.'product_part_number` in the query, what I need now is to be able to put the results in the product-list.tpl either by assigning the values to a smarty variable (which I do not know how to do), or by outputting it with some other method but nothing seems to be working.


More specifically, I am able to output the data I'm looking for with "echo $row['GREKA'];" within the Search.php but I want to be able display this value through the tpl within the foreach loop for that ID.

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...