Jump to content

display prices on favorite products


Recommended Posts

Hello everyone

 

Does anyone know how to display prices on favorite products by adapting this request, I'm a little bit lost about how to get prices in database

 

public static function getFavoriteProducts($id_customer, $id_lang)

{

return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('

SELECT DISTINCT p.*, fp.`id_shop`, pl.`description_short`, pl.`link_rewrite`,

pl.`name`, i.`id_image`, CONCAT(p.`id_product`, \'-\', i.`id_image`) as image

FROM `'._DB_PREFIX_.'favorite_product` fp

LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = fp.`id_product`)

'.Shop::addSqlAssociation('product', 'p').'

LEFT JOIN `'._DB_PREFIX_.'product_lang` pl

ON p.`id_product` = pl.`id_product`

AND pl.`id_lang` = '.(int)$id_lang

.Shop::addSqlRestrictionOnLang('pl').'

LEFT OUTER JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.`id_product` = pa.`id_product`)

'.Shop::addSqlAssociation('product_attribute', 'pa', false).'

LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)

LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')

WHERE product_shop.`active` = 1

'.($id_customer ? ' AND fp.id_customer = '.(int)$id_customer : '').'

'.Shop::addSqlRestriction(false, 'fp')

);

}

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