Retrieve if a product has related or options

  • Posts: 639
  • Thank you received: 16
  • Hikashop Business
9 years 9 months ago #224274

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.5

From the show_default.php view I want ot check if the product has

more than zero related products assigned
more than zero options assigned.

i don't want to show them not load any content module but to activate something in the case it is true there is at least one product as related or as option.

what would be the code to check this?

I tried with this some kind of invention starting from the development guide

	$show_related = 0;
	$related_productClass = hikashop_get('class.product');
	$show_related=$related_productClass->get($product_related);

but is always giving value '1' no matter if there is none or ten products related.


UPDATE:

I found for options that this code works:
if (!empty ($this->element->options)) {  code to execute}

But still don't know how for related

Last edit: 9 years 9 months ago by PeterChain.

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
9 years 9 months ago #224294

Hi,

For the related products you need to run a MySQL query on the hikashop_product_related and the hikashop_product table as there is currently no function in the HikaShop product class to load them.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Last edit: 9 years 9 months ago by nicolas.
The following user(s) said Thank You: PeterChain

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

Time to create page: 0.054 seconds
Powered by Kunena Forum