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 Development Magento

Magento 2 : Custom attribute of address not saving

I am using following code and trying to save SetLatitude() or ->setCustomAttribute(‘latitude’,$address[‘latitude’]) but it’s not working. I followed this this solution <?php namespace ABC\Customerapi\Model; use Magento\Framework\Exception\InputException; class Customerapi implements \ABC\Customerapi\Api\CustomerapiInterface { CONST MAX_PASSWORD_LENGTH=12; CONST MIN_PASSWORD_LENGTH=4; private $customerFactory; private $storeManager; private $_request; private $_tokenModelFactory; protected $addressDataFactory; protected $addressRepository; # protected $customerRepository; public function __construct( \Magento\Framework\Webapi\Rest\Request $request, […]

Categories
CMS Development Magento

Custom attribute of address not saving

I am using following code and trying to save SetLatitude() or ->setCustomAttribute(‘latitude’,$address[‘latitude’]) but it’s not working. I followed this this solution <?php namespace ABC\Customerapi\Model; use Magento\Framework\Exception\InputException; class Customerapi implements \ABC\Customerapi\Api\CustomerapiInterface { CONST MAX_PASSWORD_LENGTH=12; CONST MIN_PASSWORD_LENGTH=4; private $customerFactory; private $storeManager; private $_request; private $_tokenModelFactory; protected $addressDataFactory; protected $addressRepository; # protected $customerRepository; public function __construct( \Magento\Framework\Webapi\Rest\Request $request, […]

Categories
CMS Development Magento

No able to Retrieve Custom attibute value of a catgeory in magento 2

I have created a custom attribute for my category. Below is my code. In InstallData.php <?php /* file: app/code/Atwix/CategoryAttribute/Setup/InstallData.php */ namespace Vidushi\KeyFeature\Setup; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Eav\Setup\EavSetup; use Magento\Eav\Setup\EavSetupFactory; use Magento\Catalog\Model\Category; use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface; /** * @codeCoverageIgnore */ class InstallData implements InstallDataInterface { /** * @var EavSetupFactory */ private $eavSetupFactory; /** * * […]

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 = […]