zoolanders / ytp-source-k2

A K2 Source for YOOtheme Pro
5 stars 0 forks source link

Can't map content or custom fields #8

Closed snaffle closed 2 years ago

snaffle commented 2 years ago

Firstly, was super pleased to see this released as a dynamic source for Yootheme and thanks greatly to the sponsor for making it happen!

I've installed the latest Development version of K2 - v2.11.0 [Build 20220511] - and I'm running Joomla 3.10.8

I have the source installed correctly and available in the builder but sadly I can only get the Title, Image and Link of any K2 item to map to a builder element.

See attached screenshot showing a Panel Slider where the Title, Image and Link map correctly but not the content as such.

I've also been through and tested a range of custom fields that we have set up and they don't seem to work either.

Any ideas what might be wrong?

k2-source-content-not-working

miljan-aleksic commented 2 years ago

Hi Nathan,

the integration didn't had the chance to be tested in the wide, so this is great. Can you open the browser console and see if there is any issue being displayed? If so, try to see it details and attach a screenshot.

snaffle commented 2 years ago

Hi Miljan, thanks for the quick reply.

Sadly there is no message at all in the browser console other than confirmation that a small piece of JQuery has run to move the navigation arrows either side of the navigation dots, but I can't imagine that's causing the problem as it runs after the page has loaded.

This is running on a development site so you are welcome to have a look yourself and I can provide you with admin access if that helps.

The dev site is:

https://dev.sane.org

And the panel slider is the one with the yellow background half way down the page.

k2-source-content-console-no-message

snaffle commented 2 years ago

Also, the first slide in the panel does actually have content, but it's a static slide and just an example of how it's meant to look.

miljan-aleksic commented 2 years ago

Source PHP related errors are catched and silented by the ytp framework. only to be shown as an error in the browser console while in the customizer. Make sure you have error repoting set to maximum and try again.

Otherwise an admin access would be great, just consider this is a public issue, but I could delete that info right after.

snaffle commented 2 years ago

Ah I see, did not know that.

Ok so I've turned that on and it did indeed generate some errors in the builder - screenshot attached together with an export of the console log which is showing a "Call to a member function get() on string" type error.

I'm happy for you to use this site for testing if that's helpful so have set up an admin account as follows:

login: pass:

And yes if we can delete that once you have it that would be be good :-)

Admin url is the standard /administrator

Error reporting is currently set to Maximum.

k2-source-content-console-message

console-export-2022-5-25_10-48-16.txt

snaffle commented 2 years ago

Also, with Maxium error reporting enable have noticed the rest of the page isn't loading at all after the top Builder section... no doubt being caused by the error.

miljan-aleksic commented 2 years ago

Alright, that's a lead! I will take a look asap, creds removed ;)

snaffle commented 2 years ago

And not sure if it's relevant, but on a standard K2 article page with max error reporting turned on it's now showing the following:

Notice: Undefined property: stdClass::$tags in /home/sanedev/public_html/templates/yootheme_sane/modules/builder-source-k2/src/TemplateListener.php on line 21

Warning: array_column() expects parameter 1 to be array, null given in /home/sanedev/public_html/templates/yootheme_sane/modules/builder-source-k2/src/TemplateListener.php on line 21

https://dev.sane.org/peer-support/connect-with-a-peer-worker

snaffle commented 2 years ago

I do actually need to keep working on this site so I'm going to turn the error reporting down as it's preventing me doing that at the moment and can see that you're not logged in... but if you need to turn it on, just go ahead and change it... I'll realise pretty quickly :-)

miljan-aleksic commented 2 years ago

Nathan,

I had to get creative in order to install the fixes without requiring ftp access, and I might got the source files copied in the wrong folder in the first attempt. Please check if emplates/yootheme_sane/src and templates/yootheme_sane/templates folders exist and delete them.

As for the PHP warning, it is fixed now. Please test it and let me know if there is any issue left.

snaffle commented 2 years ago

Hi Miljan,

I did actually have a couple of header overrides in the templates/yootheme_sane/templates folder so have deleted the meta.php and tags.php files that were in there instead and removed the /src folder.

Sadly though, it's still not working but with a different error this time from the Builder - see attached and console log file.

I've also installed Phoca Commander, a file manager that should make it a bit easier to upload files... and can provide FTP if necessary.

So it's looks it's closer but still not quite working.

k2-source-content-console-message--20220526

console-export-2022-5-26_6-49-58.txt

miljan-aleksic commented 2 years ago

The JS errors seems related to the PHP ones, but those are coming from K2 core code which we would recommend to report to them as it would be nice to get them fixed.

With errors reporting disabled, do you have any issue on mapping K2 content to the site?

snaffle commented 2 years ago

Hi Miljan,

Sorry if I wasn't clear, but there is no change after your changes... it still will only map Title, Image and Link... nothing else.

Error reporting is currently disabled and if you have another look at the site you will see that it's still not working... no content is being pulled in.

The JS error is being reported by customiser.min.js so I'm not sure how that's being caused by the extra fields error but will take your word for it...

I'm not really sure what I'm reporting though so perhaps it would be better if you updated the existing Yootheme thread on the K2 forums to let them know?

Or perhaps provide me with a clear explanation of what it is that I'm reporting?

miljan-aleksic commented 2 years ago

PHP errors can affect the workflow of the customizer and that be reflected as an JS issue. I'm just saying it seems related, but you don't have to report it, is just a suggestion as it's an error that affects all K2 users, not related to YOOtheme Pro :)

I have created a test view displaying a K2 Item and I am able to map the content and others, can you reproduce there the issues you mention?

https://dev.sane.org/ytptest

Make sure to keep error reports disabled and view the content as an admin or through the customizer.

snaffle commented 2 years ago

Ok it took me a while to work out that you'd mapped it to a Template in YTPro, which is all well and good and I can see that the content loads for a single post, but it's still not working on my Panel Slider in a builder page.

Can you go to Joomla core Content > Articles and have a look at the Home article which has been built using YTPro.

Can you have a look at the Panel Slider which is in the section "Stories from the community" and is labelled "Stories slider".

There I have tried to map "K2 Items" to the People Like Us category that this article comes from and I have also tried to just map to the single K2 item and neither of them are pulling in the content.

Or does it only work in the Templates section of YT Pro?

miljan-aleksic commented 2 years ago

Please try it now :)

snaffle commented 2 years ago

You sir, are an absolute legend! Thanks so much Miljan, I appreciate this more than you realise...

Yootheme Pro has become my default development tool in my small web development business but I have a couple of largish old clients, this one included, who have large K2 based websites and I had started thinking about migrating them back to the Joomla core... which would have been a nightmare and this now means I don't have to worry about it! Well, at least for now.

Again, thanks for all your efforts on developing this add-on :-)

snaffle commented 2 years ago

I still think you're a legend but Extra Fields still seem to be a bit of a problem...

This particular category uses the "Cards Template" extra fields group in K2, which is showing up in K2 but is missing a lot of the extra fields.

I've attached a couple of screenshots showing the Extra Fields group in K2 and one showing the Source selector for that group, which only shows 3 fields.

I've highlighted a field, "Category Text", which I know this article has a value for and I was going to use to test the extra field, but it's not showing up... any ideas why?

Not critical for my current site so no rush on this but I thought I should mention it... thanks again for your work :-)

k2-cards-fields source-missing-k2-extra-fields

miljan-aleksic commented 2 years ago

You are welcome Nathan! This addon is exactly meant for that, help those old sites transition to something better without stressing out, gradually.

Can you please test the Extra Fields in the test page I created before, are those complete there or also missing some?

snaffle commented 2 years ago

Sorry, ran out of time last night so I've had a look at the Extra Fields now in the Template manager and they're missing there too - screenshot attached.

In some good news though, I added one of the fields that does show up, "Category Image Alt Text" and it loads above the image correctly.

But yes a bit stumped by why those fields aren't showing up...

k2-template-missing-fields extra-field-displaying-correctly

snaffle commented 2 years ago

Apologies Miljan, ran out of time the other night and have just realised I didn't hit "Comment" on this post!

So anyways, I've had a look at the Extra Fields now in the Template manager and they're missing there too - screenshot attached.

In some good news though, I added one of the fields that does show up, "Category Image Alt Text" and it loads above the image correctly.

But yes a bit stumped by why those other fields aren't showing up...

k2-template-missing-fields

miljan-aleksic commented 2 years ago

Thank you Nathan, I will be checking this next week :)

miljan-aleksic commented 2 years ago

Hi Nathan,

sorry it's crazy busy time for us, could you perhaps recreate this issue in a clean Joomla Installation and send me an Akeeba Backup of it? Working on it locally would definitely be easier.