Skip to main content

Render a widgetkit inside a category description

More
11 years 10 months ago #179689 by PeterChain
-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.6

Have a custom field for categories named widgetkit_id

have a category view with an associated module for products (of that category)

I want the template to show data in the description and after to compose a widgetkit gallery by using shortcode formula this way:

echo '[widgetkit id='.$widgetkit_id.']'

What I get rendered is the sentence in text for reading [widgetkit id=1] instead of the widgetkit getting executed as would happen with a Joomla Content Article.

How should I code this?

Ans how should I grab the value of the custom field?

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

More
11 years 10 months ago - 11 years 10 months ago #179697 by PeterChain
FOUND IT! SOLVED!

Posting in the hope is useful to somebody. By analyzing the widgekit_content.php plugin file I got the needed code:
Code:
<?php $widget_id = $this->element->widgekit_id; // RETRIEVES THE VALUE FOR THE WIDGETKIT ID form custom field in category // load widgetkit require_once(JPATH_ADMINISTRATOR.'/components/com_widgetkit/widgetkit.php'); // render output $output = $widgetkit['widget']->render($widget_id); $output = ($output === false) ? "Could not load widget with the id $widget_id." : $output; ?>


This code is to be added in com_hikashop/category/listing.php

and after this conditional
Code:
if($this->params->get('show_description',1)&&!empty($this->element->category_description)){

In the case you want the widgetkits to be shown only in the description area display of a category. This will prevent the widgetkit from loading inside modules or areas where no description is allowed to show.
Last edit: 11 years 10 months ago by PeterChain.
The following user(s) said Thank You: Jerome

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

Time to create page: 0.136 seconds
Powered by Kunena Forum