Flexi as downloads component?

More
8 years 5 days ago - 8 years 5 days ago #61706 by lipatovroman
Please help me with this:

I have file field and text field with name Hits.
I need each time user press on download button text field Hits value increases on 1



I think it should be sql query in file filed plugin.
But I 'm not programmer, so I can't understand how to make it.
Thanks.

P.S. I tried to edit file /plugins/flexicontent_fields/file/tmpl/value_InlineBoxes.php

After this code
Code:
// The download button in a mini form ... $actions_arr[] = '' .'<form id="form-download-'.$field->id.'-'.($n+1).'" method="post" action="'.$dl_link.'" style="display:inline-block;" >' .$file_data_fields .'<input type="submit" name="download-'.$field->id.'[]" class="'.$file_classes.' btn-success fcfile_downloadFile" title="'.$downloadsinfo.'" value="'.$downloadstext.'"/>' .'</form>'."\n";

I added own code:
Code:
if(isset($_POST['download-'.$field->id.'[]'])) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $sql= mysql_query ('UPDATE biblsoft_flexicontent_fields_item_relations SET value = value + 1 WHERE field_id = 22 and item_id = '.$item->id); }

But it does not work :(
Last edit: 8 years 5 days ago by lipatovroman.

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

More
8 years 5 days ago #61709 by micker
at first do no edit this field duplicate and rename value_YOURTEMPLATENAME.php and select it in field admin
you became safe for update

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
8 years 4 days ago #61712 by lipatovroman
Ok, I understand.
But can you help me with my problem?

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

More
8 years 4 days ago - 8 years 4 days ago #61720 by ggppdk
Hello

inside your template file
item.php (or item_html5.php)

you can use:
Code:
echo '<label class="label">'. JText::_('FLEXI_HITS').'</label>'; $file_data_arr = $item->fields['myfile_fieldname']->file_data; if ( empty($file_data_arr) ) echo 'no file exists'; else { $file_data = reset($file_data_arr); // get data of first file; echo $file_data->hits; }


-- 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: 8 years 4 days ago by ggppdk.

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

More
8 years 4 days ago #61722 by lipatovroman
It seems you didn't understand me...
I need to get sum of all files downloads for item.

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

More
8 years 4 days ago - 8 years 4 days ago #61724 by ggppdk
Hello

a small loop can add them ...
Code:
echo '<label class="label">'. JText::_('FLEXI_HITS').'</label>'; $file_data_arr = $item->fields['myfile_fieldname']->file_data; $total_downloads = 0; foreach ($file_data_arr as $file_data) { $total_downloads += $file_data->hits; } echo $total_downloads;


-- 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: 8 years 4 days ago by ggppdk.

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.289 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