Questions tagged [installdata]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
11 views

how to create customer in installData?

$websiteId = $this->storeManager->getWebsite()->getWebsiteId(); // Instantiate object ( this is the most important part ) $customer = $this->customerFactory->create(); $...
0
votes
2answers
37 views

data install/upgrade not creating category attribute

i'm trying to add an attribute to the categories, but my setup doesn't add anything the input is visible in the categories, but you even on save the input value stays empty and i can't find any ...
2
votes
0answers
36 views

Add reply field to Review Form - Magento 2 (current version 2.3.5p1)

I have created the following: registration.php <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Vendor_NewField', ...
2
votes
1answer
51 views

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\...
1
vote
1answer
40 views

Magento2 Install data Custom attr set, attr group, attr

Here is my installation method. Why, after installation, in the default attribute set, I see only the attributes https://prnt.sc/s20b3a, https://prnt.sc/s20czw? They should not be here. How to fix? ...
1
vote
2answers
604 views

How to create multiple customer attributes in magento 2?

How to create multiple customer attributes in Magento 2 using InstallData or UpgradeData? <?php namespace DeviMage\CustomerAttribute\Setup; use Magento\Customer\Model\Customer; use Magento\...
0
votes
1answer
46 views

How can i create custom customer attribute programatically in magento 2?

Here my question is not how to create customer attribute. I want to know the running flow explanation of this process? We can create this by below code in custom module. <?php namespace Vendor\...
1
vote
0answers
47 views

Is it possible to use default Magento colorPicker in 'Update Attributes' action?

I am trying to use default Color Picker component of Magento. If I edit products individually the color picker works perfectly. Once I try the update attributes action from Catalog->Products page ...
1
vote
2answers
276 views

Magento2 - InstallData Cms Page with content from file

as the title suggests I'm creating a module that programmatically installs pages on cms_page, my problem arises when I want to load the contents of a phtml file and pass it as html into the array to ...
2
votes
2answers
156 views

No region found within the locale 'en' while running UpgradeData.php

I'm trying to set up 2 stores I created using InstallData script, but When I run php bin/magento setup:upgrade, I'm getting an error No region found within the locale 'en' and the process stops. What ...
0
votes
3answers
336 views

Magento 2: Undefined variable: installer

I'm too new to Magento: i'm getting an error when setup:upgrade, here is my code: app/code/Adamsmage/Checkoutattribute/Setup/InstallData.php <?php namespace Adamsmage\Checkoutattribute\Setup; use ...
0
votes
2answers
28 views

Magento 2: Getting Error When Adding Customer Address Attribute

I'm using Magento 2.2.3, i need to add Customer Address Attribute, but when i run setup:upgrade I'm getting error of Wrong Entity ID. Here is My code: CustomerAddress\Attribute\Setup\InstallData.php ...
0
votes
1answer
214 views

Magento2: How to add new column in admin_user table?

How to add a new column in admin_user table Magento 2 ?
2
votes
1answer
1k views

Insert multiple records to multiple custom tables through install script in magento2

I have created multiple table schema using setup script like below. Setup/InstallSchema.php namespace Vendor\Module\Setup; use Magento\Framework\Setup\InstallSchemaInterface; use Magento\...
1
vote
1answer
172 views

How to add second field in registration form in Magento 2?

I added one attribute using this code but when I try to add another attribute then it is not working why? <?php namespace Icore\Module\Setup; use Magento\Customer\Model\Customer; use Magento\...
3
votes
1answer
996 views

Magento 2 - Add Customer Attribute with Select Field

I'm trying to insert a customer attribute in magento 2 This is the InstallData script: use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use ...
1
vote
1answer
371 views

How this InstallData works each line in Magento 2?

My questions: I want know how this works by each and every line of code I want to add new attribute here Difference between InstallData and InstallSchema Here is InstallData.php <?php ...
3
votes
2answers
138 views

InstallData not running (Magento 2.2.6)

I'm trying to make my module's InstallData.php work but it's not even running. Before every test i delete the module's entry from setup_module table. I thought the namespace and path were the issue, ...
1
vote
1answer
32 views

Need to save data while custom module installation

I need to save some data while custom module installation. I save some static data using setup/InstallData.php. I need to process the existing order data and save it into my custom table. Is there any ...
2
votes
2answers
2k views

Custom category attribute is not showing in magento2

I have created the custom attribute using the solution given here. Create Custom category Yes/No attribute magento2 The attribute is created and i can see entry in database eav_attribute table. But ...
0
votes
3answers
894 views

Magento 2 Adding custom attributes InstallData.php Error

I'm trying to add a few custom customer attributes, I've created a simple module to install the attributes but my InstallData.php file keeps failing. Here's my code: <?php namespace ...
2
votes
2answers
364 views

Magento 2 + create widget via installData Script

I need to custom requirement for creating a widget via Script. but I have facing an error when try to add a widget via below script <?php namespace Test\Xyz\Setup; use Magento\Framework\Setup; ...
0
votes
3answers
2k views

Force-run module install script in Magento 2

I have added some install data to my module (EAV attributes), and it doesn't look like it's working. However, I don't seem to get any relevant errors in the logs, and am a bit lost on whether the ...
1
vote
1answer
107 views

InstallData works only once

I'm trying to add customer attributes. By struggling, my first attribute is added thanks to this : InstallData.php <?php namespace My\Module\Setup; use Magento\Framework\Setup\...
2
votes
2answers
92 views

InstallData not working on Magento 2.1

I have an InstallData script below which works absolutely fine on Magento 2.2 but failed to install data on Magento 2.1 class InstallData implements \Magento\Framework\Setup\InstallDataInterface { ...
0
votes
2answers
2k views

How to manage InstallData.php File in magento 2

How can I manage my InstallData.php file when I want to create multiple attribute for customer and product? Here, in my InstallData file I have create an attribute for the product. namespace ...
2
votes
1answer
591 views

InstallData.php not executing on Magento 2.2.1

I have the following InstallData.php in my Setup directory in my module. The script does not seem to execute at all. I have tried throwing an Exception at the beginning, dumping and dying, etc. ...
2
votes
1answer
593 views

Read data from File in magento2 InstallData.php

I have my InstallData but i want to read a file in SQL/CSV format in magento 2 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); ...
1
vote
2answers
1k views

Custom Attribute is not saving data in database

I'm trying to add custom text box named cashback in Magento 2 product add/edit page. I added the text box programmatically. But my below code doesn't add column in the table also not saving the value. ...
1
vote
1answer
63 views

Error when trying to add custom attribute programmatically

I got this error when I try to create a custom attribute for products: The configuration parameter "formElement" is a required for "instruction" field. InstallData.php <?php namespace MyVendor\...
1
vote
2answers
1k views

InstallData not working

I have InstallSchema.php as follows: <?php namespace Namespace\Module\Setup; use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\SchemaSetupInterface; use Magento\...
0
votes
2answers
188 views

Problem with add an attribute to Customer in magento 2

I created a module in this way: I created a vendor folder "Test1" Then I created a module folder "AddCustomerAttr" then a folder inside the module "etc" and inside "etc" I put module.xml: <?xml ...
11
votes
4answers
4k views

Difference between InstallSchema and InstallData

I want to know the difference between InstallSchema and InstallData in details. I also need to know when can I use InstallSchema.php and InstallData.php?
0
votes
1answer
456 views

Custom Select Attribut in admin have different values set than InstallData

I'm trying to make a 3 value select attribut in the customer edit page in admin. The attribut is created in DB after setup:upgrade but stored in eav_attribute_option table as follow : the value ...
0
votes
1answer
1k views

Save email template to database when install data Magento 2

I want create a new template, but not from Marketing > Email Templates i want to do it programmatically from my custom extension, the idea is the new template will be saved when Setup/InstallData.php ...
1
vote
1answer
62 views

InstallData categories not add the categories

I make and installData to define new categories (I have a lot of categories and sub-categories and I don't know why but they are nor added, in the database I see they are added but it's strange see ...
2
votes
3answers
9k views

Magento 2 : InstallData.php Does Not Seems to be Running While setup:upgrade

In custom module, I have InstallSchema.php and a InstallData.php files. InstallSchema.php seems to be running fine, both tables declared in file are created. But with the InstallData.php nothing ...
0
votes
2answers
3k views

Fatal error: Call to a member function create() on null

I am trying to create a customer custom attribute in Magento 2, but it's throwing an error. Fatal error: Call to a member function create() on null in Custom\Setup\InstallData.php on line 47 For ...
1
vote
0answers
108 views

Magento 2 InstallData SOLID principles

I have to add about 100 attributes to product, but the file length is about 3000 lines.In installer I only add new attribute set, attribute group and attributes. I have attributes data in separate ...
7
votes
6answers
3k views

Magento2: Setup Script not loaded

I've been banging my head for a few hours now. I have setup a small Magento 2 module. It is enabled everything is working except the Setup scripts never run. Actually from my diagnosis right now, they ...
6
votes
2answers
11k views

How to “reload” a custom module after code changes

I've made several custom modules for i.e. adding attributes to categories. This is all the first time for me, so I set up the module the first time, enabled it and all is fine so far. But when I go ...
0
votes
2answers
933 views

Magento2: How to add pre defined data (installData.php) for Custom Module

I am working on creation of custom module and it is going to be stuck in a problem where i want to add some predefined data to my custom module while installation, so for that i review pre defined ...