No intro or full text in selcted favorites

2 years 3 months ago #7 by Henri
Replied by Henri on topic No intro or full text in selcted favorites
Hello Christopher,

I read this topic with interest, and tried to display a specific field from flexicontent.
The name of this field is 'activite' and its id = 30

I used your request,
$db = JFactory::getDBO();
$db->setQuery('SELECT `activite` FROM `#__content` WHERE `id` = "'.$item->object->id.'"');
$texts = $db->loadObject();

but I still get the same answer: Unknown column 'activite' in 'field list'

I'm not very pro with php, and I was wondering if you had an idea to display the contents of this field?
Tanks a lot

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

2 years 3 months ago #8 by Christopher Mavros
Replied by Christopher Mavros on topic No intro or full text in selcted favorites
Hello Henri and thank you for posting.
I'm very sorry for the quite late reaction.

The field you are trying to load is not located in the `#__content` table of the database. Judging from the fact that you are using FlexiContent, the field you are looking for, should be in the table `#__flexicontent_fields_item_relations` where the `field_id` is found from the table `#__flexicontent_fields` (the "activitite" is in the name column) and the `item_id` should be the ID you already had.

So it might end up to something like this (simplified):
$db = JFactory::getDBO();
$db->setQuery('SELECT `field_id` FROM `#__flexicontent_fields` WHERE `name` = "activite"');
$field_id = $db->loadResult();
$db->setQuery('SELECT `value` FROM `#__flexicontent_fields_item_relations` WHERE `field_id` = "'.$field_id.'" AND `item_id` = "'.$item->object->id.'"');
$value = $db->loadResult();

Christopher Mavros
mavrosxristoforos@gmail.com
If you like our extensions, please rate us on the JED!

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

1 month 4 weeks ago #9 by Gerardo Alvarez
Replied by Gerardo Alvarez on topic No intro or full text in selcted favorites
Hi Christopher!
First of all let me tell you that your plugin is excellent and unique by the way. Just what i was looking for!
Second, sorry to bring back this thread but i have some questions about this.
** I want to display the intro text only in the full list page**
I guess this method works also for the full list page (after you click the button view all), but i don´t know wich file i have to edit to add the intro text.
I was looking around components/com_myshortlist/views/myshortlist/tmpl/default.php but can´t find where to edit
Look also at modules/mod_myshortlist/tmpl/default_list.php but again fail to find where to edit.
Hope you can point me in the right direction.
Thanks in advance for your support

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

1 month 3 weeks ago #10 by Christopher Mavros
Replied by Christopher Mavros on topic No intro or full text in selcted favorites
Hi there Gerardo!

You can customize the view of MyShortlist as much as you need. To do that, you can create template overrides for the module, as even the menu item list view is actually wrapping and showing the module.

To edit how a single item is shown, you have to edit the file modules/mod_myshortlist/tmpl/default_item.php.

Now, the tricky part is to get it to only show the additional information when we're viewing it from the menu item. At the moment, I have included a custom module ID for the modules that are loaded through the menu item view.
You can do the following check inside the default_item.php file:
if (strpos($module->id, 'mi') !== false) {
    ...
}

Let me know if you need any further help!

Christopher Mavros
mavrosxristoforos@gmail.com
If you like our extensions, please rate us on the JED!

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

1 month 3 weeks ago #11 by Gerardo Alvarez
Replied by Gerardo Alvarez on topic No intro or full text in selcted favorites
Hi Christopher! Thank you so much for your support!

I have applied your instructions, i have created an override for the module at my template, include the lines you indicate in the default_item.php file, create a menu item at my hidden menu and asign it the module ID "mi" but I am getting this error

0
syntax error, unexpected '...' (T_ELLIPSIS)

Can you please help me with this?
Thanks in advance

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

1 month 3 weeks ago #12 by Christopher Mavros
Replied by Christopher Mavros on topic No intro or full text in selcted favorites
Hi again Gerardo.
By your previous post, I was under the impression that you were confident with PHP. My apologies.

You do not need to assign any specific module ID "mi".
The PHP block I sent you is not complete. It just implies that you should write your own PHP, where I have written the three dots. (...)

Can you please confirm: You are trying to only show the item intro text when viewing the list in the menu item, right?

Christopher Mavros
mavrosxristoforos@gmail.com
If you like our extensions, please rate us on the JED!

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

Moderators: Christopher Mavros