Fatal error:Call to member function getproduct() on a non-object in app/...../checkout/cart/sidebar/default.phtml on line 29
Why this happen?
Any solution to remove this error??
To remove error,
Go to app/design/frontend/your_theme/checkout/cart/sidebar/default.phtml
Search for getproduct
Comment its line and check.
It happens because, You called the function on an object not associated to it.
Have you used
$_product = Mage::getModel('catalog/product')->load($product_id)
before using it?
Related
I am trying to write a script that creates configurable products. Ive been using this as a guide: http://inchoo.net/magento/programmatically-create-a-configurable-magento-product/
When I get to this line:
$configurableAttributesData = $configProduct->getTypeInstance()->getConfigurableAttributesAsArray();
The script crashes and kicks out this error:
Fatal error: Call to a member function getId() on a non-object in /home/buyfrom/public_html/app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php on line 283
Following a comment on this page, I changed that line to the following:
$possibleAttributes = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
But I am still getting this error. Can anyone suggest how to fix this?
Make sure that attribute set (eg. default) which you are choosing is having at least one configurable attribute (example: 'color' or 'size').
On manage product page, I'm getting no grid, I traced it and it shows the error
Fatal error: Call to a member function setFormFieldName() on a non-object in /app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php on line 279
I don't know whats wrong with it.
I think the FieldName value is invalid, it should be $this->getMassactionBlock()->setFormFieldName('product_id');
I'm attempting to run a php script to parse Google Calendar XML and I keep getting the following error:
Call to a member function asXML() on a non-object in /index.php on line 120
Here's a link to my code (I've notated Line 120 - IT IS LINE 38 ON PASTEBIN) http://pastebin.com/bMHXfbkD
Anybody with any ideas / fixes would be much appreciated!
UPDATE #Clover and #Phil have suggested I remove the line in question, which I did, and got this:
Notice: Trying to get property of non-object in /Library/WebServer/Documents/index2.php on line 125
Warning: Invalid argument supplied for foreach() in /Library/WebServer/Documents/index2.php on line 125
simplexml_load_file function can return FALSE, so make a test before using it.
By the way, in your case, just remove the line, it does nothing :)
use try catch, and instead of using Exception class, try Throwable class
I am new to opencart, so please help me.
I am using opencart version 1.5.6, now whenever I edit and delete the product it shows me
Fatal error: Call to a member function productUpdateListen() on a non-object in /home/crazepur/public_html/admin/controller/catalog/product.php on line 78
and
Fatal error: Call to a member function deleteProduct() on a non-object in /home/crazepur/public_html/admin/controller/catalog/product.php on line 133 respectively.
Although it edit and delete the product.
Please help me how to fix it.
Code in Line 78 $this->openbay->productUpdateListen($this->request->get['product_id'], $this->request->post);
And code in line 133 $this->openbay->deleteProduct($product_id);
This means $this->openbay is not an object which contains function productUpdateListen() & deleteProduct(), probably it's NULL or false in some cases (nothing found) due to it's not accessible. Out of scope.
Try
var_dump($this->openbay);
Check the O/P
it's simple and the error-message says it all: your $this->openbay doesn't have those methods (productUpdateListen() and deleteProduct()) - most likely it isn't an object at all.
please debug your code since it's impossible to say what's going wrong wich so little information. to start, do a var_dump($this->openbay); right before the function-calls and check the output.
I have taken over a website to complete.
The website works fine.
for some reason I get the following error:
Fatal error: Call to a member function navigate() on a non-object in C:\xampp\htdocs\studio.php on line 224
This is the code for the page at line 224:
if(!empty($_GET['nav']))
{
$params = null;
$params['listOrder'] = 'id desc';
$$_GET['nav']->navigate($params); <<<This is line 224
}
Any assistance will be greatly appreciated.
$$_GET['nav'] refers to an object dynamically, this object is not instanciated at the point of calling navigate(), or the variable passed to $_GET['nav'] does not correspond to a defined variable.
My problem has been resolved. after a strenuous search I found a phantom piece of code that was where it should not have been. Thank you all for your assistance. The code was:
$user = $_SESSION['usr'];