how to get all items of category with filtered condition

More
6 years 4 months ago #71011 by Ali_wdm
I want to get all items of category with filtered condition in a module.
My code are
require_once (JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'classes'.DS.'flexicontent.helper.php');
require_once (JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'classes'.DS.'flexicontent.fields.php');
require_once (JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'helpers'.DS.'permission.php');
require_once(JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'models'.DS.'category.php');

$cat_model = new FlexicontentModelCategory(); // when I print this, it give us model with filter parameter
$items = $cat_model->getData();



$items returns blank array.
How to call getData() function so that it return items.

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

More
6 years 4 months ago #71013 by micker
sorry but universal module can this
=> choose your category in categorie scop
=> in filtering scop use advenced scop fieldid##value

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

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

More
6 years 4 months ago - 6 years 4 months ago #71015 by ggppdk
Hello

if for displaying + some manipulation

better use universal module + custom layout file !
Code:
<?php require_once (JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'classes'.DS.'flexicontent.helper.php'); require_once (JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'classes'.DS.'flexicontent.fields.php'); require_once (JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'helpers'.DS.'permission.php'); require_once(JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'models'.DS.'category.php'); // Decide whether to show module contents $app = JFactory::getApplication(); $config = JFactory::getConfig(); $jinput = $app->input; $option = $jinput->get('option', '', 'cmd'); $view = $jinput->get('view', '', 'cmd'); // Your data $catid = 19; // Category id $start_at_item = 0; // First item to ge $items_limit = 100; // Number of items to get $orderby = 'rdate'; // Most recently created // Set and Backup HTTP REQUEST variables $saved_cid = $jinput->set('cid', $catid); $saved_option = $jinput->set('option', 'com_flexicontent'); $saved_view = $jinput->set('view', 'category'); $saved_limitstart = $jinput->set('limitstart', $start_at_item); $saved_limit = $jinput->set('limitstart', $items_limit); $saved_orderby = $jinput->set('orderby', $orderby); // Get/Create current category model ... according to configuration set above into the HTTP Request variables ... $cat_model = new FlexicontentModelCategory(); $category = $cat_model->getCategory($pk=null, $raiseErrors=false, $checkAccess=false); // Get current's view category parameters and force model to retrieve sub-category items $cat_params = $cat_model->getParams(); $cat_params->set('display_subcategories_items', 2); // Add your code // ... $items = $cat_model->getData(); // Restore HTTP REQUEST variables $jinput->set('cid', $saved_cid); // restore cid $jinput->set('option', $saved_option); // restore option $jinput->set('view', $saved_view); // restore view $jinput->set('limitstart', $saved_limitstart); // restore limitstart $jinput->set('limit', $saved_limit); // restore limit $jinput->set('orderby', $saved_orderby); // restore orderby ?>


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 6 years 4 months ago by ggppdk.
The following user(s) said Thank You: Ali_wdm

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

More
6 years 4 months ago #71023 by Ali_wdm
Thanks for your reply.
It returns the items of particular category, I want to get all items of this subcategories also.
What I have to do for it..?

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

More
6 years 4 months ago #71024 by ggppdk
Hello

before calling getData() you can set an appropriate parameter in categories parameters
Code:
$cat_params->set('display_subcategories_items', 2);

I have updated my previous answer , please see my previous answer again


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
The following user(s) said Thank You: Ali_wdm

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.285 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline