News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Multiple condition WHERE clause for products?

Started by mailblade, September 20, 2017, 09:16:37 AM

Previous topic - Next topic

mailblade

SOLVED
Other thread which has the correct answer: https://forum.virtuemart.net/index.php?topic=138437.0

Hello.

Is there any way to have a Query display a result based on the value of the $product_id and a specific $customfield_id?

Example code, which is definitely wrong I assume:
$db = JFactory::getDBO();
     $db->setQuery("SELECT customfield_value FROM jos_virtuemart_product_customfields WHERE virtuemart_customfields_id="5" AND WHERE virtuemart_product_id=".$product->virtuemart_product_id.";");
     $db->query();
     $result = $db->loadResult();
echo ($result)


So this query needs to display the result where "virtuemart_customfield_id" = 5 AND where the "product_id" = the associated product.

Thanks for reading.

Milbo

There is a full function for that. check the view.html.php of the productdetails view.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

mailblade


mailblade

#3
Just a heads up: This same issue has been solved on another thread which I created :)

https://forum.virtuemart.net/index.php?topic=138437.0

Solved