Skip to content

Commit

Permalink
MAGETWO-41418: [GITHUB] Add "Not Specified" as a gender option when c…
Browse files Browse the repository at this point in the history
…ustomer does not specify gender #1496
  • Loading branch information
vpelipenko committed Aug 21, 2015
1 parent 43a1e52 commit 9201c1a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
18 changes: 12 additions & 6 deletions app/code/Magento/Customer/Setup/UpgradeData.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,10 @@ public function __construct(
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);

if (version_compare($context->getVersion(), '2.0.1', '<')) {
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);

$entityAttributes = [
'customer' => [
'website_id' => [
Expand Down Expand Up @@ -185,11 +184,18 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
$attribute->save();
}
}
$indexer = $this->indexerRegistry->get(Customer::CUSTOMER_GRID_INDEXER_ID);
$indexer->reindexAll();
$this->eavConfig->clear();
}

$indexer = $this->indexerRegistry->get(Customer::CUSTOMER_GRID_INDEXER_ID);
$indexer->reindexAll();
$this->eavConfig->clear();
if (version_compare($context->getVersion(), '2.0.2') < 0) {
$entityTypeId = $customerSetup->getEntityTypeId(Customer::ENTITY);
$attributeId = $customerSetup->getAttributeId($entityTypeId, 'gender');

$option = ['attribute_id' => $attributeId, 'values' => [2 => 'Not Specified']];
$customerSetup->addAttributeOption($option);
}

$setup->endSetup();
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Customer/etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Magento_Customer" setup_version="2.0.1">
<module name="Magento_Customer" setup_version="2.0.2">
<sequence>
<module name="Magento_Eav"/>
<module name="Magento_Directory"/>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Eav/Setup/EavSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ public function addAttribute($entityTypeId, $code, array $attr)
}

/**
* Add Attribure Option
* Add Attribute Option
*
* @param array $option
* @return void
Expand Down

0 comments on commit 9201c1a

Please sign in to comment.