Categories
CMS Magento Mastering Development

Custom category attribute is not being saved – issue

I managed to create my custom attribute: $installer = $setup; $installer->startSetup(); $categorySetup = $this->categorySetupFactory->create([‘setup’ => $setup]); $categorySetup->addAttribute( Category::ENTITY, ‘content_category_page’, [ ‘type’ => ‘int’, ‘label’ => ‘Content Page’, ‘input’ => ‘select’, ‘sort_order’ => 100, ‘source’ => ‘Magento\Catalog\Model\Category\Attribute\Source\Page’, ‘global’ => 2, ‘visible’ => true, ‘required’ => true, ‘user_defined’ => false, ‘default’ => null, ‘group’ => ‘General Information’, […]

Categories
CMS Magento Mastering Development

Install Data is not executed in magento 2

I am trying to create a category attribute: This is my file form Vendor/Module/Setup: use Magento\Catalog\Model\Category; use Magento\Catalog\Setup\CategorySetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { private $categorySetupFactory; public function __construct(CategorySetupFactory $categorySetupFactory) { $this->categorySetupFactory = $categorySetupFactory; } public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); $categorySetup = $this->categorySetupFactory->create([‘setup’ => […]

Categories
CMS Magento Mastering Development

Create 3 product attributes of dropdown, with its values

I am not able to make appear 2 of the 3 new attributes in magento_admin_site here is the code in InstallaData.php <?php namespace Ht\Mymodule\Setup; use Magento\Eav\Setup\EavSetup; use Magento\Eav\Setup\EavSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { private $eavSetupFactory; public function __construct(EavSetupFactory $eavSetupFactory) { $this->eavSetupFactory = $eavSetupFactory; } public function install(ModuleDataSetupInterface $setup, ModuleContextInterface […]

Categories
CMS Magento Mastering Development

Magento 2 – Can’t save custom Customer attribute value in observer customer_save_after_data_object

I have created three custom attributes for Customer: myapp_id, codice_univoco and indirizzo_pec If I enter a value in codice_univoco and/or indirizzo_pec, data is successfully saved: However, when I insert a value for myapp_id (App ID), and then save, all custom attributes are emptied (including myapp_id): If I check my database, I can see that custom […]

Categories
CMS Magento Mastering Development

Magento 2 custom attribute on final_price

I have tried to add a custom price attribute on the product page near price. class InstallData implements InstallDataInterface { private $eavSetupFactory; public function __construct(EavSetupFactory $eavSetupFactory) { $this->eavSetupFactory = $eavSetupFactory; } public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $eavSetup = $this->eavSetupFactory->create([‘setup’ => $setup]); $eavSetup->addAttribute( \Magento\Catalog\Model\Product::ENTITY, ‘retail_price’, [ ‘type’ => ‘text’, ‘backend’ => ”, ‘frontend’ => […]

Categories
CMS Magento Mastering Development

Backend only address attributes

I’ve added some custom address attributes and now I’m getting an error on checkout page Propery ‘propname’ does not have accessor method in class AddressExtensionInterface. How can I make those attributes to be completely ignored on checkout page? I only need them for erp integration and adminhtml_customer_address form. NOT in checkout or anywhere else. $eavSetup->addAttribute(‘customer_address’, […]

Categories
CMS Development Magento

Extension not installing database values

I installed a free magento extension on two magento sites. both sites are working fine after install, but one site i notice missing some features (the tab in edit category page and it’s page) Then i compare two databases and found there have some missing values on one site, then i tried to disable extension, […]

Categories
CMS Development Magento

Newly added category attribute not saving in magento 2 backend

I followed this tutorial to add an attribute to my category : https://www.mageplaza.com/devdocs/magento-2-category-attributes-programmatically/ This is my installdata.php <?php namespace XX\XX\Setup; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Eav\Setup\EavSetupFactory; class InstallData implements InstallDataInterface { private $eavSetupFactory; public function __construct(EavSetupFactory $eavSetupFactory) { $this->eavSetupFactory = $eavSetupFactory; } public function install( ModuleDataSetupInterface $setup, ModuleContextInterface $context ) { $eavSetup = […]

Categories
CMS Development Magento

Newly added category attribute not saving in magento 2 backend

I followed this tutorial to add an attribute to my category : https://www.mageplaza.com/devdocs/magento-2-category-attributes-programmatically/ This is my installdata.php <?php namespace XX\XX\Setup; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Eav\Setup\EavSetupFactory; class InstallData implements InstallDataInterface { private $eavSetupFactory; public function __construct(EavSetupFactory $eavSetupFactory) { $this->eavSetupFactory = $eavSetupFactory; } public function install( ModuleDataSetupInterface $setup, ModuleContextInterface $context ) { $eavSetup = […]