25

For adding image field, you can try using plugin and always try to avoid overwrite whole class. Vendor/Module/etc/adminhtml/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\User\Block\User\Edit\...


14

you need to create a plugin in your custom module ( the one that you used to create the custom attribute ), and have the code something like the following one: namespace Package\Name\Plugin\Checkout; class LayoutProcessor { public function afterProcess( \Magento\Checkout\Block\Checkout\LayoutProcessor $subject, array $jsLayout ) { ...


10

You have to just add image role using create image attribute from Stores -> Attribute -> Product Click on Create new attribute. Set Catalog Input type for store owner is Media Image Save Attribute. Now set above attribute in Attribute Set like default. Run command php bin/magento indexer:reindex


9

You can validate specific field using below code of line. <script> require([ 'jquery', 'mage/mage', ], function($){ $( "#new-button" ).click(function() { $('input[name="field_mobile"]').validation(); if(!$('input[name="field_mobile"]').validation('isValid')){ return false; } }); }); </script> ...


7

You need to create a module and here is installData.php: namespace Barcode\Unique\Setup; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { /** * Customer setup factory * * @var \...


7

If you want add new field, in customer account, you need to override the register.phtml in your custom theme. Create custom theme, then create register.phtml in following path app/design/frontend/vendor/theme/Magento_Customer/templates/form/register.phtml Then, copy codes, from module-customer/view/frontend/templates/form/register.phtml and paste to above ...


7

Please follow this blog so you can get idea how to pass data payment form. create configprovider.php and di.xml. I have posted basic code which you can modified as per your requirement. create SampleConfigProvider.php under File Namespace/Modulename/Model/SampleConfigProvider.php <?php namespace Namespace\Modulename\Model; use Magento\...


5

You can get values from order object as follows. $surchargeAmount = $order->getData('fooman_surcharge_amount'); Where $order is previously loaded order object.


5

This is completely untested but here goes. As I can see for the other date type fields, the value needs some processing before saving it into the db: https://github.com/magento/magento2/blob/2.2/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php#L30 Maybe you need to do the same for your date fields as well. You can use this event ...


5

Try via plugin method: CompanyName/ModuleName/etc/adminhtml/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Front"> <plugin ...


4

I found this one to work: $.validator.validateSingleElement('#input-id'); More about how it's implemented and used here: https://mage2.pro/t/topic/5504


4

Note that this form in the checkout is built with JavaScript / UI Components, so the solution provided by @Abhinav does not apply here (even though you should make those address fields on those other pages required as well). The proper solution (for the checkout scenario) is to write a plugin for the layout processor and handle it from there: In etc/...


4

finally found the solution, using php function to get the raw json input, here's the code: public function collectRates(RateRequest $request) { $data = json_decode(file_get_contents('php://input'), true); $subdistrict = $data['address']['custom_attributes']['subdistrict']; }


4

Create customer_account_create.xml file your current active theme For eg. app/design/frontend/{YOUR_PACKAGE}/{YOUR_THEME}/Magento_Customer/layout/customer_account_create.xml After add below code for display address field in registration form <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" ...


3

In order to get the values from extension attributes to the order i am using this event: sales_model_service_quote_submit_before and the code i am using is: /** @var OrderInterface $order */ $order = $observer->getEvent()->getOrder(); $quote = $observer->getEvent()->getQuote(); $order->getShippingAddress()->setMobilePhone($...


3

You can try below code in your block, it might be helpful to get Reward point custom field value. protected $orderRepository; public function __construct( \Magento\Sales\Model\OrderRepository $orderRepository ) { $this->orderRepository = $orderRepository; } public function getReward() { $order_id = $this->getRequest()->getParam('order_id');...


2

You can add "addbefore" attribute to your UI component form field. Follow this code: <field name="xxxxx" sortOrder="50" > <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="dataType" xsi:type="string">text</item> <item name="label" ...


2

You can do it by overriding the system.xml /app/code/core/Mage/Core/etc/system.xml For this create a basic module app/etc/modules/Arunendra_Pratap.xml <?xml version="1.0"?> <config> <modules> <Arunendra_Pratap> <active>true</active> <codePool>local</codePool> &...


2

Try below code and make sure setup version in module.xml file is greater then 2.0.1 <?php namespace Scandesigns\ProductType\Setup; use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\SchemaSetupInterface; use Magento\Framework\DB\Ddl\Table; class UpgradeSchema implements ...


2

Just to add another working example, I've succeeded in overwriting the Website admin page. I was trying to add a URL field to the website edit page. I did exactly what it's said in the validated answer but I didn't add a new fieldset. Instead, I've completed the existing one, using it's id defined in the Website class. Besides, I'v used the inheritance to ...


2

Replacing the statement return parent::_prepareForm(); with this return \Magento\Backend\Block\Widget\Form\Generic::_prepareForm(); worked for me. Here is the complete code. Adding the field "Accessible Store" as follow. <?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ // @...


2

after some research got a solution for this add new property "value" in addField method with the value you need. see the example: $fieldset->addField( 'user_image', 'image', [ 'name' => 'user_image', 'label' => __('Image'), 'id' => 'user_image', ...


2

You can load order by entity id $order = Mage::getModel('sales/order')->load(24999); //use an entity id here Or by increment_id $order = Mage::getModel('sales/order')->loadByIncrementId('10000001'); //use a real increment order id here you can see all field value of order by print_r($order->getData());


2

Kindly follow the below steps: I am posting the answer as per below considerations 1) module name: Ewall_Test II) Attribute code: custom_mobile Step 1: create a module using silk software with customer attribute (which i have posted first answer) Step 2: app/design/frontend/rwd/default/template/persistent/checkout/onepage/billing.phtml Keep the below ...


2

Add following line <item name="options" xsi:type="object">Magento\Catalog\Model\Category\Attribute\Source\Page</item> So your xml looks like <?xml version="1.0"?> <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <fieldset name="...


2

You can add sortOrder item in your checkout_index_index.xml file like below. <item name="postcode" xsi:type="array"> <!-- post-code field has custom UI component --> <item name="component" xsi:type="string">Magento_Ui/js/form/element/post-code</item> <item name="validation" xsi:type="array"> <item name="...


2

You have to edit your code part to add adminhtml_customer: 'used_in_forms', ['customer_register_address','adminhtml_customer'] this will show your field in admin customer information section. To show column in customer grid you have to add after ('position' => 1000 ) : 'is_used_in_grid' => 1,


2

I assume that all the attributes you want to show in the registration form are already introduced in Magento. To show the address fields: create the file customer_account_create.xml under app/design/frontend/[themepackage]/[theme]/Magento_Customer/layout folder. Now paste below code in this file: <page xmlns:xsi="http://www.w3.org/2001/...


2

Adding to the above answer, u can also just overwrite the getOptions Method from the extended \Magento\Framework\View\Element\Html\Select and return the toOptionArray Method of an existing SourceModel. Incase u just want to have a select inside of an AbstractFieldArray that is based on a SourceModel. For example the Yesno Sourcemodel: <?php namespace ...


2

app/design/frontend/{Vendor}/{theme}/Magento_Customer/templates/form/register.phtml <div class="field required"> <label for="customer_number" class="label"><span><?= __('CustomerNumber') ?></span></label> <div class="control"> <input type="text" name="customer_number" id="customer_number" value="&...


Only top voted, non community-wiki answers of a minimum length are eligible