News:

Support for jDownloads 3 has been ended
Since 17 August 2023 Joomla.org has discontinued support for Joomla 3.x. Therefore, we will no longer offer official support for our Joomla 3 jDownloads version 3.9.x from January 2024.
Please update your website to the latest Joomla version (Joomla 4 or Joomla 5) as soon as possible. Afterwards, please update jDownloads to the latest published version. The longer you delay, the more difficult the upgrade process for your website is likely to be.

Main Menu
Support-Forum

How to add mirror fields?

Started by romagromov, 17.11.2015 12:50:28

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

romagromov

Hi!
As I already explained in topic about additional files for one item. I began to use mirror fields as additional files.

How I can add more mirror fileds?

Ideal, I need 4 mirror fields:

Main field - windows,
mirror fileds: Mac OS X, Android, iOS, Linux.

Thanks.
Best free windows software for your PC at bestwinsoft.com
  •  

Arno

It is not possible to add more mirrors fields easy. For this must be changed many many files.
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

romagromov

Can you suggest other way to add multiple files for 1 download item besides content plugin?
Best free windows software for your PC at bestwinsoft.com
  •  

romagromov

Arno, please give me an answer do you have plans to add multiple downloads option.
If no - I'll have to order additional mirror fields by freelancers.
Best free windows software for your PC at bestwinsoft.com
  •  

ColinM

Hi
The Related Downloads capability is available and I suggest it would be simpler to incorporate that to show the related set of Downloads.  You can add the Related Module into each description so it will show the other available Downloads in that Category.  This is, I think, a simpler and easier approach to showing the availability of multiple Downloads.
It may of course be that you need to create/reorganise your bottom level categories, and some specific layouts.  Maybe I could help.

Colin
Colin M
  •  

romagromov

Quote from: ColinM on 03.12.2015 23:11:52
Hi
The Related Downloads capability is available and I suggest it would be simpler to incorporate that to show the related set of Downloads.  You can add the Related Module into each description so it will show the other available Downloads in that Category.  This is, I think, a simpler and easier approach to showing the availability of multiple Downloads.
It may of course be that you need to create/reorganise your bottom level categories, and some specific layouts.  Maybe I could help.

Colin

Thanks.

But not related - multiple.

https://monosnap.com/file/F6BmuauEe0NlKMBddmY53hpxuVIxcT.png

https://monosnap.com/file/G5kp61LuUqClcTjfjvPcGy7KCcPW66.png

I need also iOS and Linux (may be Windows Mobile - not sure)
Best free windows software for your PC at bestwinsoft.com
  •  

ColinM

Hi
I used your second picture to illustrate what I meant. Please see below. 
All the Downloads are related as they have the same function but just work on a different OS.

Colin

[gelöscht durch Administrator]
Colin M
  •  

romagromov

I already wrote: if I'll use downloads from another category/subcategory - downloads counter for main items will not increases.

Ok, I understand. I have only 1 way - to add new mirror fields.
Best free windows software for your PC at bestwinsoft.com
  •  

Arno

#8
Quote from: romagromov on 03.12.2015 22:40:46
Arno, please give me an answer do you have plans to add multiple downloads option.
If no - I'll have to order additional mirror fields by freelancers.
I think your problem is, that you had found on another website this structure and you will now have exactly the same structure for your own website. But this is not really possible with jDownloads.

You had then found an alternate way when you use the mirror fields but this fields are limited. Sure should it be possible to add more mirror fields. But it is much work. We must change the database, many view classes, some layouts and also the language files (and nobody else seems to need this).  ::)

How many additional mirror fields would you need exactly?
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

romagromov

Quote from: Arno on 09.12.2015 10:21:44
I think your problem is, that you had found on another website this structure and you will now have exactly the same structure for your own website. But this is not really possible with jDownloads.

You had then found an alternate way when you use the mirror fields but this fields are limited. Sure should it be possible to add more mirror fields. But it is much work. We must change the database, many view classes, some layouts and also the language files. ::) 

How many additional mirror fields would you need exactly?

Hi Arno!
Yes, I have seen and analyzed many sites. 
In order to make a good website - you need to use the experience of other successful sites.
In addition, it is very important that the site was suitable for users.
There is only one reason why Jdownloads can't have option "Several Downloads for One item" - because it have batch downloads option (with checkboxes).
But my opinion - this option is not in demand. Users does not use this option. It is a fact, based on my observations of the users.

About additional fileds.
I already find how to add new fields in frontend. So now I can add data in this fields using any SQL Client.
A little later, I'll find a way to add these fields to the admin panel, so I was comfortable to add links in them.

As for admin panel options. My opinion, that administrator should have ability to add new custom fileds and mirror fields right in admin panel. It's how K2 works.



Now about how to add new mirror fields on front end.
This is solution for other users who asked for this option.

1. Make database backup.
2. Open database with any SQL Client. I use Sequel Pro.
3. Open table jdownloads_files and duplicate fileds 
mirror_2 and extern_site_mirror_2
4. Rename duplicated fields to 
mirror_3 and extern_site_mirror_3
https://monosnap.com/file/Y1O96uWU64JhOvmzMTRHTLRQzdELrg.png

Repeat this step and create mirror_4 and extern_site_mirror_4.

5. Open file components/com_jdownloads/models/download.php

Find code a.mirror_1, a.mirror_2, a.extern_site_mirror_1, a.extern_site_mirror_2,

and just add your new fields

a.mirror_1, a.mirror_2, a.mirror_3, a.mirror_4, a.extern_site_mirror_1, a.extern_site_mirror_2, a.extern_site_mirror_3, a.extern_site_mirror_4

6. Open file /components/com_jdownloads/controllers/download.php

find code

// is mirror 
             if ($mirror == 1){
                 $filename = $files[0]->mirror_1; 
                 if ($files[0]->extern_site_mirror_1){
                     $extern_site = true;
                 }
             } else {
                 $filename = $files[0]->mirror_2; 
                 if ($files[0]->extern_site_mirror_2){
                     $extern_site = true;
                 }
             }



replace with


 // is mirror 
             if ($mirror == 1){
                 $filename = $files[0]->mirror_1; 
                 if ($files[0]->extern_site_mirror_1){
                     $extern_site = true;
                 }
             } elseif ($mirror == 2) {
                 $filename = $files[0]->mirror_2; 
                 if ($files[0]->extern_site_mirror_2){
                     $extern_site = true;
                 }
             }
             elseif ($mirror == 3) {
                 $filename = $files[0]->mirror_3; 
                 if ($files[0]->extern_site_mirror_3){
                     $extern_site = true;
                 }
             }
             else {
                 $filename = $files[0]->mirror_4; 
                 if ($files[0]->extern_site_mirror_4){
                     $extern_site = true;
                 }
             }


7. Open /com_jdownloads/views/download/tmpl/default.php

Find  // mirrors

add placeholder 


 // mirror3
                if ($this->item->mirror_3) {
                    if ($this->item->extern_site_mirror_3 && $url_task == 'download.send'){
                        $blank_window3 = 'target="_blank"';
                    }
                    $mirror3_link_dum = JRoute::_('index.php?option=com_jdownloads&task=download.send&id='.$this->item->file_id.'&catid='.$this->item->cat_id.'&m=3');
                    //$mirror3_link_dum = JRoute::_(JDownloadsHelperRoute::getOtherRoute($this->item->slug, $this->item->cat_id, $this->item->language, $url_task, 1));
                    // is the old button used?
                    if ($jlistConfig['use.css.buttons.instead.icons'] == '0'){                
                        $mirror3_link = '<a '.$blank_window3.' href="'.$mirror3_link_dum.'" class="jd_download_url"><img src="'.JURI::base().'images/jdownloads/downloadimages/'.$jlistConfig['download.pic.mirror_3'].'" style="border:0px;" alt="'.JText::_('OK').'" /></a>';
                    } else {
                        // we use the new css button 
                        $mirror3_link = '<a '.$blank_window3.' href="'.$mirror3_link_dum.'" class="jdbutton '.$download_color_mirror3.' '.$download_size_mirror.'">'.JText::_('OK').'</a>'; 
                    }    
                    $body = str_replace('{mirror_3}', $mirror3_link, $body);
                } else {
                    $body = str_replace('{mirror_3}', '', $body);
                }


In same way add placeholder for mirror_4

Find code 

$body = str_replace('{url_download}', $regg, $body);
                $body = str_replace('{mirror_1}', '', $body); 
                $body = str_replace('{mirror_2}', '', $body);


replace with 


$body = str_replace('{url_download}', $regg, $body);
                $body = str_replace('{mirror_1}', '', $body); 
                $body = str_replace('{mirror_2}', '', $body);
                $body = str_replace('{mirror_3}', '', $body);
                $body = str_replace('{mirror_4}', '', $body);


find code

// when we have a simple document, view only the info not any buttons.
        if ($has_no_file){
            $body = str_replace('{url_download}', $no_file_info, $body);
            $body = str_replace('{mirror_1}', '', $body);
            $body = str_replace('{mirror_2}', '', $body);



replace with


// when we have a simple document, view only the info not any buttons.
        if ($has_no_file){
            $body = str_replace('{url_download}', $no_file_info, $body);
            $body = str_replace('{mirror_1}', '', $body);
            $body = str_replace('{mirror_2}', '', $body);
            $body = str_replace('{mirror_3}', '', $body);
            $body = str_replace('{mirror_4}', '', $body);


8. Copy file /com_jdownloads/views/download/tmpl/default.php 
to your template folder
/templates/yourtemplate/html/com_jdownloads/download/default.php

So after JDownloads update this file will not be change.

That's all.

So, you need to add new fields in database and edit 3 files.

To add links to new mirror fields you need use SQL client.

https://monosnap.com/file/cpLomglltVUuzsu2N8uPF8RMRpcxFF.png


Arno, can comment this topic?

http://www.jdownloads.com/index.php/support-forum.html?topic=8545.msg34675#msg34675
Best free windows software for your PC at bestwinsoft.com
  •  

Arno

#10
QuoteNow about how to add new mirror fields on front end.
So your list is incomplete.
Missing is:
- the complete backend handling
- the field labels (language files)
- 'editing' in frontend
- support in content plugin
and so on...

But i will check it. Also the K2 extension.
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

romagromov

Quote from: Arno on 09.12.2015 12:33:40
But i will check it. Also the K2 extension.

Thank you!

If you going to add more mirror fields, I'm sure 4 mirrors - is enough.  :)

Also, I am sure that we should have ability to choose system with checkboxes, not with dropdown.

I have to make very uncomfortable things:



instead

Best free windows software for your PC at bestwinsoft.com
  •  

romagromov

Finally, I added 4 mirrors (so, I have 6 mirror fields)
An? what we have now:

http://bestwinsoft.com/internet/browsers/google-chrome

I like it :)
Best free windows software for your PC at bestwinsoft.com
  •  

ColinM

Hi
I like the look that the page has.  What you were seeking was ability to have multiple donlod buttons ech pointing to a different download. Noticed you are also using the Related module. Firefox?

Colin
Colin M
  •  

romagromov

Quote from: ColinM on 23.12.2015 01:35:40
Hi
I like the look that the page has.  What you were seeking was ability to have multiple donlod buttons ech pointing to a different download. Noticed you are also using the Related module. Firefox?

Yes, I use Related module with this settings:



So, it seems Firefox does not have enough hits...


Colin
Best free windows software for your PC at bestwinsoft.com
  •