Update is_required for Existing Attribute Code
I am thinking to update is_required data to "1" for existing "Region" attribute code.
select * From eav_attribute where attribute_id = '28'
However, I am wondering what is the practice here. Is it simply creating SQL statement and update that specific record in setup script fine? Or perhaps there may be a better way.
attributes upgrade
add a comment |
I am thinking to update is_required data to "1" for existing "Region" attribute code.
select * From eav_attribute where attribute_id = '28'
However, I am wondering what is the practice here. Is it simply creating SQL statement and update that specific record in setup script fine? Or perhaps there may be a better way.
attributes upgrade
Which region attribute? for order or address?
– Bijal Bhavsar
Jan 24 '14 at 10:43
for order and address =)
– Leongelis
Jan 27 '14 at 3:24
ok I have already added code in below answer :)
– Bijal Bhavsar
Jan 28 '14 at 5:53
add a comment |
I am thinking to update is_required data to "1" for existing "Region" attribute code.
select * From eav_attribute where attribute_id = '28'
However, I am wondering what is the practice here. Is it simply creating SQL statement and update that specific record in setup script fine? Or perhaps there may be a better way.
attributes upgrade
I am thinking to update is_required data to "1" for existing "Region" attribute code.
select * From eav_attribute where attribute_id = '28'
However, I am wondering what is the practice here. Is it simply creating SQL statement and update that specific record in setup script fine? Or perhaps there may be a better way.
attributes upgrade
attributes upgrade
edited 28 mins ago
Teja Bhagavan Kollepara
2,96341847
2,96341847
asked Jan 24 '14 at 10:21
LeongelisLeongelis
380721
380721
Which region attribute? for order or address?
– Bijal Bhavsar
Jan 24 '14 at 10:43
for order and address =)
– Leongelis
Jan 27 '14 at 3:24
ok I have already added code in below answer :)
– Bijal Bhavsar
Jan 28 '14 at 5:53
add a comment |
Which region attribute? for order or address?
– Bijal Bhavsar
Jan 24 '14 at 10:43
for order and address =)
– Leongelis
Jan 27 '14 at 3:24
ok I have already added code in below answer :)
– Bijal Bhavsar
Jan 28 '14 at 5:53
Which region attribute? for order or address?
– Bijal Bhavsar
Jan 24 '14 at 10:43
Which region attribute? for order or address?
– Bijal Bhavsar
Jan 24 '14 at 10:43
for order and address =)
– Leongelis
Jan 27 '14 at 3:24
for order and address =)
– Leongelis
Jan 27 '14 at 3:24
ok I have already added code in below answer :)
– Bijal Bhavsar
Jan 28 '14 at 5:53
ok I have already added code in below answer :)
– Bijal Bhavsar
Jan 28 '14 at 5:53
add a comment |
6 Answers
6
active
oldest
votes
Create sql script to update region attribute
$installer->startSetup();
/*** Update customer address attributes*/
$installer->updateAttribute('customer_address', 'region', 'is_required', true);
/*** Update order address attributes*/
$installer->updateAttribute('order_address', 'region', 'is_required', true);
$installer->endSetup();
I hope above code will help
Can you please explain it in deep with example.
– Ami Kamboj
Jun 20 '14 at 10:13
add a comment |
I am writing this updates is simply sharing my research and hope could help someone out there.
config.xml
<config>
<modules>
<Package_Module>
<version>0.0.2</version>
</Package_Module>
</modules>
<global>
<resources>
<module_setup>
<setup>
<module>Package_Module</module>
<!--
Create a Switchable Installer Script
This class is incredibly handy in case you need different setup classes
-->
<class>Package_Module_Model_Resource_Setup</class>
</setup>
</module_setup>
</resources>
</global>
<config>
Custom Setup Class: Package_Module_Model_Resource_Setup
class Package_Module_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
{
public function getCatalogResourceSetup()
{
return new Mage_Catalog_Model_Resource_Setup('module_setup');
}
public function getCustomerResourceSetup()
{
return new Mage_Customer_Model_Resource_Setup('module_setup');
}
public function getCustomerEntitySetup()
{
return new Mage_Customer_Model_Entity_Setup('module_setup');
}
}
Upgrade Script: mysql4-upgrade-0.0.1-0.0.2.php
<?php
/* @var $installer Package_Module_Model_Resource_Setup */
$installer = $this->getCustomerEntitySetup();
$installer->startSetup();
/*** Update customer address attributes*/
$installer->updateAttribute('customer_address', 'region', 'is_required', 1);
$installer->endSetup();
Hereby a great article that shared about 'Switchable Installer Script'. Source link: inchoo.net
add a comment |
Create sql update script and run updateAttribute function.
$installer = $this;
$installer->startSetup();
$installer->updateAttribute('entity_type', 'your_attribute_id', 'required', 1);
$installer->endSetup();
With this function you can update any attribute's property.
add a comment |
I was trying some scripts found, but the attribute still was required. The correct parameter is 'is_required' and not 'required'.
$installer->updateAttribute('entity_type', 'your_attribute_id', 'is_required', 1);
add a comment |
Below code will update attribute using sql script
$installer = $this;
$this->updateAttribute('customer_address', 'region', 'is_required' ,1);
add a comment |
you can find definition of updateAttribute() function in file appcodecoreMageEavModelEntitysetup.php
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f13775%2fupdate-is-required-for-existing-attribute-code%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
Create sql script to update region attribute
$installer->startSetup();
/*** Update customer address attributes*/
$installer->updateAttribute('customer_address', 'region', 'is_required', true);
/*** Update order address attributes*/
$installer->updateAttribute('order_address', 'region', 'is_required', true);
$installer->endSetup();
I hope above code will help
Can you please explain it in deep with example.
– Ami Kamboj
Jun 20 '14 at 10:13
add a comment |
Create sql script to update region attribute
$installer->startSetup();
/*** Update customer address attributes*/
$installer->updateAttribute('customer_address', 'region', 'is_required', true);
/*** Update order address attributes*/
$installer->updateAttribute('order_address', 'region', 'is_required', true);
$installer->endSetup();
I hope above code will help
Can you please explain it in deep with example.
– Ami Kamboj
Jun 20 '14 at 10:13
add a comment |
Create sql script to update region attribute
$installer->startSetup();
/*** Update customer address attributes*/
$installer->updateAttribute('customer_address', 'region', 'is_required', true);
/*** Update order address attributes*/
$installer->updateAttribute('order_address', 'region', 'is_required', true);
$installer->endSetup();
I hope above code will help
Create sql script to update region attribute
$installer->startSetup();
/*** Update customer address attributes*/
$installer->updateAttribute('customer_address', 'region', 'is_required', true);
/*** Update order address attributes*/
$installer->updateAttribute('order_address', 'region', 'is_required', true);
$installer->endSetup();
I hope above code will help
edited Feb 7 '18 at 16:04
Michael Poppinger
1035
1035
answered Jan 24 '14 at 11:01
Bijal BhavsarBijal Bhavsar
1,143926
1,143926
Can you please explain it in deep with example.
– Ami Kamboj
Jun 20 '14 at 10:13
add a comment |
Can you please explain it in deep with example.
– Ami Kamboj
Jun 20 '14 at 10:13
Can you please explain it in deep with example.
– Ami Kamboj
Jun 20 '14 at 10:13
Can you please explain it in deep with example.
– Ami Kamboj
Jun 20 '14 at 10:13
add a comment |
I am writing this updates is simply sharing my research and hope could help someone out there.
config.xml
<config>
<modules>
<Package_Module>
<version>0.0.2</version>
</Package_Module>
</modules>
<global>
<resources>
<module_setup>
<setup>
<module>Package_Module</module>
<!--
Create a Switchable Installer Script
This class is incredibly handy in case you need different setup classes
-->
<class>Package_Module_Model_Resource_Setup</class>
</setup>
</module_setup>
</resources>
</global>
<config>
Custom Setup Class: Package_Module_Model_Resource_Setup
class Package_Module_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
{
public function getCatalogResourceSetup()
{
return new Mage_Catalog_Model_Resource_Setup('module_setup');
}
public function getCustomerResourceSetup()
{
return new Mage_Customer_Model_Resource_Setup('module_setup');
}
public function getCustomerEntitySetup()
{
return new Mage_Customer_Model_Entity_Setup('module_setup');
}
}
Upgrade Script: mysql4-upgrade-0.0.1-0.0.2.php
<?php
/* @var $installer Package_Module_Model_Resource_Setup */
$installer = $this->getCustomerEntitySetup();
$installer->startSetup();
/*** Update customer address attributes*/
$installer->updateAttribute('customer_address', 'region', 'is_required', 1);
$installer->endSetup();
Hereby a great article that shared about 'Switchable Installer Script'. Source link: inchoo.net
add a comment |
I am writing this updates is simply sharing my research and hope could help someone out there.
config.xml
<config>
<modules>
<Package_Module>
<version>0.0.2</version>
</Package_Module>
</modules>
<global>
<resources>
<module_setup>
<setup>
<module>Package_Module</module>
<!--
Create a Switchable Installer Script
This class is incredibly handy in case you need different setup classes
-->
<class>Package_Module_Model_Resource_Setup</class>
</setup>
</module_setup>
</resources>
</global>
<config>
Custom Setup Class: Package_Module_Model_Resource_Setup
class Package_Module_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
{
public function getCatalogResourceSetup()
{
return new Mage_Catalog_Model_Resource_Setup('module_setup');
}
public function getCustomerResourceSetup()
{
return new Mage_Customer_Model_Resource_Setup('module_setup');
}
public function getCustomerEntitySetup()
{
return new Mage_Customer_Model_Entity_Setup('module_setup');
}
}
Upgrade Script: mysql4-upgrade-0.0.1-0.0.2.php
<?php
/* @var $installer Package_Module_Model_Resource_Setup */
$installer = $this->getCustomerEntitySetup();
$installer->startSetup();
/*** Update customer address attributes*/
$installer->updateAttribute('customer_address', 'region', 'is_required', 1);
$installer->endSetup();
Hereby a great article that shared about 'Switchable Installer Script'. Source link: inchoo.net
add a comment |
I am writing this updates is simply sharing my research and hope could help someone out there.
config.xml
<config>
<modules>
<Package_Module>
<version>0.0.2</version>
</Package_Module>
</modules>
<global>
<resources>
<module_setup>
<setup>
<module>Package_Module</module>
<!--
Create a Switchable Installer Script
This class is incredibly handy in case you need different setup classes
-->
<class>Package_Module_Model_Resource_Setup</class>
</setup>
</module_setup>
</resources>
</global>
<config>
Custom Setup Class: Package_Module_Model_Resource_Setup
class Package_Module_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
{
public function getCatalogResourceSetup()
{
return new Mage_Catalog_Model_Resource_Setup('module_setup');
}
public function getCustomerResourceSetup()
{
return new Mage_Customer_Model_Resource_Setup('module_setup');
}
public function getCustomerEntitySetup()
{
return new Mage_Customer_Model_Entity_Setup('module_setup');
}
}
Upgrade Script: mysql4-upgrade-0.0.1-0.0.2.php
<?php
/* @var $installer Package_Module_Model_Resource_Setup */
$installer = $this->getCustomerEntitySetup();
$installer->startSetup();
/*** Update customer address attributes*/
$installer->updateAttribute('customer_address', 'region', 'is_required', 1);
$installer->endSetup();
Hereby a great article that shared about 'Switchable Installer Script'. Source link: inchoo.net
I am writing this updates is simply sharing my research and hope could help someone out there.
config.xml
<config>
<modules>
<Package_Module>
<version>0.0.2</version>
</Package_Module>
</modules>
<global>
<resources>
<module_setup>
<setup>
<module>Package_Module</module>
<!--
Create a Switchable Installer Script
This class is incredibly handy in case you need different setup classes
-->
<class>Package_Module_Model_Resource_Setup</class>
</setup>
</module_setup>
</resources>
</global>
<config>
Custom Setup Class: Package_Module_Model_Resource_Setup
class Package_Module_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
{
public function getCatalogResourceSetup()
{
return new Mage_Catalog_Model_Resource_Setup('module_setup');
}
public function getCustomerResourceSetup()
{
return new Mage_Customer_Model_Resource_Setup('module_setup');
}
public function getCustomerEntitySetup()
{
return new Mage_Customer_Model_Entity_Setup('module_setup');
}
}
Upgrade Script: mysql4-upgrade-0.0.1-0.0.2.php
<?php
/* @var $installer Package_Module_Model_Resource_Setup */
$installer = $this->getCustomerEntitySetup();
$installer->startSetup();
/*** Update customer address attributes*/
$installer->updateAttribute('customer_address', 'region', 'is_required', 1);
$installer->endSetup();
Hereby a great article that shared about 'Switchable Installer Script'. Source link: inchoo.net
answered Jan 26 '14 at 2:31
LeongelisLeongelis
380721
380721
add a comment |
add a comment |
Create sql update script and run updateAttribute function.
$installer = $this;
$installer->startSetup();
$installer->updateAttribute('entity_type', 'your_attribute_id', 'required', 1);
$installer->endSetup();
With this function you can update any attribute's property.
add a comment |
Create sql update script and run updateAttribute function.
$installer = $this;
$installer->startSetup();
$installer->updateAttribute('entity_type', 'your_attribute_id', 'required', 1);
$installer->endSetup();
With this function you can update any attribute's property.
add a comment |
Create sql update script and run updateAttribute function.
$installer = $this;
$installer->startSetup();
$installer->updateAttribute('entity_type', 'your_attribute_id', 'required', 1);
$installer->endSetup();
With this function you can update any attribute's property.
Create sql update script and run updateAttribute function.
$installer = $this;
$installer->startSetup();
$installer->updateAttribute('entity_type', 'your_attribute_id', 'required', 1);
$installer->endSetup();
With this function you can update any attribute's property.
edited Jan 24 '14 at 11:09
answered Jan 24 '14 at 10:49
oleksii.svarychevskyioleksii.svarychevskyi
4,80111022
4,80111022
add a comment |
add a comment |
I was trying some scripts found, but the attribute still was required. The correct parameter is 'is_required' and not 'required'.
$installer->updateAttribute('entity_type', 'your_attribute_id', 'is_required', 1);
add a comment |
I was trying some scripts found, but the attribute still was required. The correct parameter is 'is_required' and not 'required'.
$installer->updateAttribute('entity_type', 'your_attribute_id', 'is_required', 1);
add a comment |
I was trying some scripts found, but the attribute still was required. The correct parameter is 'is_required' and not 'required'.
$installer->updateAttribute('entity_type', 'your_attribute_id', 'is_required', 1);
I was trying some scripts found, but the attribute still was required. The correct parameter is 'is_required' and not 'required'.
$installer->updateAttribute('entity_type', 'your_attribute_id', 'is_required', 1);
answered Nov 26 '14 at 17:51
Antonio PediciniAntonio Pedicini
5981029
5981029
add a comment |
add a comment |
Below code will update attribute using sql script
$installer = $this;
$this->updateAttribute('customer_address', 'region', 'is_required' ,1);
add a comment |
Below code will update attribute using sql script
$installer = $this;
$this->updateAttribute('customer_address', 'region', 'is_required' ,1);
add a comment |
Below code will update attribute using sql script
$installer = $this;
$this->updateAttribute('customer_address', 'region', 'is_required' ,1);
Below code will update attribute using sql script
$installer = $this;
$this->updateAttribute('customer_address', 'region', 'is_required' ,1);
answered Mar 11 '15 at 10:12
DigishaDigisha
1345
1345
add a comment |
add a comment |
you can find definition of updateAttribute() function in file appcodecoreMageEavModelEntitysetup.php
add a comment |
you can find definition of updateAttribute() function in file appcodecoreMageEavModelEntitysetup.php
add a comment |
you can find definition of updateAttribute() function in file appcodecoreMageEavModelEntitysetup.php
you can find definition of updateAttribute() function in file appcodecoreMageEavModelEntitysetup.php
answered Sep 29 '16 at 9:37
AjayAjay
12
12
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f13775%2fupdate-is-required-for-existing-attribute-code%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Which region attribute? for order or address?
– Bijal Bhavsar
Jan 24 '14 at 10:43
for order and address =)
– Leongelis
Jan 27 '14 at 3:24
ok I have already added code in below answer :)
– Bijal Bhavsar
Jan 28 '14 at 5:53