Magento, what could cause $model->load($id) to fail? - magento

I wrote a module for magento, and tested in my localhost. It was working like a charm.
But after uploading to a server, when I try to load a product with the following code:
$product = Mage::getModel('catalog/product')->load($id);
the code execution stops. No exception.log generated. no output to browser.
By outputing to system.log i was able to verify a correct id was being used, and there is a product with that id in the store.
this load method is used by the default catalog/product controllers and works, but its not working in my module.
edit:
I've debbuged and got it to output something to system.log.
2013-09-02T20:49:33+00:00 ERR (3): Recoverable Error: Argument 3 passed to Mage_Eav_Model_Entity_Abstract::_canUpdateAttribute() must be an array, null given, called in /home/next/public_html/app/code/core/Mage/Catalog/Model/Resource/Abstract.php on line 545 and defined in /home/next/public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 1254
2013-09-02T20:49:33+00:00 ERR (3): Warning: array_key_exists() [<a href='function.array-key-exists'>function.array-key-exists</a>]: The second argument should be either an array or an object in /home/next/public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 1256
I dont think that was originated in my module, since i uploaded it to a clean store and it was working like it should. That store has almost 15 modules installed and one of them is probably overriding something that shouldn't, or maybe the store owner changed something in original magento source code.
I recommended to disable module by module so he can discover what module is causing the problem and revert all possible changes in original source code, but i'm not sure if the store owner will be able to do that.
Isnt there any way i can test current magento installation to be sure my module will work with no conflict with other pre-installed modules??

PHP almost never "just stops" without producing an error. Temporarily edit index.php such that
ini_set('display_errors', 1);
and (or set the MAGE_IS_DEVELOPER_MODE flag to true in your web server)
if (true || isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
Mage::setIsDeveloperMode(true);
}
Additionally, check your php error log for any error produced when you run your code.

Related

Prestashop 1.7.6.5 not taking into account php module modifications

I've been modifying a module and for some reason prestashop does not take into consideration the code modifications in module.php.
I've made modifications a while back and I need to modify it again due to an update that raises an error, the problem is that I get the error even if I remove said line.
I get this type of error: PHP message: PHP Notice: Undefined index: ordersorderFilter!active in /modules/module/module.php on line 104
I've commented first than removed that line but I still get the error.
It seems like there is a cache somewhere that I can't find, I've deactivated all possible cache in prestashop, activated debug mode, deleted the dev and prod folders in /var/cache/ but I still get the error.
I've used grep on the server to try to find that line, and when I delete it from the file I can not find it anywhere else on the server (but can find it if I add it).
Anybody has any idea?
Thanks a lot!
Prestashop does not perform any kind of caching on the modules PHP files so the problem lies elsewhere or at "lower level" (webserver / proxy ie.).
So check your environment for server-side caching, proxies or PHP accelerators such as opCache that may not serve changes from the source server.
Also try renaming or deleting the offending file altogether and see if the error changes, if not you might simply be looking at the wrong file :)

How to save FormView file in Odoo 10 after get an error

Do anyone known how to revert my mistake? it is normal don't be allowed to save this file?
this is the file that I can't save it, please see line 21
I was use the developing mode in Odoo 10 when I editing product.template.product.form file with Formview option, when I miss < in my sentence and I saved. I made this syntax mistake in line 21 field name="x_season"/> sentence. After that I trying to reedit again and again, stop servers, start server, log in, log out, etc... but when I try to save I can't. Why ????
TypeError
**Odoo Client Error
TypeError: undefined is not an object (evaluating 'field.attrs.name')
http://localhost:8080/web/static/src/js/views/list_view.js:381
If you made a mistake modifying a view in the developer mode, you only have to restart the Odoo service updating the module which generated the views you modified. I guess in your case you have to update the views of the module product. To do that, in console:
python /your-odoo-path/odoo-bin -c /your-config-file-path/.odoo.conf -d your-database-name -u product
It will restore the XML code and remove the developer mode modifications in product module view.

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.

Fatal error: Class 'Mage_Sales_Model_Order' not found in ....core/Mage/Reports/Model/Resource/Order/Collection.php on line 456

I was installing magento 1.9.1 on my server everything went fine but after installation when i click on Go to Backend and give my username and password to login to Admin Panel it gives the following error:
Fatal error: Class 'Mage_Sales_Model_Order' not found in
/home2/siatel/public_html/4ebay/app/code/core/Mage/Reports/Model/Resource/Order/Collection.php
on line 456
Though my frontend side of website is working perfectly ... Please help.
I can see my admin log-in page. Error comes only when I give username and pass and hit continue...
Without more information, it sounds like you're missing your
app/code/core/Mage/Sales/Model/Order.php
file. It seems like you're missing a lot of different files as well. I'd diff your installation vs. the contents of a standard tar archive.
Your error shows like this
Fatal error: Class 'Mage_Shipping_Helper_Data' not found in
/home2/siatel/public_html/4ebay/app/Mage.php on line 547
see the portion 'Mage_Shipping_Helper_Data' not found. It means Magento is looking for a helper class file and it couldnt find it. Magento will look for this file in app/code/core/Mage/Shipping/Helper/Data.php.
I will give you some hint on how this file path came from. First of all magento core files lies in the location app/code/core/. Then missing class name (in this case Mage_Shipping_Helper_Data) will converted as Mage/Shipping/Helper/Data.php. Then this will append to the core codePool directory path. That is app/code/core/Mage/Shipping/Helper/Data.php
For every file, magento assigns path as like this. Please note that, you need to attach .php part to the last keyword. Also you need to copy the exact same data of that file (take into consider the version). It means it need to have a 'Magento way' class name and so on

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.

Resources