VirtueMart Forum
VirtueMart 1.1.x [ Old version - no longer supported ] => Questions VM 1.1 ( the only active board for the old version) => Topic started by: pencaitland on September 21, 2010, 17:52:26 pm
-
I've found several posts with this error but no solutions; I have a localhost site under develpoment; this message displays twice at the top of my main shop page; it refers to the code
24: $my_page= explode ( '.', $page );
25: $modulename = $my_page[0];
26: $pagename = $my_page[1];
the last line being the cause of the error.
this looks like a pretty basic fault in my configuration, but where?
-
Are you using WAMP? I'd guess that $my_page[1]; is the issue, but not a showstopper. Reduce the level of error reporting in php.ini or by using .htaccess and the error will not show again.
-
hmm, I am using wamp, and the console shows settings as display errors=off; I have also edited the php.ini file that is linked from the console so that it now has the line
- Show only errors
;
error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
but I still see the NOTICE lines at the top of my main shop page; in fact, when no-one is logged-in I get three lines:
Notice: Undefined offset: 1 in C:\wamp\www\lbpsjoomla\components\com_virtuemart\virtuemart.php on line 26
Notice: Undefined index: page in C:\wamp\www\lbpsjoomla\components\com_virtuemart\virtuemart.php on line 69
Notice: Undefined offset: 1 in C:\wamp\www\lbpsjoomla\components\com_virtuemart\virtuemart.php on line 85
Ok, these are not showstopppers, as you say, though I dont like brushing them under the carpet, but I can't see why they should still display ...
-
I'd use this to turn off all errors and work back from that:
error_reporting(0);
You have more than one php.ini file so it is always worth checking for that.
-
I have edited the php.ini files that I can find to read error_reporting =0; {error_reporting(0) threw the thing into chaos, displaying a page with a MYSQL error; I now know that this should have been put in the viruemart.php file itself)
So I have been exploring the cause of the error: the code that begins it is:
$my_page= explode ( '.', $page );
This is expected to give two pieces of data; one is assigned to $modulename and one to $pagename. I ran a test on the contents of $my_page which revealed that it contains only 'shop-front', ie the name of my shop page - no module name in sight;
so I have edited the virtuemart.php page at the offending lines (26 and 85) to read:
if (count($my_page)==1) {
$pagename = $my_page[0];
} else {
$modulename = $my_page[0];
$pagename = $my_page[1];
}
This code needs to be added at lin 85 as well, where the same code runs, after resetting the $page variable.
If no-one is logged-in when this page is called, it also displays the following notice:
Notice: Undefined index: page in C:\wamp\www\lbpsjoomla\components\com_virtuemart\virtuemart.php on line 77 (originally line 69; 77 after my edit above).
This is the result of a call to the $_REQUEST['page']:
if (( !$pagePermissionsOK || !$funcParams ) && $_REQUEST['page'] != 'checkout.index') {
$_REQUEST is not set when the page first opens; so I added code to check:
if (isset($_REQUEST['page'])) {etc}
I hope this helps others; perhaps it should be included in any update?