M
M
Maybe_V2016-07-12 23:44:51
PHP
Maybe_V, 2016-07-12 23:44:51

How to save data to a table through a model?

You need to save the change in the table (Magento Full Release - ver 1.9.2.4) through the model:

$product = Mage::getModel('catalog/product')
           ->load($id=1);

$product->setName('AU');
$product->save();
Но выбрасывает ошибку:

Warning: Invalid argument supplied for foreach()

But I don't use a loop anywhere!
How to fix this error?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Michael, 2016-07-12
@springimport

Yet there is.

I
imdeveloper, 2016-07-14
@link_web

First, not setName() but setData()
Here, the second arguments of this function should be an array key == role name in the database, value == value

C
CodeKeeper, 2016-07-14
@CodeKeeper

magento.stackexchange.com/questions/16328/magento-...
In short, you need to install the current store.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question