Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception on add reserved catalog product attribute #2875

Merged

Conversation

AGelzer
Copy link
Contributor

@AGelzer AGelzer commented Jan 1, 2023

Description (*)

This Pull Request fix the white page/exception on add reserved catalog product attributes.

Exception:
Call to a member function getEntityTypeCode on null in app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Main/Abstract.php:154

Fix: add entity_type to $data before Exception occurs.

Manual testing scenarios (*)

  1. Go to Backend -> Catalog -> Attributes -> Manage Attributes
  2. Add new Attribute with Attribute Code: position
  3. Error Message: The attribute code 'position' is reserved by system. Please try another attribute code

Questions or comments

Reserved catalog product attributes codes
position 
store_id 
resource_collection 
url_model 
name 
price 
type_id 
status 
type_instance 
link_instance 
id_by_sku 
category_id 
category 
category_ids 
category_collection 
website_ids 
store_ids 
attributes 
price_model 
group_price 
tier_price 
tier_price_count 
formated_tier_price 
formated_price 
final_price 
calculated_final_price 
minimal_price 
special_price 
special_from_date 
special_to_date 
related_products 
related_product_ids 
related_product_collection 
related_link_collection 
up_sell_products 
up_sell_product_ids 
up_sell_product_collection 
up_sell_link_collection 
cross_sell_products 
cross_sell_product_ids 
cross_sell_product_collection 
cross_sell_link_collection 
grouped_link_collection 
media_attributes 
media_gallery_images 
media_config 
visible_in_catalog_statuses 
visible_statuses 
visible_in_site_visibilities 
is_salable 
attribute_text 
custom_design_date 
product_url 
url_in_store 
url_path 
request_path 
gift_message_available 
rating_summary 
sku 
weight 
option_instance 
product_options_collection 
option_by_id 
options 
is_virtual 
custom_options 
custom_option 
available_in_categories 
default_attribute_set_id 
image_url 
small_image_url 
thumbnail_url 
reserved_attributes 
cache_id_tags_with_categories 
preconfigured_values 
product_entities_info 
event 
locked_attributes 
store 
website_store_ids 
attribute_default_value 
exists_store_value_flag 
id_field_name 
id 
resource_name 
collection 
cache_tags 
cache_id_tags 
resource 
entity_id 
data 
data_using_method 
data_set_default 
orig_data

*Attribute 'position' + Mage_Catalog_Model_Product Class get Methods
see \Mage_Catalog_Model_Product::getReservedAttributes

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)
  • Add yourself to contributors list

@github-actions github-actions bot added the Component: Adminhtml Relates to Mage_Adminhtml label Jan 1, 2023
@addison74
Copy link
Contributor

I confirm this issue. When I create a new attribute reserved by the system, after pressing the [Save] button, the page loads empty. The following error is written in the exception.log file

2023-01-01T12:33:17+00:00 ERR (3): 
Mage_Core_Exception: Invalid entity_type specified:  in /var/www/html/app/Mage.php:660
Stack trace:
#0 /var/www/html/app/code/core/Mage/Eav/Model/Config.php(327): Mage::throwException('Invalid entity_...')
#1 /var/www/html/app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php(388): Mage_Eav_Model_Config->getEntityType(NULL)
#2 /var/www/html/app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Main/Abstract.php(154): Mage_Eav_Model_Entity_Attribute_Abstract->getEntityType()
#3 /var/www/html/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php(38): Mage_Eav_Block_Adminhtml_Attribute_Edit_Main_Abstract->_prepareForm()
#4 /var/www/html/app/code/core/Mage/Adminhtml/Block/Widget/Form.php(138): Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Main->_prepareForm()
#5 /var/www/html/app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Main/Abstract.php(190): Mage_Adminhtml_Block_Widget_Form->_beforeToHtml()
#6 /var/www/html/app/code/core/Mage/Core/Block/Abstract.php(931): Mage_Eav_Block_Adminhtml_Attribute_Edit_Main_Abstract->_beforeToHtml()
#7 /var/www/html/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tabs.php(44): Mage_Core_Block_Abstract->toHtml()
#8 /var/www/html/app/code/core/Mage/Core/Block/Abstract.php(931): Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tabs->_beforeToHtml()
#9 /var/www/html/app/code/core/Mage/Core/Block/Text/List.php(42): Mage_Core_Block_Abstract->toHtml()
#10 /var/www/html/app/code/core/Mage/Core/Block/Abstract.php(932): Mage_Core_Block_Text_List->_toHtml()
#11 /var/www/html/app/code/core/Mage/Core/Block/Abstract.php(650): Mage_Core_Block_Abstract->toHtml()
#12 /var/www/html/app/code/core/Mage/Core/Block/Abstract.php(594): Mage_Core_Block_Abstract->_getChildHtml('left', true)
#13 /var/www/html/app/design/adminhtml/default/default/template/page.phtml(53): Mage_Core_Block_Abstract->getChildHtml('left')
#14 /var/www/html/app/code/core/Mage/Core/Block/Template.php(257): include('/var/www/html/a...')
#15 /var/www/html/app/code/core/Mage/Core/Block/Template.php(291): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#16 /var/www/html/app/code/core/Mage/Core/Block/Template.php(304): Mage_Core_Block_Template->renderView()
#17 /var/www/html/app/code/core/Mage/Adminhtml/Block/Template.php(74): Mage_Core_Block_Template->_toHtml()
#18 /var/www/html/app/code/core/Mage/Core/Block/Abstract.php(932): Mage_Adminhtml_Block_Template->_toHtml()
#19 /var/www/html/app/code/core/Mage/Core/Model/Layout.php(580): Mage_Core_Block_Abstract->toHtml()
#20 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Action.php(397): Mage_Core_Model_Layout->getOutput()
#21 /var/www/html/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php(141): Mage_Core_Controller_Varien_Action->renderLayout()
#22 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Action.php(428): Mage_Adminhtml_Catalog_Product_AttributeController->editAction()
#23 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(262): Mage_Core_Controller_Varien_Action->dispatch('edit')
#24 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Front.php(188): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#25 /var/www/html/app/code/core/Mage/Core/Model/App.php(371): Mage_Core_Controller_Varien_Front->dispatch()
#26 /var/www/html/app/Mage.php(745): Mage_Core_Model_App->run(Array)
#27 /var/www/html/index.php(71): Mage::run('', 'store')
#28 {main}

Applying the change from this PR the page loads and displays the error message

reserved_by_system

addison74
addison74 previously approved these changes Jan 1, 2023
@fballiano
Copy link
Contributor

why is the diff on README so big? can we just add your single entry instead?

@AGelzer
Copy link
Contributor Author

AGelzer commented Jan 1, 2023

@fballiano

READMY generated automatically (with all-contributors-cli Version: 6.24.0).

@elidrissidev
Copy link
Member

why is the diff on README so big? can we just add your single entry instead?

all-contributors-cli tool started addeing tbody to the table in a recent version.

addison74
addison74 previously approved these changes Jan 1, 2023
sreichel
sreichel previously approved these changes Jan 1, 2023
Copy link
Contributor

@sreichel sreichel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OT: is there an option to not set ?style=flat-square?

@elidrissidev
Copy link
Member

Looking at your fork it seems the contributors badge is not rendering properly.

@AGelzer
Copy link
Contributor Author

AGelzer commented Jan 2, 2023

OT: is there an option to not set ?style=flat-square?

We can only add 'badgeTemplate' and 'contributorTemplate' to .all-contributorsrc Documentation

Related PR

@AGelzer
Copy link
Contributor Author

AGelzer commented Jan 2, 2023

Looking at your fork it seems the contributors badge is not rendering properly.

@elidrissidev Thanks,
Markdown syntax not work between HTML tags. I changed badge template to HTML in .all-contributorsrc

@AGelzer AGelzer dismissed stale reviews from sreichel and addison74 via 7d79dcc January 2, 2023 10:52
@elidrissidev elidrissidev merged commit 2a34bcf into OpenMage:1.9.4.x Jan 2, 2023
@AGelzer
Copy link
Contributor Author

AGelzer commented Jan 2, 2023

fballiano pushed a commit that referenced this pull request Jan 3, 2023
* Fixed exception on add reserved catalog product attribute

* Add @AGelzer as a contributor

* Changed all contributors badge template to html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Adminhtml Relates to Mage_Adminhtml documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants