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').
Related
The php file that I have has been starting to act up lately. It has been working for years up until just a month ago. I have looked everywhere and can not find anything that will fix this issue.
In the screenshot its the line that is circled that is throwing the error of
Fatal Error: Call to a member function format() on non-object in .....php.
So if I change it
$recent_hire_date = date_format($employee['STRTDATE'],'Ymd');
I then later have to move down further in the PHP file and update each one that is like the one in circled line. However, when I run this php file (it generates a file), When looking at the data in the file it actually only shows 0 it does not show the correct data.
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 have created custom shipping module and gets following error:
Fatal error: Call to a member function setStore() on a non-object in /home/devjoand/public_html/includes/src/Mage_Shipping_Model_Shipping.php on line 421
I removed all files including .xml for this shipping module and it still gives me the same error. It doesn't send me to shipping method and stops execution from savebilling controller with above error. I have cleared cache/session and recompile but nothing works. Any help would be appreciated. Thanks in advance!
NOTE: It works fine in my local machine but not working on production server.
As described partially in the comments, the error comes from this code:
$obj = Mage::getModel($className);
if ($storeId) {
$obj->setStore($storeId);
}
In the code above $obj is set to null.
You stated that your removed a shipping carrier.
I think the problem appears because you didn't deactivate first the carrier.
So in the config table the carrier appears to be enabled but there is no model associated to it so the code above fails.
In order to fix this, look in the table core_config_data for a record with this path column: carriers/CARRIER_CODE_HERE/active, where CARRIER_CODE_HERE is the code of the shipping method you just removed.
When you find the line, remove it. Actually remove everything that has a path like carriers/CARRIER_CODE_HERE/%.
be sure to backup your database first in case I'm wrong.
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.
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?