I've created a grid inside the tab using grid serializer using this tutorial. Then I've added a massaction to this grid using this tutorial.
Mass action block has appeared, but when I choose entities, choose massaction and click Submit, following error has been thrown to browser's console:
"ReferenceError: {gridId}_massactionJsObject is not defined"
Have anybody ever tried to add a mass action to the grid inside the tab? How to solve this error?
Instead of removing var in the abstract class just set the object to the window.
in app/design/adminhtml/default/default/template/widget/grid.phtml calls out to getAdditionalJavascript()
In your grid file add this function.
protected function getAdditionalJavascript() {
return 'window.{gridId}_massactionJsObject = {gridId}_massactionJsObject;';
}
I just attempted this today and ran into the same problem on Magento CE 1.8. After some digging, A co-worker and I discovered that the JavaScript in grid.phtml (lines 207-224) was running but not showing up in the DOM (still not sure why). When using the console, we noticed the varienGrid object is accessible because it is global due to being defined without a var.
With that being said, we found the mass action js in Abstract.php in the function getJavascript() (line 225) and removed the var from the variable definition. This solved the problem for us and hopefully will help you out. Also, you should not modify core. The file should be copied to local and modified there.
grid.phtml - app/design/adminhtml/default/default/template/widget/grid.phtml
Abstract.php - app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php
Related
I am creating a plugin loader library that enables all my plugins to easily include a license and update from git feature and check dependencies of the plugin. I am testing with a plugin that requires ACF which means that the code has to be run after ACF has been ran, I have tried doing it using an inline function and a function in the class both with the same result.
if ($this->checkDependencies($dependencies) and $this->checkLicense()) {
add_action('plugins_loaded', function() {
//File Wont Include Here
include_once($this->pluginFile);
});
//if is included here there is an ACF Error.
}
If I wrap this function In a plugins_loaded action again it shows no errors and the file simply doesn't include, however if I run it as is I get an ACF Error :
We've detected one or more calls to retrieve ACF field values before ACF has been initialized. This is not supported and can result in malformed or missing data.
How can I load the plugins code while waiting until after all potential dependencies have been loaded?
I have debugged my code down to this function and both the conditions of the if statement evaluate to true, so I am assuming it is something to do with WordPress hooks.
I have just noticed that the object method autocomplete does not bring up a list of methods to autocomplete with. I saw it when I was using the $PDO->bindParam() method. Normally, I can just start typing "bi" after the method arrow and the autocomplete will come straight up with the method. Now, these methods do not appear, however methods and attributes in my personally defined classes will appear. Also, it says "PHPDoc not found".
It's strange because it has worked fine previously. The only thing I can think of is that I had to delete the project out of Netbeans and then recover it back using "new project from existing sources".
Is there a broken link to a documentation file I need to re-connect? How would I go about fixing this? Also, apologies if this is an asinine question.
Code completion
To get context sensitive code completion, follow these steps:
Include Yii folder (assuming it is properly placed outside project directory)
Open "File > Project properties > PHP Include Path" and add the Yii framework root path
Ignore yiilite.php to avoid doubled/missing documentation
Open "Tools > Options > Miscellaneous > Files"
Add to the front of "Files Ignored by the IDE" the file "^(yiilite\.php|CVS|SCCS|...."
Restart NetBeans
Code completion in view files
Add the following PHPDoc statement at the head of the file to use code completion in view files. (you may add additional passed parameters as well)
/* #var $this PostController */
/* #var $model Post */
$this->getSomeProValue(); // possible with code completion
$model->author; // possible with code completion
Usage:
Typing suggestions: Ctrl-Space
Show Function parameters: Ctrl-P
Comment your own code with PHPDoc style. Here's a good example.
I had ReDJ plugin v 1.6 working on 2.5 Joomla site. But I'm moving on Joomla 3 and this module don't work now - exception errors appears. In change-logs I found this:
Changed class names for ALL models, controllers and views. So I simply add Legacy suffix to all classes that handles exceptions. And also change JRequest (it is deprecated in v3) on $input=JFactory::getApplication()->input;.
So for now, seems like all is working fine. Except.. component admin panel - i can see component menu, but there is no any content on page.
Here is screenshot: http://tinyurl.com/btfzxux
Main controller controller.php code:
http://pastebin.com/vQjYvYkK
Main component file redj.php code:
http://pastebin.com/gF6icdE3
I found that dont work line parent::display(); in controller.php file. And there is no error in logs and display.
And this line calls JControllerAdmin->display() which is:
/**
* Display is not supported by this controller.
*......................
*......................
*/
public function display($cachable = false, $urlparams = array())
{
return $this;
}
So nothing displayed. I tried to rename extends definition as JControllerLegasy (because it supports display() method), but still nothing in component output.
How can i output component content in admin panel in Joomla 3?
Any help appreciated.
S.G.
UPDATE 1:
I publish my code on GitHub. I'm tying to optimize this plugin for Joomla 3. Any help welcome!
https://github.com/staniaslavg/ReDJ
P.S. Now redirection list displays and adding a new one works fine. But.. there is no items in item list.
UPDATE 2:
Finally, everything works fine (tested jnly by me, but seems like everything is OK..)
P.S. If nothing displays in tabs - check for DataBase columns. I added a few more. Check whis by var_dump errors variable (like $this->get('Errors')) in files views/.../view.html.php
Code on GitHub: https://github.com/staniaslavg/ReDJ
I've posted some updates in the github repo, to show that it's possible to get it working. (for the redirects view sequence). Unforunately some code used in Joomla! 2.5 by the component was already deprecated and was removed in 3.0. Also the GUI looks bad in 3.0, it needs more work.
As much as I would like to help you to get it running, the time involved it huge. I would strongly suggest using Joomla! 2.5 which is still for a good period supported.
Also the developer announces that a Joomla! 3.0 version is underway.
Going over all the code and fixing it makes little sense for me, but here are some examples:
JDatabase::getEscaped() has been removed. Use JDatabase::escape() instead.
$db->getEscaped($orderCol.' '.$orderDirn)
=> $db->escape($orderCol.' '.$orderDirn)
JToolBar no longer supports the 'X' functions (eg, addNewX, editListX) that hide the main menu before doing the function.
and others.
So I'm new at this whole CakePHP thing, but I'm looking to get the Uploader plugin installed. I'm stuck at the first installation step, after download/placing the files in the correct place: http://milesj.me/code/cakephp/uploader. I see this is the code I need to add somewhere:
// CakePHP 2
CakePlugin::load('Uploader');
App::import('Vendor', 'Uploader.Uploader');
$this->Uploader = new Uploader();
But I don't know where to put it! I'm using the basic "Blog tutorial", but I changed the name from "Posts" to "Media". Where would I put this code to get the plugin included? I'm not sure on the rest of the steps either, so if anyone could help me with that in terms of the default "Blog tutorial" setup, that'd be awesome. Thanks!
EDIT: I have the CakePlugin part working. I'm just unsure about the App:import line. I keep trying to add it inside my MediaController class, but it's just throwing errors. Where would this line go?
EDIT: App:import line is working, now I just need the new Uploader() part
I havn't used this specific plugin, but I have used one similar (MeioUpload).
The CakePlugin::load('Uploader') goes in your bootstrap configuration file (app/config/bootstrap.php)
App::import and the creation are likely to be handled within your "Media" controller.
For example. My Cake App uses App::uses('Sanitize', 'Utility'); in its PostController.
EDIT:
I assume it would be something like this.
<?php
App::import('Vendor', 'Uploader.Uploader');
class MediaController extends AppController {
$this->Uploader = new Uploader();
/* The rest of the controller */
}
But I could be wrong. The explanation for that plugin is weird.
I've never had problems with CakePHP's theming system in the past, but now, errors galore. My main issue is that all theme resources (those in /app/views/themed/MyTheme/webroot/*) fail to load. I've set up a custom AppController in /app to set the theme.
var $view = "Theme";
var $theme = "MyTheme";
When I go to any page, I can see that it's utilizing my theme's default.ctp layout and the HTML is fine. Any and all page resources, CSS, JavaScript, images, anything in the theme webroot, fails to load and instead gives me an error like the following (let's say I tried to access http://example.com/theme/MyTheme/img/bg.png):
Error: ThemeController could not be found.
Error: Create the class ThemeController below in file: app/controllers/theme_controller.php
<?php
class ThemeController extends AppController {
var $name = 'Theme';
}
I've never received an error like this in my time with CakePHP. I'm running the latest stable version at 1.3.7.
I've finally found a solution. CakePHP didn't like my uppercase theme name. In fact, any theme name that I tried that included uppercase characters failed to work. I changed my folder name and internal theme name from "MyTheme" to "my_theme" and it worked perfectly. Could possibly be a bug, but it could be undocumented, yet expected functionality.