Skip to main content

How to load product options?

More
10 years 10 months ago - 10 years 10 months ago #221867 by remotelyyours
-- url of the page with the problem -- : albertatacticalrifle.com
-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.5
-- PHP version -- : 5.6.10

How can I load a product options like I load a product?
Code:
$productClass = hikashop_get('class.product'); $product=$productClass->get($product_id);

I want to get the options in the order they are added to the product.

UPDATE.
Is seems there is not a special function anywhere.
I found the code in the HS code and used it
Code:
$db = JFactory::getDBO(); $query = 'SELECT a.*,b.* FROM '.hikashop_table('product_related').' AS a LEFT JOIN '.hikashop_table('product').' AS b ON a.product_related_id=b.product_id WHERE a.product_related_type=\'options\' AND a.product_id = '.(int)$product_id.' ORDER BY a.product_related_ordering'; $db->setQuery($query); $correct_options = $db->loadObjectList();

So my question is closed.
Last edit: 10 years 10 months ago by remotelyyours.

Please Log in or Create an account to join the conversation.

More
10 years 10 months ago - 10 years 10 months ago #221873 by nicolas
Hi,

That's right, there is no function to do that (yet).
You'll have to run a MySQL query on the hikashop_product_related and hikashop_product tables in order to get the data of the options of the product.
Last edit: 10 years 10 months ago by Jerome.

Please Log in or Create an account to join the conversation.

Time to create page: 0.180 seconds
Powered by Kunena Forum