[SOLVED] "Finish Publishing" and "Select FlexiContent Items"

More
13 years 10 months ago - 13 years 10 months ago #19588 by victorio404
Hi. I'm using Select "FlexiContent Items" and "Select FlexiContent Items reverse" plugins to display one type of items inside other type - in this case i have 2 item types - Hotel and Special Offer. With this plugins + "include content item" plugin I'm displaying the content of specific Special Offer item in to Hotel items. The problem is that when the special offer expires(they have Finish Publishing" dates set) the special offer disappears from the "Special Offers" section, but it is still visible inside the Hotel content. I have noticed that after "Finish Publishing" date comes the item disappears, but the status in Flexicontent is still "Published". If i unpublish the item manually it disappears from the Hotel page.
So my question is: can the item automatically change the status to "Unpublished" on "Finish Publishing" date?
I hope this make sense, my English is far from perfect :)
(Joomla 1.5.23 + Flexicontent 1.5.5 stable (r607))
Last edit: 13 years 10 months ago by victorio404.

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

More
13 years 10 months ago #19600 by ggppdk
More likely:
you would ask the developer to put a parameter in the field properties allowing to choose where to use publish_up and publish_down FLEXIcontent item parameters.

Something like this (did not test it should work though):

Add this in file plugins/system/selectflexiitem.php

in function onDisplayFieldValue just after line:
db =& JFactory::getDBO();
Code:
$publish_where = ""; if ($field->parameters->get('use_publish_dates', 1 )) { $nullDate = $db->getNullDate(); $mainframe =& JFactory::getApplication(); $now = $mainframe->get('requestTime'); $publish_where .= ' AND ( i.publish_up = '.$db->Quote($nullDate).' OR i.publish_up <= '.$db->Quote($now).' )'; $publish_where .= ' AND ( i.publish_down = '.$db->Quote($nullDate).' OR i.publish_down >= '.$db->Quote($now).' )'; } if ( $field->parameters->get( 'onlypublished', 1 ) ) { $publish_where .= " AND i.state IN (1, -5) "; }
Also inside same function, just before line
.$orderby
Code:
.$publish_where
The above parameter default to true when not set, if you want this new parameter to appear in field configuration, also add the following in file plugins/system/selectflexiitem.xml just before line:
<param name="add_fields_value" ...
Code:
<param name="use_publish_dates" type="radio" default="1" label="use publish up/down dates" description="Will skip selected items when their publication dates expire" > <option value="0">FLEXI_NO</option> <option value="1">FLEXI_YES</option> </param> <param name="onlypublished" type="radio" default="1" label="FLEXI_RIFLD_ONLY_PLUBLISHED_ITEMS" description="FLEXI_RIFLD_ONLY_PLUBLISHED_ITEMS_DESC"> <option value="0">FLEXI_NO</option> <option value="1">FLEXI_YES</option> </param>


Regards


-- 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...

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

More
13 years 10 months ago #19640 by victorio404
It works!!!!... except i had to add the first code in selectflexiitem_reverse.php instead of selectflexiitem.php and the second in selectflexiitem_reverse.xml. And there is no <param name="add_fields_value" in the xml file, instead the code was placed above <param name="default_values". And the path is /plugins/flexicontent_fields (not system).
But it is great you fixed it, thanks a LOT!

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

More
13 years 1 month ago #26066 by victorio404
I have a new issue now - if the state of the item is "Draft" it is displayed by the plugin. Can we add a function in selectflexiitem_reverse not to display items when they are "Draft"?

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

More
13 years 1 month ago #26149 by ggppdk
Hello, I have updated my previous post to include code for this

Regards


-- 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...

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

More
13 years 1 month ago #26150 by victorio404
Not working :( I can still see the "Draft" items along with the "Published" items.
Also i have noticed there are 3 rows "$db =& JFactory::getDBO();" and the code works only when added after the first one(line 128). If i add the same code after the second "$db =& JFactory::getDBO();" - none of the reverse items are displayed even Published ones.

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.916 seconds
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
Save