How to load product options?

  • Posts: 28
  • Thank you received: 3
9 years 19 hours ago #221867

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

				$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
				$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: 9 years 17 hours ago by remotelyyours.

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
9 years 8 hours ago #221873

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: 9 years 8 hours ago by Jerome.

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

Time to create page: 0.057 seconds
Powered by Kunena Forum