Magento can't save new products anymore - magento

Everything was fine 'til this morning. I've tried clearing cache, re indexing, all tips I could find on the internet.
Here is the message I'm getting
Fatal error: Call to a member function getId() on a non-object in /home5/rockbott/public_html/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php on line 578
here is line 577 and 578:
if (Mage::app()->isSingleStoreMode()) {
$product->setWebsiteIds(array(Mage::app()->getStore(true)->getWebsite()->getId()));
A newly created product gives me Fatal Error message. Duplicated product gives me the same, but when I go to manage products it appears, but without SKU# and 0 stock count. When I try to edit that product again - I get Fatal Error.
Please help me with my problem.
Thanks in advance.
Thanks for your response.
Someone suggested that I clear log file and I did. I'm sorry I don't have the log file. Compiler is disabled as well. Would you be kind enough to take a look here: http://www.magentocommerce.com/boards/viewthread/347764/ I've posted more information there including reports.
Thank you
Anna

I realize this is old, but on a Magento 1.9.0.1 install i was having the same problem. I'm not sure what is happening but enabling the cache allowed it to work for me. Weird.

What appears to be causing it in my case is a remnant logging line in Mage.php that I was using to track events.
On line 447 I had:
Mage::log($name, null, 'events.log');
Removing this logging line resolved the issue.

With your informations is difficult to find the problem.
Can you paste your system.log file?
One question: Do you have the compiler enabled? Try to disable it.

I had the same error. Solution turned out to be very simple: you need to replace getStore(true) to getStore(1).
Its very strange because in PHP true same as 1 ... but in this it was a mistake. If you make a "more correct" and write:
$product->setWebsiteIds(array(Mage::app()->getStore(Mage::app()->getStore()->getId())->getWebsite()->getId()));
Magento give you not true website. Was too lazy to look for, as well as programmers Magento (getStore (true)) :)) so I decided to leave it

Related

Call to undefined method DateTime::getTimezone()

For some reason most of my pages are giving this error "Call to undefined method DateTime::getTimezone()". I'm kind of positive that the pages that have this error got a ->created_at->diffForHumans() function. I still have no idea whats causing this.. It has been working fine since forever.
I tried updating my packages but there was no luck there.. Searched around for the function itself or inside my controllers.. also no luck. Checked my time zone in config/app.php and it had the same time zone that I've always had which is Asia/Amman
Check this discussion please:
https://github.com/laravel/framework/issues/24886
As it say there:
This issue is closed as it is not an issue with Laravel; it was an
issue with the PHP docs at the time, which have since been updated. I
would suggest you review your own code and make sure it's not a
namespace problem (i.e. use new \DateTime instead of new DateTime) and
if you still can't figure it out, post a question on StackOverflow
with the minimum amount of code needed to reproduce the error.
Edit:
Since this was after a Composer update, I would guess that the problem
lies with one of the packages that were updated. The error message
should give you the exact line number producing the error, which
should help you determine what package is causing the error. Then file
a bug report (or pull request) against that package if possible.
I hope it helps.
I kept changing the php version and it eventually worked. It was 7.1.22 and I changed it to 7.2.* and it worked just fine...

Magento cant make an order

I have an installation of Magento 1.9.2. I am using a custom theme, and anytime I try and place an order it kicks off the Ajax on the page and then stops with no error messages, but does leave a log:
ERR (3): User Error: Some transactions have not been committed or rolled back in /html/lib/Varien/Db/Adapter/Pdo/Mysql.php on line 4039
I have spent 2 days trying to get to the bottom of this with no joy. It doesn't matter what payment method I use its always the same.
You should try to log all MySQL queries to see what wrong here. lib/Varien/Db/Adapter/Pdo/Mysql.
Open the file lib/Varien/Db/Adapter/Pdo/Mysql.php and change the value of the protected property $_debug to true. You can also change the value of $_logQueryTime which is especially handy when debugging slowdowns. Once you make this change all queries will be logged in the file var/debug/pdo_mysql.log
Hope this will help you. Please put your corrupted query here if you fixed it.
I had today the same problem. Magento 1.9.2.4 with a custom theme. Everything worked fine, expect the checkout-process. The custom theme used the PHP short open tag <? php code ?> . After enabling short_open_tag in the php.ini, everything works fine.

Error loading in Magento admin

When I load my Magento admin I get the error.
Fatal error: Call to a member function isLoggedIn() on a non-object
in /home/xxx/public_html/app/code/community/TM/Core/Model/Observer.php
on line 12
I think it happened when I replaced some files somewhere in app/code/...
I’m really stuck on this and need desperate help.
Error is in your extension file TM/Core/Model/Observer.php
Disable extension and check after refresh cache
This was fixed by the Full Page Cache Extension people.
I don't know what they did but it was their extension which broke my magento however they fixed it for me right away

I can't enable or disable modules. I'm getting "An error occurred while saving this configuration"

I have a new fairly fresh install of Magento 1.7.0.2. I installed two custom payment method modules that are working fine. But now whenever I try to disable or enable any Payment Method or Shipping Method it gives me an error like this:
An error occurred while saving this configuration: Warning:
preg_match() expects parameter 2 to be string, array given in
/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Encrypted.php
on line 57
Do you have any idea why?
EDIT 2:
I found the problem. It was caused by a patch I applied to fix to a previous BUG. :P
EDIT:
So I disabled all custom modules and I was still getting the same error. I logged what was happening and it seems that some core modules are sending an array to be saved.
Like PayPal Express Checkout for instance. One of the config options is the Time of Day in the SFTP credentials for Settlement Report Settings. It's composed by three different drop-downs and it's sending an array to be saved!
In the Shipping Methods, UPS has a config options called Allowed Methods, and it's also sending an array!
I still don't know why it wasn't happening before and now it is. They shouldn't be encrypting everything. Any clues?
I had the same issue, its a known bug, try this around line no. 135 on code/core/mage/Adminhtml/model/config/data.php
// add this code
$backendClass=false;
if (isset($fieldConfig->backend_model)) {
$backendClass = $fieldConfig->backend_model;
} // before this
if (!$backendClass) {
$backendClass = 'core/config_data';
}
This actually is a reported bug in Magento that seems to affect encrypted config settings (passwords, API keys, etc.).
http://www.magentocommerce.com/bug-tracking/issue?issue=14217
Try disabling the first of the modules, log out of the admin panel, clear /var/cache and see if the problem still exists. If it does, do the same with the second module.
The problem should be gone. Now that you know which module causes the problems you can either decide to try another module instead or debug to see whats going wrong.
Put a breakpoint on line 57 in /app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Encrypted.php to see what goes wrong. It seems that the second parameter is not a string (might be null for example due to wrong configuration or something) when its given to the preg_match function. Maybe this helps you to identify the problem.
Regards
Disabling modules through the back office isn't a good idea as it only disables the block output, if you would like to disable a module you should go to app/etc/modulesand there you should find Module_Name.xmlfile - in this file just put false in active node.

Magento doesn't save my catalog_product_set, what can I do?

I 've installed magento and it seems to work, but if I want to save a new Catalog_product_set with different attributes then I get Internal Error Message with Status Code 500
Does anyone have the same problem?
Thanks in advance
cheers tabaluga
Your screenshot (and from the looks of it Magento's error page) clips the edge of the error off. Seeing the rest of the error message might be important. Regardless, it looks like Magento is trying to load a config file w/ simplexml, and cannot find that file.

Resources