Magento error when I try to add special price from admin

我们两清 提交于 2019-12-21 05:29:21

问题


The error I get is: Invalid backend model specified: catalog/product_attribute_backend_startdate_specialprice

This is a local copy of magento but I would not want to have to recreate the entire thing on the live site..any ideas on what I can do to fix this?


回答1:


The above solution didn't work in my case as I didn't develop any module therefore couldn't find any file named "specialprice" in the above mentioned path.

I have installed a module and it changed the "specialprice" backend path in the database to catalog/product_attribute_backend_startdate_specialprice

Here is the solution if you stuck in the same problem like me:

Run the DB query to check the value of specialprice attribute i.e.

SELECT * FROM `<database-name>`.`eav_attribute`
WHERE (
`attribute_id` LIKE '%special_price%'
OR `entity_type_id` LIKE '%special_price%'
OR `attribute_code` LIKE '%special_special_price%'
OR `attribute_model` LIKE '%special_price%'
OR `backend_model` LIKE '%special_price%'
OR `backend_type` LIKE '%special_price%'
OR `backend_table` LIKE '%special_price%'
OR `frontend_model` LIKE '%special_price%'
OR `frontend_input` LIKE '%special_price%'
OR `frontend_label` LIKE '%special_price%'
OR `frontend_class` LIKE '%special_price%'
OR `source_model` LIKE '%special_price%'
OR `is_required` LIKE '%special_price%'
OR `is_user_defined` LIKE '%special_price%'
OR `default_value` LIKE '%special_price%'
OR `is_unique` LIKE '%special_price%'
OR `note` LIKE '%special_price%'
);

NOTE: Replace <database-name> with your magento DB.

You will find three rows in the database. Navigate to the column named as "Backend_model" and then you will see one of the entry written as

catalog/product_attribute_backend_startdate_specialprice

So, change the above entry to

catalog/product_attribute_backend_startdate

Save the database and then refresh the page on the magento frontend/backend (create and save a new product).

I hope everything is working fine. Good Luck!

Cheers, Naveed.

PS: Thanks to all who helps others to learn.




回答2:


Open phpMyadmin

From your magento db

select the eav_attribute table

where the row which has the backend_model of:

'catalog/product_attribute_backend_startdate_specialprice'

Try this in the SQL tab in phpMyadmin:

SELECT * FROM `magentodbname`.`eav_attribute` WHERE `backend_model` = 'catalog/product_attribute_backend_startdate_specialprice'

Change the backend model to:

'eav/entity_attribute_backend_datetime'




回答3:


While the other answers give workarounds (Replace backend model catalog/product_attribute_backend_startdate_specialprice with catalog/product_attribute_backend_startdate in the eav_attribute table), nobody explained yet, why this happened.

The backend model catalog/product_attribute_backend_startdate_specialprice was introduced in Magento 1.9, so this error occurs when you run Magento 1.8 or older on a database that already has been updated to 1.9.

Probably you updated Magento and then reverted the code back to the previous version. Unfortunately at this point the update scripts for the database already ran and there is no rollback mechanism.




回答4:


The backend model in defautl Magento is

catalog/product_attribute_backend_startdate

located at

app\code\core\Mage\Catalog\Model\Product\Attribute\Backend\Startdate.php

If you are working with your custom module and the backend model specified is

catalog/product_attribute_backend_startdate_specialprice

then you need to create path something like this

\Catalog\Model\Product\Attribute\Backend\Startdate\Specialprice.php

Change the local/community path as required.




回答5:


Run the below query :

UPDATE eav_attribute 
    SET backend_model = 'eav/entity_attribute_backend_datetime' 
    WHERE backend_model = 'catalog/product_attribute_backend_startdate_specialprice';


来源:https://stackoverflow.com/questions/23745888/magento-error-when-i-try-to-add-special-price-from-admin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!