Joomla - Fatal error: Class 'JParameter' not found - joomla

I'm trying to upgrade Joomla 2.5.22 to 3.5.1, and last time I checked the progress bar, it was 86 %. I looked away for a moment and when I came back to check I saw the below error message.
Fatal error: Class 'JParameter' not found in
/home/mywebsite/public_html/plugins/system/bigshotgoogleanalytics/bigshotgoogleanalytics.php on line 24
What is the cause of this error and how would it be fixed?

Joomla can't find JParameter Class, so you have to use
jimport( 'joomla.html.parameter' );
before using JParameter class

bigshotanalytics is one of those plugins that cause a blank page or, at best, a fatal error when updating Joomla. This is because of its old code. I suggest you move the tracking code to your template. You can also add the tracking code to a custom HTML module (after removing the encapsulating div through an override) and then assign the module to a position in your template (the position should be in the section of the HTML).
Now to answer your question, Joomla no longer uses JParameter - it uses JRegistry instead. So something like:
$jparameter = new JParameter('param1');
Should be changed to:
$jregistry= new JRegistry();
$jparameter = $jregistry->get('param1');

Related

PHPWord + dompdf "Unable to load PDF Rendering library" and "dompdf_config.inc.php" problems

I'm using PHPWord (https://github.com/PHPOffice/PHPWord) to generate a Microsoft Word file (.docx) which I save to my system. This works perfectly and as expected. I also want to save an Adobe Acrobat version of that file (.pdf) to my system. For that I'm relying on PHPWord in conjunction with dompdf (https://github.com/dompdf/dompdf). That's where the trouble begins.
My PHP code is the following:
// first, save the completed .docx file that I've generated
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, "Word2007");
$objWriter->save($path_docx);
// second, set PHPWord PDF rendering variables
\PhpOffice\PhpWord\Settings::setPdfRendererPath("/var/www/html/vendor/dompdf/dompdf");
\PhpOffice\PhpWord\Settings::setPdfRendererName("DomPDF");
// third, load the .docx file which we just saved above
$phpWord = \PhpOffice\PhpWord\IOFactory::load($path_docx);
// fourth, save the new PDF file to the location of choice
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, "PDF");
$xmlWriter->save("/var/www/html/export/my-pdf-version-of-the-file.pdf");
When I run the code above I get the following error:
Fatal error: Uncaught exception 'PhpOffice\PhpWord\Exception\Exception' with message 'Unable to load PDF Rendering library' in /var/www/html/vendor/phpoffice/phpword/src/PhpWord/Writer/PDF/AbstractRenderer.php:94 Stack trace: #0 /var/www/html/vendor/phpoffice/phpword/src/PhpWord/Writer/PDF.php(65): PhpOffice\PhpWord\Writer\PDF\AbstractRenderer->__construct(Object(PhpOffice\PhpWord\PhpWord)) #1 /var/www/html/vendor/phpoffice/phpword/src/PhpWord/IOFactory.php(44): PhpOffice\PhpWord\Writer\PDF->__construct(Object(PhpOffice\PhpWord\PhpWord)) #2 /var/www/html/assets/core/phpword.php(593): PhpOffice\PhpWord\IOFactory::createWriter(Object(PhpOffice\PhpWord\PhpWord), 'PDF') #3 /var/www/html/export/index.php(94): exportOutline(Array) #4 {main} thrown in /var/www/html/vendor/phpoffice/phpword/src/PhpWord/Writer/PDF/AbstractRenderer.php on line 94
I began searching Google for errors similar to this and came upon this Stack Overflow post: PHPWord to PDF not able to load library. They suggested editing some code within the "/var/www/html/vendor/phpoffice/phpword/src/PhpWord/Writer/PDF/AbstractRenderer.php" file. The code snippet referenced in that post is the following:
public function __construct(PhpWord $phpWord)
{
parent::__construct($phpWord);
$includeFile = Settings::getPdfRendererPath() . '/' . $this->includeFile;
if (file_exists($includeFile)) {
/** #noinspection PhpIncludeInspection Dynamic includes */
require_once $includeFile;
} else {
debug($includeFile);
// #codeCoverageIgnoreStart
// Can't find any test case. Uncomment when found.
throw new Exception('Unable to load PDF Rendering library');
// #codeCoverageIgnoreEnd
}
}
They suggested I get rid of this portion of the code which appears on the 4th line above:
. '/' . $this->includeFile
When I implemented that solution, however, it didn't fix my problem. Frustrated, I then looked at the value generated for $includeFile within that snippet of code. For me, the value was "/var/www/html/vendor/dompdf/dompdf/dompdf_config.inc.php". Once I saw that it was trying to include a file called "dompdf_config.inc.php" I then searched my directory for the file. It wasn't at the referenced location nor anywhere in my system!
At that point I began searching Google again for that file name and ended up on this Stack Overflow post: I Can't Find dompdf_config.inc.php or dompdf_config.custom.inc.php for setting "DOMPDF_UNICODE_ENABLED" true. That post suggests that dompdf 0.7.0 no longer relies on that configuration file. At this point I begin thinking that PHPWord's current version (which I'm using) which relies on dompdf has not been updated to support the current version of dompdf (which I'm using). I simply don't know.
My questions:
Can someone confirm if it's true that PHPWord's current version does not play well with dompdf's current version?
If the current version of both are supposed to work together, then what am I doing wrong and how do I fix it?
Thank you in advance for all of your help!
Note: I should note that I've included PHPWord and dompdf in my project via composer; so all relevant files are located in "/var/www/html/vendor" as one would expect. Also, I can't rely on TCPDF nor MPDF (which are alternate PDF rendering engines) because they generate files that don't meet the formatting needs I require for my project.

Joomla 3.0 and modules.php: static variable(2d) and caching - output error

I have the following problem:
I use Joomla 3.0.1 and my own developed Template(with bootstrap). When I turn the normal Joomla caching to on, my site has output errors. These errors are regarding to the modules.php from my template, because I use a static variable(array) to save all loaded module positions and the calulated or preseted spans for bootstrap in an 2 dimensional array. Like this:
top ->2,4,6
left ->3,3,3,3
right ->4,4,4
bottom ->1,2,3,4,2
header ->12
footer ->6,6
Without caching it works perfect, but when i turn it on, i have following errors:
Notice: Undefined index: logo in
/root/templates/jooag_workframe30/html/modules.php on line 82
Notice: Undefined index: mainmenu in
/root/templates/jooag_workframe30/html/modules.php on line 72
I know what this means and where to look, but i have no solution to fix this.
The modules.php code is here:
http://pastebin.com/s4tjXcKR
The entire template is here:
http://www.mediafire.com/?qrkbatdcbs4iq2v
If a position doesn't contain any modules (ie $modCount = 0) the $spanMatrix array won't have its key, so you should be checking whether it exists before trying to access it
I suggest you wrap lines 72-75 AND line 82 of your modules.php in the following statement:
if( isset( $spanMatrix[$modPosition] ))
{
.....
}
Let me know if it works

when using remapColumns in different event, sort icon doesn't show when clicking a header

I saved my column permutation info into a table. This information can be reloaded in beforeRequest event:
mynewperm = {....};
myGrid.jqGrid("remapColumns", mynewperm, true);
The columns are reordered correctly. However I lost the header icon. Now if I click any column header, I can not see
the sort icon anymore, then can not sort any column. How can I get it back?
Thank you,
yh
if you are able to change the code, you could test for an undefined of a.grid.headers[a.p.lastsort].
In the source file it could look like this:
// old
var previousSelectedTh = ts.grid.headers[ts.p.lastsort].el
// new:
var previousSelectedTh = ts.grid.headers[ts.p.lastsort] ? ts.grid.headers[ts.p.lastsort].el : null
Indeed if you look at the jquery.jqGrid.src.js source, the line is:
var previousSelectedTh = ts.grid.headers[ts.p.lastsort].el, newSelectedTh = ts.grid.headers[idxcol].el;
Line #1982 in my version. I fixed it by modifying the file and added this just before that line:
if (ts.p.lastsort < 0) // johnl.
ts.p.lastsort = 0;
The problem was that ts.p.lastsort was -1.
I've just managed to fix this issue myself but not using the methods described above. I was receiving the following error message when trying to sort columns in a jqgrid:
TypeError: a.grid.headers[a.p.lastsort] is undefined js/jqgrid/jquery.jqGrid.min.js?1.4:86
I should note that it was Firebug that produced this error message. Our company develops web applications for Chrome but Chrome's Javascript console produced a very uninformative error message:
Uncaught TypeError: Cannot read property 'el' of undefined
After stripping out all but the jqGrid declaration on the page causing the issue, it transpired that removing the "multiSelect" option declaration for the jqGrid solved the issue. Apparently, declaring this option causes an additional hidden column to be added into the grid rendered which enables users to select multiple grid rows at a time. I'm not exactly sure why this caused an issue but after consultation with the programming director here our best guess is that there is a for loop somewhere in the jqGrid library code which is called when column sorting is applied and the loop is not taking into account this extra column which results in it not being defined.
Strange answer to a strange issue but hopefully this will help somebody out in future and save them around 3 hours of debugging!
I've the same issue :
It append to me since i apply the "remapColumns" method in the "loadComplete" event (i get back user column configuration from a cookie).
So when I try to sort a column nothing happen. I got this error in firebug :
a.grid.headers[a.p.lastsort] is undefined -> jquery.jqGrid.min.js (line 93)
maybe it will be helpful to find what the problem is
Thank you

ClientGlobalContext.js.aspx broken in Dynamics 2011?

I am trying to implement a custom web resource using jquery/ajax and odata. I ran into trouble and eventually found that when I call:
var serverUrl = context.getServerUrl();
The code throws exceptions.
However, when I change serverUrl to the literal url, it works. I then found forum posts that said I should verify my .aspx page manually by going to https://[org url]//WebResources/ClientGlobalContext.js.aspx to verify that it is working. When I did that I received a warning page:
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
Invalid at the top level of the document. Error processing resource 'https://[org url]//WebResources/Clien...
document.write('<script type="text/javascript" src="'+'\x26\x2347\x3b_common\x26\x2347\x3bglobal.ashx\x26\x2363\x3bver\x2...
What the heck does that mean?
Hard to tell outside of context (pun not intended) of your code, but why aren't you doing this?
var serverUrl = Xrm.Page.context.getServerUrl();
(Presumably, because you have defined your own context var?)
Also, this method is deprecated as of Rollup 12, see here: http://msdn.microsoft.com/en-us/library/d7d0b052-abca-4f81-9b86-0b9dc5e62a66. You can now use getClientUrl instead.
I now it is late but hope this will be useful for other people who will face this problem.
Until nowadays even with R15 there are two available ClientGlobalContext.js.aspx
https://[org url]/WebResources/ClientGlobalContext.js.aspx (the bad one)
https://[org url]/[organization name]/[publication id]/WebResources/ClientGlobalContext.js.aspx (The good one)
I don't know why exist 1. but it causes many issues like:
It could not be published or hold information (Your case #Steve).
In a deployment with multiple organizations, seems it saves info only for the last organization deployed causing that methods under Xrm.Page.context. will return info from a fixed organization. Actually each method that underground uses these constants included in ClientGlobalContext.js.aspx: USER_GUID, ORG_LANGUAGE_CODE, ORG_UNIQUE_NAME, SERVER_URL, USER_LANGUAGE_CODE, USER_ROLES, CRM2007_WEBSERVICE_NS, CRM2007_CORETYPES_NS, AUTHENTICATION_TYPE, CURRENT_THEME_TYPE, CURRENT_WEB_THEME, IS_OUTLOOK_CLIENT, IS_OUTLOOK_LAPTOP_CLIENT, IS_OUTLOOK_14_CLIENT, IS_ONLINE, LOCID_UNRECOGNIZE_DOTC, EDIT_PRELOAD, WEB_SERVER_HOST, WEB_SERVER_PORT, IS_PATHBASEDURLS, LOCID_UNRECOGNIZE_DOTC, EDIT_PRELOAD, WEB_RESOURCE_ORG_VERSION_NUMBER, YAMMER_IS_INSTALLED, YAMMER_IS_CONFIGURED_FOR_ORG, YAMMER_APP_ID, YAMMER_NETWORK_NAME, YAMMER_GROUP_ID, YAMMER_TOKEN_EXPIRED, YAMMER_IS_CONFIGURED_FOR_USER, YAMMER_HAS_CONFIGURE_PRIVILEGE, YAMMER_POST_METHOD. For instance method Xrm.Page.context.getUserId() is implemented as return window.USER_GUID;
To be sure that your URL is the correct just follow the link posted by #Chris

when might magento Mage::getModel('customer/form'); fail?

I have the following two lines of code in within a controller class.
$customerForm = Mage::getModel('customer/form');
$customerForm->setFormCode('customer_account_create')
->setEntity($customer);
I am getting "Fatal error: Call to a member function setFormCode() on a non-object in ..."
on the second of those two lines.
what might cause the first line to return a "non-object" ? (I guess it fails and returns a null but why would this happen ?)
I am not sure if this is relevant but this is happening in a site that uses the Enterprise version of magento (Magento ver. 1.8.0.0).
Look into your exeption.log, you should find some ideas there. It might happen if Mage_Customer module is disabled, you have rewrite for 'customer/form' model, or even file with Mage_Customer_Model_Form class is missing.

Resources