Page 1 of 2

Selecting articles / categories for PDF

Posted: 14 Sep 2022, 07:06
by rbuelund
It seems that the "Include Articles" setting overrules the "Include Article Categories" ??

I would like to show the PDF options on some articles across different categories, and I would like to show the PDF option for all articles in some other categories (Not selected single articles included in this particular category) - is that not possible ??

Re: Selecting articles / categories for PDF

Posted: 15 Sep 2022, 14:18
by Jan
Hi, both parameters work the same way:

- if you exclude article and Phoca PDF gets ID of article and sees, it is excluded, then the PDF is not displayed
the same for category:
- if you exclude category and Phoca PDF gets ID of category and sees, it is excluded, then the PDF is not displayed

Article rule applies first but in fact this has no influence on the feature. Even if this will applied as second, it will work the same.

Jan

Re: Selecting articles / categories for PDF

Posted: 15 Sep 2022, 17:08
by rbuelund
I do not use Exclude I only use include as I wrote. But I still do not see the PDF button in the articles of the included category??

Re: Selecting articles / categories for PDF

Posted: 16 Sep 2022, 01:33
by Jan
Hi, sorry for misunderstanding. Yes, in this case, article is the priority but it only applies when the parameter has some data. If not, it is ignored. So it does not influence category.

Try to disable SEF and check if the category ID in URL address is really same as the one set in parameters. :idea:

Jan

Re: Selecting articles / categories for PDF

Posted: 16 Sep 2022, 05:59
by rbuelund
It is the same category in the URL catid=121 which is set in the PDF settings. The PDF button IS shown on the articles whos ID I have set, but NOT on articles from this category.

Re: Selecting articles / categories for PDF

Posted: 16 Sep 2022, 16:50
by Jan
Hi, now I understand, If you have set some IDs for article include, all others will be ingored and this happens befor it checks the category ID.

So then the only way is to customize the code directly:
administrator/components/com_phocapdf/helpers/phocapdf.php function getPhocaPDFContentIcon

and change the behaviour there :idea:

Jan

Re: Selecting articles / categories for PDF

Posted: 17 Sep 2022, 09:49
by rbuelund
That is sad - could this not be implemented in the future? So that it both takes full categories and seperate articles from other categories ? So that the category field overrides the article field - wouldn't that make sense ?

Re: Selecting articles / categories for PDF

Posted: 17 Sep 2022, 13:34
by Jan
Hi, do you know PHP? If you are able to set the rules differently, just let me know the code, so I can implement it in next version. The problematic part is, that it depends on specific using of this feature. For someone will be important to check the articles first, for someone to check the categories first :idea:

Jan

Re: Selecting articles / categories for PDF

Posted: 17 Sep 2022, 13:45
by rbuelund
Line 51 and on change to:

Code: Select all

		$include_article = true;
		$include_category = true;
		
		if (!empty($include_articles)) {
			if(isset($item->id) && !in_array($item->id, $include_articles)) {
				$include_article = false;
			}
		}

		if (!empty($include_categories)) {
			if(isset($item->catid) && !in_array($item->catid, $include_categories)) {
				$include_category = false;
			}
		}
		//If neither article id nor category id is included return ""
		if(!($include_article || $include_category)){return "";}

Re: Selecting articles / categories for PDF

Posted: 17 Sep 2022, 14:16
by Jan
Hi, great, thank you, please test and let me know:

https://github.com/PhocaCz/PhocaPDF/rel ... 0Beta4.zip

Jan