Skip to main content

Retrieve if a product has related or options

More
10 years 9 months ago - 10 years 9 months ago #224274 by PeterChain
-- 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
Code:
$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:
Code:
if (!empty ($this->element->options)) { code to execute}

But still don't know how for related
Last edit: 10 years 9 months ago by PeterChain.

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

More
10 years 9 months ago - 10 years 9 months ago #224294 by Jerome
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.
Last edit: 10 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.176 seconds
Powered by Kunena Forum