-
Trying to filter a list field based on association with another field, But running into problems with the query that is in the ajax.php file. Two specific debugging questions:
Any ideas how to properly debug the code in this section
If I make changes to the the code that eventually makes its way into ajax.php via the JCB GUI, I have to re-compile for those changes to happen (that's normal). However, if I make changes directly in the ajax.php file, those changes are not recognized either until the component is re-compiled. This appears to also be an issue with changes made to the code directly in the ,js file. I regularly make changes throughout my components built with JCB via direct code changes, but for some reason the changes aren't recognized in these areas until I re-compile. Any ideas (or even speculation) on either of these would be welcome. |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
If anyone has any good reference material, tutorials, etc. that provide good instruction on how to manually create this sort of thing in Joomla, and explain how the various things work that JCB is doing, that would be helpful. BTW ... I was able to determine that the call to the ajax.php function is always returning 'false', but can't debug the code within that function to determine why. |
Beta Was this translation helpful? Give feedback.
-
I just compiled the code (created on local WAMP instance), and installed the component onto my dev Joomla domain on my Linode server. I then when into /components//models/forms/.js I've also tried compiling with the JCB global configuration "Browser Storage" set to Active and Inactive with no change to the action. No mater what, it appears that any changes directly to the ajax code (in the various files) doesn't have any effect on the functioning within the component until/unless a new version is compiled. This is getting rather perplexing. If anyone has any ideas what might be causing file changes like this in the various ajax files to not be seen by the running component, please let me know. |
Beta Was this translation helpful? Give feedback.
-
Was finally able to figure out why none of the direct changes to javascript files (and the ajax.php file) were not taking effect unless the project was re-compiled. This was happening because the "Minify JavaScript" compile option was set to Global, and the global was set to YES. Even though the settings in the JCB Global Compiler had "Minify JS" set to NO. (I'm going to test this on a few others to see if this is a bug - the compile global option not recognizing the global configuration). So, this solves issue #2 presented here. Still working on #1 |
Beta Was this translation helpful? Give feedback.
-
AND this solves issue #1. I was able to find one potential 'gotcha' (won't call it a bug/error) in the tutorial video ... Still having some issues with the results returned by the db query in ajax.php not all resulting rows being displayed. |
Beta Was this translation helpful? Give feedback.
-
I've gotten much closer to making this work, and in fact, in some cases I can get some results; however, I can't do anything with the query results to filter them or I get errors. In /models/ajax.php in the getProvider function ('Provider' is the items being returned in the select list that is to be filtered, the 'regions' in the JCB video), if I try to do anything other than a basic query I get errors.
.... etc. This works as it should - returns all the 'listing_approved' items.
the code fails and displays a 500 error in the console. And running xDebug never gets to the code in the ajax.php file because it is erroring out before that. It's almost like the system is 'pre-processing' that ajax.php code and won't let anything other than a very simple query be run there. I have spent hours trying to find any other reference material that explains the approach to building this ajax in Joomla (and very little resources related ajax in Joomla at all). Still trying to figure out how to just filter the results of this ajax db query so that it only displays the fields that match. But finding that VERY difficult to figure out. Any other tips or observations very welcome as this is now going on week 3 of trying to resolve this issue, which really shouldn't be that hard. |
Beta Was this translation helpful? Give feedback.
-
BTW ... if I try to enter a var_dump of the query, it has the same effect as any of the other things tried in the list above - causes the 500 error. |
Beta Was this translation helpful? Give feedback.
-
With suggestion of Tom van der Laan I went back an tested the db query that I was using. Found the problem in the db query syntax. After fixing that syntax the ajax all works as it should. As I have time in the next couple weeks I'm going to try to add some more helpful docs to follow up on Lewellyn's video - just to make it a bit more easier to know (and me remember) how to take what he presented and quickly make changes for specific use-cases, as well as a couple 'gotchas' I ran into with this process. (As I found very little documentation related to Joomla and Ajax, and none that exactly matched or explained the JCB method of building this. |
Beta Was this translation helpful? Give feedback.
With suggestion of Tom van der Laan I went back an tested the db query that I was using.
I created a new custom site view and then just added the db code to the site view (I know, not something you should do for live site, but perfect for a quick test of the db code).
Found the problem in the db query syntax.
After fixing that syntax the ajax all works as it should.
As I have time in the next couple weeks I'm going to try to add some more helpful docs to follow up on Lewellyn's video - just to make it a bit more easier to know (and me remember) how to take what he presented and quickly make changes for specific use-cases, as well as a couple 'gotchas' I ran into with this process. (As I f…