Ok. So I changed the routing by adding this rule in the routes.php file:
$route['tools/(:any)'] = "b/view/$1";
However, when I visit http://mywebsite.com/tools/toolid, I get the following error:
A PHP ERROR WAS ENCOUNTERED
SEVERITY: NOTICE
MESSAGE: TRYING TO GET PROPERTY OF NON-OBJECT
FILENAME: VIEWS/LISTING_PAGE.PHP
LINE NUMBER: 64
So the code on line 64 in the LISTING_PAGE.PHP file is:
echo $categoryinfo->name;
The LISTING_PAGE.PHP is a view which is loaded by the code in the B class, specifically this line:
$this->load->view("listing_page", $data);
Now, the strange thing is, if I change the routing rule in routes.php to:
$route['tools/id/(:any)'] = "b/view/$1"; //I added an id 'section'
Then the code works without error.
The code also works perfectly if I access http://mywebsite.com/b/view/toolid.
So it appears that if there is more than one 'section' (tools/id) then the code works perfectly, if there is only one 'section'(tools/) then there is that non-object error.
Does anyone know what may cause this issue?
#splash58 is right
You should put:
echo '<pre>', var_dump($category);exit;
on very first line of view file just after opening php tag and see what have you got.
Related
The CC Avenue module is giving the following error on the Order cart page, though the module as such is working and there is nothing wrong in it, but how do I remove this error?
Notice: Undefined index: ccavenue_error_message in /home/desigssq/public_html/tools/smarty/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 38
Notice: Trying to get property of non-object in /home/desigssq/public_html/tools/smarty/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 38
This error means that the variable $ccavenue_error_message is in one of the .tpl files of the module, but is not defined in the .php file that calls it.
In the .tpl file, add a condition to the part of the code containing $ccavenue_error_message.
For example if you have:
<div class="error">{$ccavenue_error_message.text}</div>
replace it by:
{if isset($ccavenue_error_message)}<div class="error">{$ccavenue_error_message.text}</div>{/if}
Feel free to add the code of your tpl file so I can give you exactly the part to modify.
You should also ask the developer of the module to correct this bug.
Fatal error: Call to undefined method Exception::getClass()
Simply! You are calling a function which is not available
I assume it's OpenCart error. It might be seen after new extension is added or after OC version update as they recently changed some file paths.
The URL probably looks like:
http://example.com/index.php?route=exampleA/exampleB/exampleC
You need to correct the route. Start adding extension in front. It works in some cases.
The updated URL would be:
http://example.com/index.php?route=extension/exampleA/exampleB/exampleC
If that works fine, you need to correct path in your extension source. If not keep searching in documentation.
If you work with cart.php it was moved from system/library/cart.php to system/library/cart/cart.php together with some other files. Good luck and try to give us more details in the future.
Please help me: I get an error when I pass data to a view. I think it's the correct procedure but i get error..
Controller:
$data['success']='1';
$this->load->view('user_control/register', $data);
View:
echo $success;
Got Error:
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: success
Filename: views/register.php
Line Number: 79
Ok, it is working perfectly. Take a look at my screen shots and try emulate.
My Controller
My View (Code)
And finally the result on the screen.
If it is still not working, make sure you have you are running Codeigniter in htdocs on a Lampp or Xampp stack.
Not a codeigniter programmer but you should check your view Filename from your controller you have passed $this->load->view('user_control/register', $data); i guess filename should be in
views/user_control/register.php
For some reason the first variable just wont display in my code. Am I doing something wrong?
$url = 'http://localhost/development/ui';
$filename = 'login';
include_once($url.'/views/app-pages/'.$filename.'.php');
I am getting the following error
PHP Warning: include_once(/views/app-pages/login.php): failed to open
stream: No such file or directory
Hmm ive tried a bunch of different methods of displaying that var in the begining. Idk why its not working.
If it also helps the following code is just a simplified version of what I have. My code is actually within a function. But that shoudnt matter the following include statement still isnt working.
I am on Magento ver. 1.7.0.0 and I can't edit some of the products from the admin backend.
When I tried to change the product description directly using mysql it worked, so then I tried removing parts of the description and then found that
everything till the text 'printer driver lets users transfer data' works but when I added the word 'from' to it ,it didn't work making the paragraph end in 'printer driver lets users transfer data from' did nothing ,neither showed a error nor a successful message it just refreshed the page. It can't be about the length because if I replace the text from to krom it works.
So I tried editing the description to just 'printer driver lets users transfer data from' it worked
From the system.log:
ERR (3): Warning: array_key_exists() expects parameter 2 to be array, null given in //app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php on line 507
ERR (3): Recoverable >>ERRor: Argument 1 passed to Varien_Object::addData() must be an array, null given, called in //app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php on line 514 and defined in //lib/Varien/Object.php on line 243
ERR (3): Warning: Invalid argument supplied for foreach() in //lib/Varien/Object.php on line 245
The Chrome console tells me :
index.php/admin/catalog_product/validate/id/1/back/edi…roduct_info_tabs_group_7/key/978d8fe4570a41312a7520945e982662/?isAjax=true 500 (Internal Server Error) prototype.js:1530
Ajax.Request.Class.create.request prototype.js:1530
Ajax.Request.addMethods.initialize loader.js:61
(anonymous function) prototype.js:429
klass prototype.js:101
varienForm._validate form.js:80
varienForm.submit form.js:65
saveAndContinueEdit /index.php/admin/catalog_product/edit/id/1/back/edit/tab/product_info_tabs_group_7/key/a325cea2187bfa32cec5c6d0c14e0baa/:2240
onclick
A little PHP debugging tells me that for the product with description error
$product->getAttributes(); was empty but for the working products it was an array.
$attributes = $product->getAttributes();
around line 504 of app\code\core\Mage\Adminhtml\controllers\Catalog\ProductController.php
If I change the following part from the form.js there is no Chrome console error but it still doesn't work:
this.submitUrl = url;
if(this.validator && this.validator.validate()){
if(this.validationUrl){
this._validate();
}
else{
this._submit(); // I removed everything but this
}
return true;
}
If it helps there are 5881 characters before the word 'from' in the description.
I have tried editing in all major browser so there are no compatibility issues.
I believe the problem is somewhere in the javascript but can't find where. Even if I can just remove the validation script from the admin forms I will but I don't think I should and I don't know how.
Any help would be greatly appreciated.
Thanks for your time.
Take a closer look at your .htaccess file. When I migrated my 1.7.0 Magento store to another server I included the .htaccess file from the old server and then the message: "Invalid Form Key. Please refresh the page" popped on screen and nothing happened, not even the configuration changes had effect.
The solution was to install a fresh Magento and then copy the My Store files the the Magento root, excluding .htaccess. When I used the .htaccess from the fresh installation, everything started to work fine. I don't know what exactly happened, maybe each server structure has different and particular .htaccess entries and rules. It works to me.