Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class InstallData implements InstallDataInterface
- {
- /**
- * @var AttributeSetFactory $_attributeSetFactory
- */
- protected $_attributeSetFactory;
- /**
- * @var CustomerSetupFactory $_customerSetupFactory
- */
- protected $_customerSetupFactory;
- /**
- * @param CustomerSetupFactory $customerSetupFactory
- */
- public function __construct(
- CustomerSetupFactory $customerSetupFactory,
- AttributeSetFactory $attributeSetFactory
- )
- {
- $this->_customerSetupFactory = $customerSetupFactory;
- $this->_attributeSetFactory = $attributeSetFactory;
- }
- /**
- * @param SchemaSetupInterface $setup
- * @param ModuleContextInterface $context
- */
- public function install(
- ModuleDataSetupInterface $setup,
- ModuleContextInterface $context
- )
- {
- $setup->startSetup();
- $customerSetup = $this->_customerSetupFactory->create(['setup' => $setup]);
- $customerEntity = $customerSetup->getEavConfig()
- ->getEntityType('customer');
- $attributeSetId = $customerEntity->getDefaultAttributeSetId();
- /** @var $attributeSet AttributeSet */
- $attributeSet = $this->_attributeSetFactory->create();
- $attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
- $customerSetup->addAttribute('customer_address', 'short_name', [
- 'default' => '',
- 'input' => 'text',
- 'label' => 'Address short name',
- 'length' => 32,
- 'nullable' => false,
- 'required' => true,
- 'type' => Table::TYPE_TEXT,
- 'user_defined' => false,
- 'visible' => true,
- ]);
- $attribute = $customerSetup->getEavConfig()->getAttribute('customer_address', 'short_name')
- ->addData([
- 'attribute_group_id' => $attributeGroupId,
- 'attribute_set_id' => $attributeSetId,
- 'used_in_forms' => [
- 'adminhtml_customer_address',
- 'customer_address_edit',
- 'customer_register_address',
- ],
- ]);
- $attribute->save();
- $setup->endSetup();
- }
- }
- /*jshint browser:true jquery:true*/
- /*global alert*/
- define([], function() {
- /**
- * @param addressData
- * Returns new address object
- */
- return function (addressData) {
- console.log(addressData);
- return {
- customerAddressId: addressData.id,
- email: addressData.email,
- countryId: addressData.country_id,
- regionId: addressData.region_id,
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement