Magento model collections - save data - magento

So I'm loading a collection of products using this code:
$magento_time= 'some time string';
$collection = Mage::getModel('catalog/product')->getCollection();
$collection->addFieldToFilter(array(
array('attribute'=> 'updated_at', 'gt'=> date('Y-m-d H:i:s', strtotime($magento_time))),
));
$collection->save();
And getting this error in return on save:
Warning: Invalid argument supplied for foreach() in /var/www/magento/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 970
#0 /var/www/magento/app/code/core/Mage/Eav/Model/Entity/Abstract.php(970): mageCoreErrorHandler(2, 'Invalid argumen...', '/var/www/magent...', 970, Array)
#1 /var/www/magento/app/code/core/Mage/Eav/Model/Entity/Abstract.php(925): Mage_Eav_Model_Entity_Abstract->_collectSaveData(Object(Mage_Catalog_Model_Product))
#2 /var/www/magento/app/code/core/Mage/Core/Model/Abstract.php(251): Mage_Eav_Model_Entity_Abstract->save(Object(Mage_Catalog_Model_Product))
#3 /var/www/magento/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(845): Mage_Core_Model_Abstract->save()
#4 /var/www/magento/app/code/local/MyModule/controllers/IndexController.php(16): Mage_Eav_Model_Entity_Collection_Abstract->save()
#5 /var/www/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(376): MyModule_IndexController->sayHelloAction()
#6 /var/www/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(248): Mage_Core_Controller_Varien_Action->dispatch('sayHello')
#7 /var/www/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(158): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#8 /var/www/magento/app/Mage.php(459): Mage_Core_Controller_Varien_Front->dispatch()
#9 /var/www/magento/index.php(68): Mage::run()
#10 {main}
How do I save products back to the database after they've been loaded into a collection?

Changing the following worked for me:
Manually set the current store:
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
Save each collection independently.
foreach ($collection as $entry) {
$entry->save();
}
EDIT:
Note the Magento API has changed significantly since I first asked this question ~2.5 years ago - this answer may no longer apply.

You do a foreach and save elements one by one.

Related

Set product attribute value in magento errors

I'm writing an importer that creates new attribute (which works) and now I want to set different attribute values for different products, without using attribute sets. A method that seems to work for a lot of people seems to be the following:
Mage::getSingleton('catalog/product_action')
->updateAttributes([$id], ['color'=>'red'], self::STORE_ID);
Sadly this errors for me:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'attribute_id' in 'where clause'' in /vagrant/htdocs/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /vagrant/htdocs/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /vagrant/htdocs/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /vagrant/htdocs/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /vagrant/htdocs/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#4 /vagrant/htdocs/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('DELETE FROM `ca...', Array)
#5 /vagrant/htdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('DELETE FROM `ca...', Array)
#6 /vagrant/htdocs/lib/Zend/Db/Adapter/Abstract.php(664): Varien_Db_Adapter_Pdo_Mysql->query('DELETE FROM `ca...')
#7 /vagrant/htdocs/app/code/core/Mage/Catalog/Model/Resource/Abstract.p in /vagrant/htdocs/lib/Zend/Db/Statement/Pdo.php on line 235
Is there a better method or am I just doing something wrong?
In order to save attribute values for product, you have to load product object first then set attribute values.. See the example below:
$id = 102; // Your product id
$product = Mage::getModel("catalog/product")->load($id);
$product->setStatus(1);
$product->setColor("red");
$product->save();
As I have learned a very good and performant way is to work with the Resource model:
$product = Mage::getModel('catalog/product');
$product->setId($productId);
$product->setStoreId($storeId);
$product->setColor('red');
// or
// $product->setDataUsingMethod('color', 'red')
$resource = Mage::getResourceModel('catalog/product');
$resource->saveAttribute($product, 'color');

Magento error: Invalid backend model specified: customer_entity/address_attribute_backend_region

After updating my magento instance from 1.4.0 to 1.7.0.2 I've got the following error:
Invalid backend model specified: customer_entity/address_attribute_backend_region
The error occurs during the checkout process while the customer is selecting the adress from drop-down list and press the "continue" button.
A AJAX-request to /checkout/onepage/saveBilling/ fails, the second request to checkout/onepage/getAdditional responses. The customer will be redirected to the cart overview page, but content the failed ajax response displays an error report number, which can be looked up at with FTP in the folder var/reports/####reportnumber###.log
EDIT: Stack trace
a:5:{i:0;s:81:"Invalid backend model specified: customer_entity/address_attribute_backend_region";i:1;s:1907:"#0 /home/www/p10000/html/magento/app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php(346): Mage::exception('Mage_Eav', 'Invalid backend...')
#1 /home/www/p10000/html/magento/app/code/core/Mage/Eav/Model/Entity/Abstract.php(1094): Mage_Eav_Model_Entity_Attribute_Abstract->getBackend()
#2 /home/www/p10000/html/magento/app/code/core/Mage/Eav/Model/Entity/Abstract.php(998): Mage_Eav_Model_Entity_Abstract->_setAttributeValue(Object(Mage_Customer_Model_Address), Array)
#3 /home/www/p10000/html/magento/app/code/core/Mage/Eav/Model/Entity/Abstract.php(959): Mage_Eav_Model_Entity_Abstract->_loadModelAttributes(Object(Mage_Customer_Model_Address))
#4 /home/www/p10000/html/magento/app/code/core/Mage/Core/Model/Abstract.php(225): Mage_Eav_Model_Entity_Abstract->load(Object(Mage_Customer_Model_Address), '209', NULL)
#5 /home/www/p10000/html/magento/app/code/core/Mage/Checkout/Model/Type/Onepage.php(246): Mage_Core_Model_Abstract->load('209')
#6 /home/www/p10000/html/magento/app/code/core/Mage/Checkout/controllers/OnepageController.php(320): Mage_Checkout_Model_Type_Onepage->saveBilling(Array, '209')
#7 /home/www/p10000/html/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Checkout_OnepageController->saveBillingAction()
#8 /home/www/p10000/html/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('saveBilling')
#9 /home/www/p10000/html/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#10 /home/www/p10000/html/magento/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#11 /home/www/p10000/html/magento/app/Mage.php(686): Mage_Core_Model_App->run(Array)
#12 /home/www/p10000/html/magento/index.php(101): Mage::run('', 'store')
#13 {main}";s:3:"url";s:60:"/magento/index.php/checkout/onepage/saveBilling/";s:11:"script_name";s:18:"/magento/index.php";s:4:"skin";s:11:"german";}
I found this topic: http://www.magentocommerce.com/boards/viewthread/261499/#t350593
So I created this statement (the first two lines I found at learningmagento.com, but they are incomplete and leads into a total break of the onepage/saveBilling-Page, if you don't change the source model, too.
UPDATE `eav_attribute` SET `backend_model` = 'customer/entity_address_attribute_backend_street' WHERE `attribute_code` ='street' LIMIT 1 ;
UPDATE `eav_attribute` SET `backend_model` = 'customer/entity_address_attribute_backend_region' WHERE `attribute_code` ='region' LIMIT 1 ;
UPDATE `eav_attribute` SET `source_model` = 'customer/entity_address_attribute_source_country' WHERE `source_model` = 'customer_entity/address_attribute_source_country' LIMIT 1 ;
UPDATE `eav_attribute` SET `source_model` = 'customer/entity_address_attribute_source_region' WHERE `source_model` ='customer_entity/address_attribute_source_region' LIMIT 1 ;
It worked for me. The AJAX request responses with a validation error for the phone number in my case, but this can be solved easily.
The "customer_entity/..." can be also found in the table "eav_entity_type", but in my case it was (not yet) necessary to change the value.

Can't login to Magento backend 'No region found within the locale 'de''

i have moved a Magento installation from a preview system to my local machine for developing and testing.
i have setup the BASE URL to my V-Host in the database.
The frontend works but i cant get into the admin panel.
if i log in, i got the following error message:
No region found within the locale 'de'
Trace:
#0 /var/www/myProjectName/lib/Zend/Currency.php(101): Zend_Currency->setLocale(NULL)
#1 /var/www/myProjectName/app/code/core/Mage/Core/Model/Locale.php(575): Zend_Currency->__construct('USD', NULL)
#2 /var/www/myProjectName/app/code/core/Mage/Directory/Model/Currency.php(233): Mage_Core_Model_Locale->currency('EUR')
#3 /var/www/myProjectName/app/code/core/Mage/Directory/Model/Currency.php(216): Mage_Directory_Model_Currency->formatTxt(NULL, Array)
#4 /var/www/myProjectName/app/code/core/Mage/Directory/Model/Currency.php(197): Mage_Directory_Model_Currency->formatPrecision(NULL, 2, Array, true, false)
#5 /var/www/myProjectName/app/code/core/Mage/Adminhtml/Block/Dashboard/Bar.php(82): Mage_Directory_Model_Currency->format(NULL)
#6 /var/www/myProjectName/app/code/core/Mage/Adminhtml/Block/Dashboard/Bar.php(62): Mage_Adminhtml_Block_Dashboard_Bar->format(NULL)
#7 /var/www/myProjectName/app/code/core/Mage/Adminhtml/Block/Dashboard/Totals.php(74): Mage_Adminhtml_Block_Dashboard_Bar->addTotal('Revenue', NULL)
#8 /var/www/myProjectName/app/code/core/Mage/Core/Block/Abstract.php(238): Mage_Adminhtml_Block_Dashboard_Totals->_prepareLayout()
#9 /var/www/myProjectName/app/code/core/Mage/Core/Model/Layout.php(456): Mage_Core_Block_Abstract->setLayout(Object(Mage_Core_Model_Layout))
#10 /var/www/myProjectName/app/code/core/Mage/Adminhtml/Block/Dashboard.php(50): Mage_Core_Model_Layout->createBlock('adminhtml/dashb...')
#11 /var/www/myProjectName/app/code/core/Mage/Core/Block/Abstract.php(238): Mage_Adminhtml_Block_Dashboard->_prepareLayout()
#12 /var/www/myProjectName/app/code/core/Mage/Core/Model/Layout.php(456): Mage_Core_Block_Abstract->setLayout(Object(Mage_Core_Model_Layout))
#13 /var/www/myProjectName/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('adminhtml/dashb...', 'dashboard')
#14 /var/www/myProjectName/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('adminhtml/dashb...', 'dashboard')
#15 /var/www/myProjectName/app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#16 /var/www/myProjectName/app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#17 /var/www/myProjectName/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#18 /var/www/myProjectName/app/code/core/Mage/Core/Controller/Varien/Action.php(269): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#19 /var/www/myProjectName/app/code/core/Mage/Adminhtml/Controller/Action.php(275): Mage_Core_Controller_Varien_Action->loadLayout(NULL, true, true)
#20 /var/www/myProjectName/app/code/core/Mage/Adminhtml/controllers/DashboardController.php(40): Mage_Adminhtml_Controller_Action->loadLayout()
#21 /var/www/myProjectName/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Adminhtml_DashboardController->indexAction()
#22 /var/www/myProjectName/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#23 /var/www/myProjectName/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#24 /var/www/myProjectName/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#25 /var/www/myProjectName/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#26 /var/www/myProjectName/index.php(87): Mage::run('', 'store')
#27 {main}
Can i set the region anywhere? everything i found with google cant help me out.
Just tell me what else you want to know.
I hope you can help me!
Thanks smo
So basically:
got to core_config_data in your database
and delete the line where path = general
I got the same problem but there was no "general" Config-Entry without any other path and content, so i need to debug the problem a bit deeper.
Btw - you can search the config-entry like this:
SELECT * FROM core_config_data WHERE core_config_data.path = 'general';
To me, it seems to be a Firefox-only Problem and i think, its out of the language-setting from the browser. Its inside the Zend-currency-handling. Only Firefox has the problem - Chrome, Edge, Internet Explorer works well!
So i fixed the Magento-Code like that a bit dirty but it works:
Copy lib/Zend/Currency.php to app/code/local/Zend/Currency.php and edit this.
Now you can overwrite the Zend-Framework file.
Go to the following line at copied:
public function setLocale($locale = null)
#require_once 'Zend/Locale.php';
try {
$locale = Zend_Locale::findLocale($locale);
Add last Line:
public function setLocale($locale = null)
{
#require_once 'Zend/Locale.php';
try {
$locale = Zend_Locale::findLocale($locale);
if ( $locale == 'de' ) $locale = 'de_DE'; // zend fix the firefox-locale error
After that, you can edit the products again!
This Variant is also updateable out of the overwrite-code.
Hope that helps!
It happens that the locale is defined based on your browser locale detection. You can like or not this behavior but in this case that's the reason you have this error message.
To fix that you have to change the priority or switch the locale supported by your browser. What I mean by priority is that the browser provide a list of supported language. For example you may have something like that Accept-Language: da, en-gb;q=0.8, en;q=0.7
In your case it searches de but your browser doesn't support it. So you may use "Quick Locale" for firefox to switch to en-US or de-DE for example to prevent such errors if you use this one or something similar. It's not a but in Magento, it's a wanted behavior I think.

Unable to save description in products with magento

I got some problems when im trying to save product short and long description in backend.
whenever i try to change the description and press save, the text i have entered disappears and the textarea field is blank. This does not just only occur for the long and short description. The problem is for ALL textarea fields in the product edit page. I can change textarea fields in categories page and so on.
I have some PDO mysql error debug to show you..
SQL: SELECT `main_table`.`tax_calculation_rate_id`, `main_table`.`tax_calculation_rule_id`, `main_table`.`customer_tax_class_id`, `main_table`.`product_tax_class_id`, `rule`.`priority`, `rule`.`position`, `rate`.`rate` AS `value`, `rate`.`tax_country_id`, `rate`.`tax_region_id`, `rate`.`tax_postcode`, `rate`.`tax_calculation_rate_id`, `rate`.`code`, IF(title_table.value IS NULL, rate.code, title_table.value) AS `title` FROM `tax_calculation` AS `main_table`
INNER JOIN `tax_calculation_rule` AS `rule` ON `rule`.`tax_calculation_rule_id` = main_table.tax_calculation_rule_id
INNER JOIN `tax_calculation_rate` AS `rate` ON rate.tax_calculation_rate_id = main_table.tax_calculation_rate_id
LEFT JOIN `tax_calculation_rate_title` AS `title_table` ON rate.tax_calculation_rate_id = title_table.tax_calculation_rate_id AND title_table.store_id = '0' WHERE (customer_tax_class_id = 3) AND (product_tax_class_id IN ('7')) AND (rate.tax_country_id = 'SE') AND (rate.tax_region_id IN(0, 0)) AND (rate.zip_is_range IS NULL) AND (rate.tax_postcode IS NULL OR rate.tax_postcode IN('*', '', '', '*')) ORDER BY `priority` ASC, `tax_calculation_rule_id` ASC, `tax_country_id` DESC, `tax_region_id` DESC, `tax_postcode` DESC, `value` DESC
AFF: 1
TIME: 0.0006
TRACE: #1 Varien_Db_Adapter_Pdo_Mysql#0000000002b9780300000000842d8272#->_debugStat(2, 'SELECT `main_tab...', array(), &Varien_Db_Statement_Pdo_Mysql#0000000002b97a2500000000842d8272#) called at [lib/Varien/Db/Adapter/Pdo/ Mysql.php:424]
#2 Varien_Db_Adapter_Pdo_Mysql#0000000002b9780300000000842d8272#->query(&Varien_Db_Select#0000000002b97ac200000000842d8272#, array()) called at [lib/Zend/Db/Adapter/Abstract.php:734]
#3 Varien_Db_Adapter_Pdo_Mysql[Zend_Db_Adapter_Abstract]#0000000002b9780300000000842d8272#->fetchAll(&Varien_Db_Select#0000000002b97ac200000000842d8272#) called at [app/code/core/Mage/Tax/Model/Resource/Calculation. php:341]
#4 Mage_Tax_Model_Resource_Calculation#0000000002b97ab100000000842d8272#->_getRates(&Varien_Object#0000000002b97a8900000000842d8272#) called at [app/code/core/Mage/Tax/Model/Resource/Calculation.php:99]
#5 Mage_Tax_Model_Resource_Calculation#0000000002b97ab100000000842d8272#->getRateInfo(&Varien_Object#0000000002b97a8900000000842d8272#) called at [app/code/core/Mage/Tax/Model/Calculation.php:193]
#6 Mage_Tax_Model_Calculation#0000000002b97a8a00000000842d8272#->getRate(&Varien_Object#0000000002b97a8900000000842d8272#) called at [app/code/core/Mage/Tax/Model/Calculation.php:412]
#7 Mage_Tax_Model_Calculation#0000000002b97a8a00000000842d8272#->_getRates(&Varien_Object#0000000002b97a8900000000842d8272#, 'product_class_id', 'PRODUCT') called at [app/code/core/Mage/Tax/Model/Calculation.php:420]
#8 Mage_Tax_Model_Calculation#0000000002b97a8a00000000842d8272#->getRatesForAllProductTaxClasses(&Varien_Object#0000000002b97a8900000000842d8272#) called at [app/code/core/Mage/Tax/Helper/Data.php:392]
#9 ET_CurrencyManager_Helper_Tax[Mage_Tax_Helper_Data]#0000000002b97b3000000000842d8272#->_getAllRatesByProductClass(&ET_CurrencyManager_Model_Store#0000000002b9782300000000842d8272#) called at [app/code/core/Mage/Tax/ Helper/Data.php:376]
#10 ET_CurrencyManager_Helper_Tax[Mage_Tax_Helper_Data]#0000000002b97b3000000000842d8272#->getAllRatesByProductClass(&ET_CurrencyManager_Model_Store#0000000002b9782300000000842d8272#) called at [app/design/adminhtml/ default/default/template/catalog/product/js.phtml:45]
#11 include('/var/www/vb1/app...') called at [app/code/core/Mage/Core/Block/Template.php:241]
#12 Mage_Adminhtml_Block_Catalog_Product_Edit_Js[Mage_Core_Block_Template]#0000000002b97a6c00000000842d8272#->fetchView('adminhtml/defaul...') called at [app/code/core/Mage/Core/Block/Template.php:272]
#13 Mage_Adminhtml_Block_Catalog_Product_Edit_Js[Mage_Core_Block_Template]#0000000002b97a6c00000000842d8272#->renderView() called at [app/code/core/Mage/Core/Block/Template.php:286]
#14 Mage_Adminhtml_Block_Catalog_Product_Edit_Js[Mage_Core_Block_Template]#0000000002b97a6c00000000842d8272#->_toHtml() called at [app/code/core/Mage/Adminhtml/Block/Template.php:81]
#15 Mage_Adminhtml_Block_Catalog_Product_Edit_Js[Mage_Adminhtml_Block_Template]#0000000002b97a6c00000000842d8272#->_toHtml() called at [app/code/core/Mage/Core/Block/Abstract.php:863]
#16 Mage_Adminhtml_Block_Catalog_Product_Edit_Js[Mage_Core_Block_Abstract]#0000000002b97a6c00000000842d8272#->toHtml() called at [app/code/core/Mage/Core/Block/Text/List.php:43]
#17 Mage_Core_Block_Text_List#0000000002b97b0000000000842d8272#->_toHtml() called at [app/code/core/Mage/Core/Block/Abstract.php:863]
#18 Mage_Core_Block_Text_List[Mage_Core_Block_Abstract]#0000000002b97b0000000000842d8272#->toHtml() called at [app/code/core/Mage/Core/Block/Abstract.php:582]
#19 Mage_Adminhtml_Block_Page[Mage_Core_Block_Abstract]#0000000002b97b3b00000000842d8272#->_getChildHtml('js', true) called at [app/code/core/Mage/Core/Block/Abstract.php:526]
#20 Mage_Adminhtml_Block_Page[Mage_Core_Block_Abstract]#0000000002b97b3b00000000842d8272#->getChildHtml('js') called at [app/design/adminhtml/default/default/template/page.phtml:82]
#21 include('/var/www/vb1/app...') called at [app/code/core/Mage/Core/Block/Template.php:241]
#22 Mage_Adminhtml_Block_Page[Mage_Core_Block_Template]#0000000002b97b3b00000000842d8272#->fetchView('adminhtml/defaul...') called at [app/code/core/Mage/Core/Block/Template.php:272]
#23 Mage_Adminhtml_Block_Page[Mage_Core_Block_Template]#0000000002b97b3b00000000842d8272#->renderView() called at [app/code/core/Mage/Core/Block/Template.php:286]
#24 Mage_Adminhtml_Block_Page[Mage_Core_Block_Template]#0000000002b97b3b00000000842d8272#->_toHtml() called at [app/code/core/Mage/Adminhtml/Block/Template.php:81]
#25 Mage_Adminhtml_Block_Page[Mage_Adminhtml_Block_Template]#0000000002b97b3b00000000842d8272#->_toHtml() called at [app/code/core/Mage/Core/Block/Abstract.php:863]
#26 Mage_Adminhtml_Block_Page[Mage_Core_Block_Abstract]#0000000002b97b3b00000000842d8272#->toHtml() called at [app/code/core/Mage/Core/Model/Layout.php:555]
#27 Mage_Core_Model_Layout#0000000002b9783e00000000842d8272#->getOutput() called at [app/code/core/Mage/Core/Controller/Varien/Action.php:390]
#28 Mage_Adminhtml_Catalog_ProductController[Mage_Core_Controller_Varien_Action]#0000000002b978af00000000842d8272#->renderLayout() called at [app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php:269]
#29 Mage_Adminhtml_Catalog_ProductController#0000000002b978af00000000842d8272#->editAction() called at [app/code/core/Mage/Core/Controller/Varien/Action.php:419]
#30 Mage_Adminhtml_Catalog_ProductController[Mage_Core_Controller_Varien_Action]#0000000002b978af00000000842d8272#->dispatch('edit') called at [app/code/core/Mage/Core/Controller/Varien/Router/Standard.php:250]
#31 Mage_Core_Controller_Varien_Router_Admin[Mage_Core_Controller_Varien_Router_Standard]#0000000002b9785400000000842d8272#->match(&Mage_Core_Controller_Request_Http#0000000002b9782000000000842d8272#) called at [app/code/ core/Mage/Core/Controller/Varien/Front.php:176]
#32 Mage_Core_Controller_Varien_Front#0000000002b9784a00000000842d8272#->dispatch() called at [app/code/core/Mage/Core/Model/App.php:354]
#33 Mage_Core_Model_App#0000000002b9781400000000842d8272#->run(array('scope_code' => '', 'scope_type' => 'store', 'options' => array())) called at [app/Mage.php:683]
#34 Mage::run('', 'store') called at [index.php:87]
UPDATE:
This problem started when we changed FCK editor to TinyMCE editor. I have also tried to reinstall fck and mce and no luck there.
First disable all extensions to make sure thats not the problem. It usually is. And disable it from System>Config>Advanced.
If that doesnt change anything, check your tax rules, rates and classes in Sales>Tax. Remove them all as you may have delete, and created a rule and maybe its a conflict.
Also, did you make any custom attributes related to tax or anything?
One last thing, based on your update. Go to System>Configuration>Content Management> and disable the wysiwyg editor.Try to update and save then.
Good luck

Programmatic Setting of Item's setSpecialPrice Doesn't Stick

I'm trying to programmaticly add an item to the visitor's shopping cart. In the process, the item is given a custom price. On the page initially displayed after item addition, the "My Cart" summary (in the right column) indicates that the cart contains an item with the correct price. However, when I go to the view cart page, the item is listed with its default price (instead of the custom price).
How do I make the custom price stick?
Thank you,
Ben
Here's the code:
$product = Mage::getModel('catalog/product');
$product->load(169);
$product->setSpecialPrice(10);
$cart = Mage::getSingleton('checkout/cart');
$cart->addProduct($product, array('qty' => 1, 'options' => array(5 => 'spec goes here' . time())));
$cart->save();
I tried calling $product->save() after $product->setSpecialPrice() but that resulted in:
Warning: Invalid argument supplied for foreach() in app\code\core\Mage\Eav\Model\Entity\Abstract.php on line 1068
#0 app\code\core\Mage\Eav\Model\Entity\Abstract.php(1068): mageCoreErrorHandler(2, 'Invalid argumen...', 'C:\Program File...', 1068, Array)
#1 app\code\core\Mage\Eav\Model\Entity\Abstract.php(1012): Mage_Eav_Model_Entity_Abstract->_collectSaveData(Object(Mage_Catalog_Model_Product))
#2 app\code\core\Mage\Core\Model\Abstract.php(318): Mage_Eav_Model_Entity_Abstract->save(Object(Mage_Catalog_Model_Product))
#3 app\code\local\BenGribaudo\RazaOrderGrid\controllers\IndexController.php(13): Mage_Core_Model_Abstract->save()
#4 app\code\core\Mage\Core\Controller\Varien\Action.php(418): BenGribaudo_RazaOrderGrid_IndexController->addAction()
#5 app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(253): Mage_Core_Controller_Varien_Action->dispatch('add')
#6 app\code\core\Mage\Core\Controller\Varien\Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#7 app\code\core\Mage\Core\Model\App.php(340): Mage_Core_Controller_Varien_Front->dispatch()
#8 app\Mage.php(627): Mage_Core_Model_App->run(Array)
#9 index.php(80): Mage::run('', 'store')
#10 {main}
Set Special Price Programatically In Magento

Resources