Questions tagged [setup-script]
Installer/Update script
145
questions
0
votes
0answers
13 views
How to update all bundle products
How to add a new Bundle item to all products?
Is there a way in Magento to update all of these products?
I have not found a normal example at the moment
0
votes
0answers
9 views
Add new option for existing bundle products
Can't find an example for adding new Bundle Items to existing Bundle products.
I'm looking for an implementation like Upgrade Script or something similar, but I found an implementation for magento 1 ...
0
votes
0answers
11 views
Update all bundle products add new options and add products to this option by id?
I have 50 bundle products.
I need to add a new option to all products, and add products by id to it, how can I implement this programmatically?
Magento 2.2.2
0
votes
1answer
89 views
Customer custom attribute value did not save using rest api in magento 2.3?
Customer custom attribute value did not save using rest API in Magento 2.3?
API URL: http://127.0.0.1/magento2/rest/V1/customers
Method: POST
My POST JSON request data is :
{
"customer": ...
0
votes
2answers
77 views
Database not creating tables for new extensions on bin/magento setup:upgrade. Declarative Schema is not up to date
I installed Magento 2.3 successfully, with custom style sheet and Mageplaza Blog ext which all works fine. I wanted to install a slider module and I have done this through ssh. Composer installs the ...
0
votes
1answer
14 views
Why do the Magento 1 setup scripts still have to be prefixed with 'mysql4'?
MySQL4 is largely obsolete now, even Magento 1 latest versions send a warning if you use Mysql4 prefixed classes. I searched if the setup file names also had this deprecation but couldn't find a thing....
1
vote
1answer
56 views
Magento 2 - Customer Attribute not being saved
Below is code for creating customer attribute.
namespace Namespace\Modulename\Setup;
use Magento\Customer\Model\Customer;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\...
3
votes
1answer
3k views
Error: DDL statements are not allowed in transactions while running setup:upgrade. Running Data Patch
Magento 2.3.1
After making the data patch @ following location
vendor/ModuleName/Setup/Patch/Data/AddMyColumnPatch.php
code given below for AddMyColumnPatch.php. When I run bin/magento setup:...
1
vote
3answers
94 views
Update module to run alter command
I have created a module Vendor/Module I have added sql setup script in it. The module is working fine.
Now I need to alter table and add come more columns in the table. To do this I need to add new ...
2
votes
2answers
140 views
Magento 2.3 What are the profits of using db_schema.xml instead of using setup script?
Magento 2.3 used db_schema.xml instead of setup script. What are the benefits of using db_schema.xml over setup script?
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\...
2
votes
1answer
311 views
How to save input value to database magento2
I am absolutely new in magento. I have made new input called 'name' under email input in
app/design/frontend/NewVendor/NewTheme/Magento_Newsletter/templates/subscribe.phtml
<div class="block ...
1
vote
2answers
746 views
Create Column in Quote Payment Table in magento2
i want to add new column in Quote payment table i tried script but not working
<?php
namespace Ibnab\Additional\Setup;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\...
0
votes
0answers
174 views
How to add a Megamenu programmatically in Magento 2?
I need to add Megamenu via an install/upgrade script. I've added my megamenu. I've figured out which tables get updated when I add Megamenu.
The table which gets updated is
mgs_megamenu
...
1
vote
2answers
786 views
error on running raw sql query in upgradeData.php magento 2
I have created my own module and in UpgradeData.php script I am writing my own, mysql query but it gives me an error when I run bin/magento setup:upgrade to run the setup script files
Recoverable ...
1
vote
1answer
546 views
Setup Script throws Error : Call to undefined method Mage_Core_Model_Resource_Setup::addAttribute()
I am following a tutorial from the book of Roman Zenner & Vinai Kopp called "Magento - The Handbook for Developers" (german: Magento - Das Handbuch für Entwickler).
Snippet from config.xml
<...
1
vote
2answers
501 views
Question about UpgradeSchema and UpgradeData files
Sorry, I'm new in using Magento 2.
In my UpgradeSchema.php I would like to add a column to my table and in my UpgradeData.php
I would like to add new records to the table.
In both the file i have ...
0
votes
0answers
325 views
setup:upgrade stuck exit at installing Data
I have created following Setup Script
<?php
namespace Anshu\Custom\Setup;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\...
2
votes
0answers
76 views
Insert data into core db table
I need to run this SQL query on Magento, but since I have a multi-tenant solution, it need to be done through Data/Install scripts as it will run every time a new client comes in.
What should I use? ...
2
votes
1answer
62 views
Adding new regions won't persist
I followed an example and created a custom extension that would add some regions to the directory_country_region & directory_country_region_name tables.
I want to make sure that the data I write ...
2
votes
1answer
1k views
Remove all customers where * is * programmatically
I want to remove all customers that have the following string in their first name: 'http://' (spam customers that have links in their first names).
Is there a good way to remove these ...
1
vote
1answer
361 views
Install script not running
I know there's a million of these questions with answers but I still can't solve this. It does create the line in the core_resource table, but my install script is supposed to die to show it's running,...
1
vote
0answers
87 views
Magento 2 : Call a function at the time of module installation
I want to call a function to send some store information through api call at the time of my custom module installation. Is there any event observer for this? How can we do it? Thanks.
class ...
2
votes
1answer
108 views
How to activate a new module in magento 1 this module should create a table
I am trying to activate a new module in Magento 1. Here are my actions step-by-step:
I created a new file in /app/etc/modules, called : Mage_ContactMessage.xml :
I created a new folder in /app/code/...
1
vote
0answers
25 views
When Installer Class Execute
I am trying to Implement same thing Magento is doing when we run web installer wizard.
Magento is creating sample data (Attributes, Products, Categories)
using Setup\SampleData\InstallerInterface ...
1
vote
0answers
33 views
Problems While Creating Product Attribute With InstallData
I've created InstallData for creating product attribute with default options to be set yes like,
used_in_product_listing and is_used_for_promo_rules
Probelm is only used_in_product_listing is ...
2
votes
0answers
30 views
Send email to admin during extension installation?
I want to send an email to admin (website owner) to notify that our extension has been installed in your web store. For that, I have developing an extension but not getting any way to shoot the email ...
0
votes
1answer
155 views
Magento Catalog Setup Script Can't Complete [closed]
I'm having trouble getting some of my modules to complete their setup scripts. Looking at the core_resource table shows that catalog_setup has a higher version than data version. This has been a ...
0
votes
2answers
1k views
Magento 2 - InstallSchema.php does not create table [closed]
I have created a module that has a setup that creates a table for me. However, the table does not exist after installing the module. I don't know why.
Error:
SQLSTATE[42S02]: Base table or view ...
1
vote
2answers
1k views
Recurring.php and RecurringData.php
Can anybody explain the purpose of this two files in Setup folder? When should I use it?
I know, that it fires every time when I run setup:upgrade
But I want to know at least one example of usage. ...
0
votes
1answer
62 views
Can we create product attribute without select options, and add it later?
I have the following setup file in my custom module on Vendor\Module\Setup\InstallData.php:
<?php
namespace Vendor\Module\Setup;
use \Magento\Catalog\Model\Product;
use \Magento\Eav\Setup\...
1
vote
1answer
172 views
How do I find all valid array keys for the EavSetup::addAttribute method?
When adding an EAV attribute in an install script (Setup/InstallData.php or Setup/UpgradeData.php), the third argument to the addAttribute method is an array of information customizing the created ...
2
votes
1answer
199 views
change input renderer which already added by setup script
I have a custom setup script in a module like this
<?php
$installer = new Mage_Catalog_Model_Resource_Setup('core_setup');
$installer->startSetup();
$attributeSetDefault = 'Default';
$...
1
vote
0answers
54 views
Is it necessary to addIndex() on Setup Script?
I'm writing a setup script for my new module. I found that there are many setup scripts in InstallSchema.php contains addIndex(). But after I found some info on W3School, seems it's just a performance ...
2
votes
1answer
465 views
Magento 2.2: InstallData script never called even though no entry in setup_module
Hello I have created a module in accordance to the tutorial at Magento Docs
My InstallData class looks like this:
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt ...
7
votes
3answers
917 views
Magento2 What's the point of having both InstallSchema and UpgradeSchema
If UpgradeSchema/UpgradeData are executed when installing and upgrading a module what's the point of having InstallSchema/InstallData (besides just having a well-named file that is only executed once)....
1
vote
1answer
149 views
How to make a specific script run only once in the lifetime of an extension
The requirement is that I want to execute a script upon the installation of my extension. But I want to make sure that it runs only once and then never again.
I tried doing this via Setup Resources. ...
2
votes
2answers
2k views
MG2 Integration give error Unable to post data to consumer due to an unexpected error
I'm follow the http://devdocs.magento.com/guides/v2.0/howdoi/webapi/integration.html and i have an error when i try do activates the integrator.
[2017-06-20 05:22:08] main.CRITICAL: Exception: Notice:...
2
votes
2answers
3k views
Magento 2 : Check Static Block with same identifier in InstallData Script
I am creating module which will create static block & cms page at time of site transfer.
So my InstallData file like below :
class InstallData implements InstallDataInterface
{
/**
* @var ...
1
vote
1answer
320 views
Magento 2 : How to Create Simple Product by UpgradeSchema?
How do I create a simple product programmatically using UpgradeSchema?
0
votes
2answers
1k views
Magento 2 error 500 after adding a module
I added a module by these command
php bin/magento module:status
php bin/magento module:enable module
Everything was fine then I run this
php bin/magento setup:upgrade
After this everything messed ...
3
votes
2answers
2k views
Magento 2.1: Not add table into database
I follow this tutorial:
https://www.pierrefay.com/en/magento2-training/install-upgrade-setup.html
but i didn't add table into database, i had do anything in tutorial.
From here:
Go to /app/code/Pfay/...
9
votes
2answers
5k views
Magento 2 :- Add select attribute to category
I want to add a select/dropdown attribute to a category and display it in the backend to let the store owner select it. After some research I found out the following to do:
Create an attribute via ...
2
votes
1answer
486 views
Magento 2 testing module setup
How is it possible to test module setup in Magento2 ?
I have following setup class:
class InstallSchema implements InstallSchemaInterface
{
public function install(SchemaSetupInterface $setup, ...
0
votes
1answer
1k views
How to create custom atribute set using upgradeData in magento 2
I am trying to create custom attribute set by using upgradeData script in magento 2, but it doesn't create.
Can anyone give me an advice?
3
votes
2answers
2k views
Magento 2 new order attribute
I have been trying to create a new order attribute in Magento 2, but not successful yet.
I have created a new module and this is already showing.
I added the different codes available in my setup ...
1
vote
2answers
2k views
Adding an attribute programmatically in Magento 2.1
I am creating a product attribute for sorting which will be int type :
where I am getting following error:
PHP Fatal error:
Uncaught Error: Class 'Magento\Catalog\Model\Resource\Eav\Attribute'
...
2
votes
1answer
375 views
Prevent Magento setup resources from running automatically
What is the setting within app/etc/local.xml to prevent setup resources from being triggered to run automatically?
I have seen this somewhere but cannot locate it now.
0
votes
1answer
215 views
Custom Customer attribute that auto_increments
I need a custom customer attribute of type int that should start with some 5-digit number and auto-increments each time a new customer is created.
Approach 1:
Or should I make a simple int type ...
1
vote
1answer
1k views
Why my google map is not showing at contact us page? [closed]
My google map is not displaying and due to script problem. How to resolve this?
my script code is as follows
function initialize() {
var pos = new google.maps.LatLng(, );
var ...