Creating custom button in customer address section Magento v2.3.1How to change admin login template in Magento 1.5 or 1.6Custom module to add a 3rd customer address typeCustom renderer for custom customer address attributeSorting fields in customer address form edit admin sectionCustomer address update code is always creating new addressForm is not displayed on panel admin Magento 2magento 2.2.5: Adding Custom Attribute to Customer Edit Form in AdminMagento 2 how to disable 'add new address' button from customer address book page, in account section?Magento 2.3 Can't view module's front end page output?Magento 2 plugin change price of products that have a custom attribute with
How can powerful telekinesis avoid violating Newton's 3rd Law?
Why didn't all the iron and heavier elements find their way to the center of the accretion disc in the early solar system?
Why did the Death Eaters wait to reopen the Chamber of Secrets?
What's the difference between DHCP and NAT? Are they mutually exclusive?
Must a CPU have a GPU if the motherboard provides a display port (when there isn't any separate video card)?
Undocumented incompatibility between changes and siunitx?
Am I allowed to determine tenets of my contract as a warlock?
usage of mir gefallen
What does this line mean in Zelazny's The Courts of Chaos?
Purpose of cylindrical attachments on Power Transmission towers
A team managed by my peer is close to melting down
Is it advisable to add a location heads-up when a scene changes in a novel?
A life of PhD: is it feasible?
Boss making me feel guilty for leaving the company at the end of my internship
Why are backslashes included in this shell script?
Is fission/fusion to iron the most efficient way to convert mass to energy?
Does the UK delegate some immigration control to the Republic of Ireland?
In American Politics, why is the Justice Department under the President?
I am caught when I was about to steal some candies
Am I being scammed by a sugar daddy?
Is it true that "only photographers care about noise"?
Jam with honey & without pectin has a saucy consistency always
Does WiFi affect the quality of images downloaded from the internet?
Is it a good security practice to force employees hide their employer to avoid being targeted?
Creating custom button in customer address section Magento v2.3.1
How to change admin login template in Magento 1.5 or 1.6Custom module to add a 3rd customer address typeCustom renderer for custom customer address attributeSorting fields in customer address form edit admin sectionCustomer address update code is always creating new addressForm is not displayed on panel admin Magento 2magento 2.2.5: Adding Custom Attribute to Customer Edit Form in AdminMagento 2 how to disable 'add new address' button from customer address book page, in account section?Magento 2.3 Can't view module's front end page output?Magento 2 plugin change price of products that have a custom attribute with
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have created the custom button in the customer address section and it's showing well. When I edit any customer it's working normally/expected. But when I click on Add new address it's throwing an error.
ERROR: No such entity with addressId = [] []
For this, I write below code.
Created customer_address_form.xml file from Namespace/Module/view/adminhtml/ui_component
.
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd" component="Magento_Customer/js/form/components/form">
<settings>
<buttons>
<button name="sendthisAddressToNav" class="NamespaceModuleBlockAdminhtmlEditAddressSendToNav"/>
</buttons>
</settings>
</form>
And created block file SendToNav.php from Namespace/Module/Block/Adminhtml/Edit/Address
<?php
declare(strict_types=1);
namespace NamespaceModuleBlockAdminhtmlEditAddress;
use MagentoFrameworkViewElementUiComponentControlButtonProviderInterface;
use MagentoCustomerUiComponentListingAddressColumnActions;
class SendToNav extends MagentoCustomerBlockAdminhtmlEditAddressGenericButton implements ButtonProviderInterface
const CUSTOMER_ADDRESS_SEND_THIS_ADDRESS_TO_NAV = 'dynamicsnav/index/customeraddress';
/**
* @return array
*/
public function getButtonData()
$url= $this->getCustomButtonUrl();
$data = [
'label' => __('Send this Customer Address to Nav'),
'on_click' => sprintf("location.href = '%s';", $url),
'class' => 'add',
'sort_order' => 40,
];
return $data;
/**
* Get send this customer address to nav button url.
*
* @return string
* @throws MagentoFrameworkExceptionLocalizedException
*/
private function getCustomButtonUrl(): string
return $this->getUrl(
self::CUSTOMER_ADDRESS_SEND_THIS_ADDRESS_TO_NAV,
['id' => $this->getCustomerId(), 'entity_id' => $this->getAddressId()]
);
I have debugged this it's throwing an error in getCustomerId()
and getAddressId()
function from MagentoCustomerBlockAdminhtmlEditAddressGenericButton
class.
Even though I created di.xml
file to override the core functionality, but it's still throwing an error.
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCustomerBlockAdminhtmlEditAddressGenericButton" type="NamespaceModuleBlockAdminhtmlEditAddressGenericButtons" />
</config>
GenericButtons.php file
<?php
declare(strict_types=1);
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace NamespaceModuleBlockAdminhtmlEditAddress;
use MagentoCustomerModelAddressFactory;
use MagentoFrameworkAppRequestInterface;
use MagentoFrameworkUrlInterface;
use MagentoCustomerModelResourceModelAddress;
use MagentoCustomerModelResourceModelAddressRepository;
/**
* Class for common code for buttons on the create/edit address form
*/
class GenericButton extends MagentoCustomerBlockAdminhtmlEditAddressGenericButton
/**
* @var AddressFactory
*/
private $addressFactory;
/**
* @var UrlInterface
*/
private $urlBuilder;
/**
* @var Address
*/
private $addressResourceModel;
/**
* @var RequestInterface
*/
private $request;
/**
* @var AddressRepository
*/
private $addressRepository;
/**
* @param AddressFactory $addressFactory
* @param UrlInterface $urlBuilder
* @param Address $addressResourceModel
* @param RequestInterface $request
* @param AddressRepository $addressRepository
*/
public function __construct(
AddressFactory $addressFactory,
UrlInterface $urlBuilder,
Address $addressResourceModel,
RequestInterface $request,
AddressRepository $addressRepository
)
$this->addressFactory = $addressFactory;
$this->urlBuilder = $urlBuilder;
$this->addressResourceModel = $addressResourceModel;
$this->request = $request;
$this->addressRepository = $addressRepository;
/**
* Return address Id.
*
* @return int
I created this button to send customer address information to my custom controller.
Can you please suggest where I went wrong?
adminhtml magento2.3 customer-address
add a comment |
I have created the custom button in the customer address section and it's showing well. When I edit any customer it's working normally/expected. But when I click on Add new address it's throwing an error.
ERROR: No such entity with addressId = [] []
For this, I write below code.
Created customer_address_form.xml file from Namespace/Module/view/adminhtml/ui_component
.
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd" component="Magento_Customer/js/form/components/form">
<settings>
<buttons>
<button name="sendthisAddressToNav" class="NamespaceModuleBlockAdminhtmlEditAddressSendToNav"/>
</buttons>
</settings>
</form>
And created block file SendToNav.php from Namespace/Module/Block/Adminhtml/Edit/Address
<?php
declare(strict_types=1);
namespace NamespaceModuleBlockAdminhtmlEditAddress;
use MagentoFrameworkViewElementUiComponentControlButtonProviderInterface;
use MagentoCustomerUiComponentListingAddressColumnActions;
class SendToNav extends MagentoCustomerBlockAdminhtmlEditAddressGenericButton implements ButtonProviderInterface
const CUSTOMER_ADDRESS_SEND_THIS_ADDRESS_TO_NAV = 'dynamicsnav/index/customeraddress';
/**
* @return array
*/
public function getButtonData()
$url= $this->getCustomButtonUrl();
$data = [
'label' => __('Send this Customer Address to Nav'),
'on_click' => sprintf("location.href = '%s';", $url),
'class' => 'add',
'sort_order' => 40,
];
return $data;
/**
* Get send this customer address to nav button url.
*
* @return string
* @throws MagentoFrameworkExceptionLocalizedException
*/
private function getCustomButtonUrl(): string
return $this->getUrl(
self::CUSTOMER_ADDRESS_SEND_THIS_ADDRESS_TO_NAV,
['id' => $this->getCustomerId(), 'entity_id' => $this->getAddressId()]
);
I have debugged this it's throwing an error in getCustomerId()
and getAddressId()
function from MagentoCustomerBlockAdminhtmlEditAddressGenericButton
class.
Even though I created di.xml
file to override the core functionality, but it's still throwing an error.
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCustomerBlockAdminhtmlEditAddressGenericButton" type="NamespaceModuleBlockAdminhtmlEditAddressGenericButtons" />
</config>
GenericButtons.php file
<?php
declare(strict_types=1);
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace NamespaceModuleBlockAdminhtmlEditAddress;
use MagentoCustomerModelAddressFactory;
use MagentoFrameworkAppRequestInterface;
use MagentoFrameworkUrlInterface;
use MagentoCustomerModelResourceModelAddress;
use MagentoCustomerModelResourceModelAddressRepository;
/**
* Class for common code for buttons on the create/edit address form
*/
class GenericButton extends MagentoCustomerBlockAdminhtmlEditAddressGenericButton
/**
* @var AddressFactory
*/
private $addressFactory;
/**
* @var UrlInterface
*/
private $urlBuilder;
/**
* @var Address
*/
private $addressResourceModel;
/**
* @var RequestInterface
*/
private $request;
/**
* @var AddressRepository
*/
private $addressRepository;
/**
* @param AddressFactory $addressFactory
* @param UrlInterface $urlBuilder
* @param Address $addressResourceModel
* @param RequestInterface $request
* @param AddressRepository $addressRepository
*/
public function __construct(
AddressFactory $addressFactory,
UrlInterface $urlBuilder,
Address $addressResourceModel,
RequestInterface $request,
AddressRepository $addressRepository
)
$this->addressFactory = $addressFactory;
$this->urlBuilder = $urlBuilder;
$this->addressResourceModel = $addressResourceModel;
$this->request = $request;
$this->addressRepository = $addressRepository;
/**
* Return address Id.
*
* @return int
I created this button to send customer address information to my custom controller.
Can you please suggest where I went wrong?
adminhtml magento2.3 customer-address
add a comment |
I have created the custom button in the customer address section and it's showing well. When I edit any customer it's working normally/expected. But when I click on Add new address it's throwing an error.
ERROR: No such entity with addressId = [] []
For this, I write below code.
Created customer_address_form.xml file from Namespace/Module/view/adminhtml/ui_component
.
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd" component="Magento_Customer/js/form/components/form">
<settings>
<buttons>
<button name="sendthisAddressToNav" class="NamespaceModuleBlockAdminhtmlEditAddressSendToNav"/>
</buttons>
</settings>
</form>
And created block file SendToNav.php from Namespace/Module/Block/Adminhtml/Edit/Address
<?php
declare(strict_types=1);
namespace NamespaceModuleBlockAdminhtmlEditAddress;
use MagentoFrameworkViewElementUiComponentControlButtonProviderInterface;
use MagentoCustomerUiComponentListingAddressColumnActions;
class SendToNav extends MagentoCustomerBlockAdminhtmlEditAddressGenericButton implements ButtonProviderInterface
const CUSTOMER_ADDRESS_SEND_THIS_ADDRESS_TO_NAV = 'dynamicsnav/index/customeraddress';
/**
* @return array
*/
public function getButtonData()
$url= $this->getCustomButtonUrl();
$data = [
'label' => __('Send this Customer Address to Nav'),
'on_click' => sprintf("location.href = '%s';", $url),
'class' => 'add',
'sort_order' => 40,
];
return $data;
/**
* Get send this customer address to nav button url.
*
* @return string
* @throws MagentoFrameworkExceptionLocalizedException
*/
private function getCustomButtonUrl(): string
return $this->getUrl(
self::CUSTOMER_ADDRESS_SEND_THIS_ADDRESS_TO_NAV,
['id' => $this->getCustomerId(), 'entity_id' => $this->getAddressId()]
);
I have debugged this it's throwing an error in getCustomerId()
and getAddressId()
function from MagentoCustomerBlockAdminhtmlEditAddressGenericButton
class.
Even though I created di.xml
file to override the core functionality, but it's still throwing an error.
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCustomerBlockAdminhtmlEditAddressGenericButton" type="NamespaceModuleBlockAdminhtmlEditAddressGenericButtons" />
</config>
GenericButtons.php file
<?php
declare(strict_types=1);
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace NamespaceModuleBlockAdminhtmlEditAddress;
use MagentoCustomerModelAddressFactory;
use MagentoFrameworkAppRequestInterface;
use MagentoFrameworkUrlInterface;
use MagentoCustomerModelResourceModelAddress;
use MagentoCustomerModelResourceModelAddressRepository;
/**
* Class for common code for buttons on the create/edit address form
*/
class GenericButton extends MagentoCustomerBlockAdminhtmlEditAddressGenericButton
/**
* @var AddressFactory
*/
private $addressFactory;
/**
* @var UrlInterface
*/
private $urlBuilder;
/**
* @var Address
*/
private $addressResourceModel;
/**
* @var RequestInterface
*/
private $request;
/**
* @var AddressRepository
*/
private $addressRepository;
/**
* @param AddressFactory $addressFactory
* @param UrlInterface $urlBuilder
* @param Address $addressResourceModel
* @param RequestInterface $request
* @param AddressRepository $addressRepository
*/
public function __construct(
AddressFactory $addressFactory,
UrlInterface $urlBuilder,
Address $addressResourceModel,
RequestInterface $request,
AddressRepository $addressRepository
)
$this->addressFactory = $addressFactory;
$this->urlBuilder = $urlBuilder;
$this->addressResourceModel = $addressResourceModel;
$this->request = $request;
$this->addressRepository = $addressRepository;
/**
* Return address Id.
*
* @return int
I created this button to send customer address information to my custom controller.
Can you please suggest where I went wrong?
adminhtml magento2.3 customer-address
I have created the custom button in the customer address section and it's showing well. When I edit any customer it's working normally/expected. But when I click on Add new address it's throwing an error.
ERROR: No such entity with addressId = [] []
For this, I write below code.
Created customer_address_form.xml file from Namespace/Module/view/adminhtml/ui_component
.
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd" component="Magento_Customer/js/form/components/form">
<settings>
<buttons>
<button name="sendthisAddressToNav" class="NamespaceModuleBlockAdminhtmlEditAddressSendToNav"/>
</buttons>
</settings>
</form>
And created block file SendToNav.php from Namespace/Module/Block/Adminhtml/Edit/Address
<?php
declare(strict_types=1);
namespace NamespaceModuleBlockAdminhtmlEditAddress;
use MagentoFrameworkViewElementUiComponentControlButtonProviderInterface;
use MagentoCustomerUiComponentListingAddressColumnActions;
class SendToNav extends MagentoCustomerBlockAdminhtmlEditAddressGenericButton implements ButtonProviderInterface
const CUSTOMER_ADDRESS_SEND_THIS_ADDRESS_TO_NAV = 'dynamicsnav/index/customeraddress';
/**
* @return array
*/
public function getButtonData()
$url= $this->getCustomButtonUrl();
$data = [
'label' => __('Send this Customer Address to Nav'),
'on_click' => sprintf("location.href = '%s';", $url),
'class' => 'add',
'sort_order' => 40,
];
return $data;
/**
* Get send this customer address to nav button url.
*
* @return string
* @throws MagentoFrameworkExceptionLocalizedException
*/
private function getCustomButtonUrl(): string
return $this->getUrl(
self::CUSTOMER_ADDRESS_SEND_THIS_ADDRESS_TO_NAV,
['id' => $this->getCustomerId(), 'entity_id' => $this->getAddressId()]
);
I have debugged this it's throwing an error in getCustomerId()
and getAddressId()
function from MagentoCustomerBlockAdminhtmlEditAddressGenericButton
class.
Even though I created di.xml
file to override the core functionality, but it's still throwing an error.
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCustomerBlockAdminhtmlEditAddressGenericButton" type="NamespaceModuleBlockAdminhtmlEditAddressGenericButtons" />
</config>
GenericButtons.php file
<?php
declare(strict_types=1);
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace NamespaceModuleBlockAdminhtmlEditAddress;
use MagentoCustomerModelAddressFactory;
use MagentoFrameworkAppRequestInterface;
use MagentoFrameworkUrlInterface;
use MagentoCustomerModelResourceModelAddress;
use MagentoCustomerModelResourceModelAddressRepository;
/**
* Class for common code for buttons on the create/edit address form
*/
class GenericButton extends MagentoCustomerBlockAdminhtmlEditAddressGenericButton
/**
* @var AddressFactory
*/
private $addressFactory;
/**
* @var UrlInterface
*/
private $urlBuilder;
/**
* @var Address
*/
private $addressResourceModel;
/**
* @var RequestInterface
*/
private $request;
/**
* @var AddressRepository
*/
private $addressRepository;
/**
* @param AddressFactory $addressFactory
* @param UrlInterface $urlBuilder
* @param Address $addressResourceModel
* @param RequestInterface $request
* @param AddressRepository $addressRepository
*/
public function __construct(
AddressFactory $addressFactory,
UrlInterface $urlBuilder,
Address $addressResourceModel,
RequestInterface $request,
AddressRepository $addressRepository
)
$this->addressFactory = $addressFactory;
$this->urlBuilder = $urlBuilder;
$this->addressResourceModel = $addressResourceModel;
$this->request = $request;
$this->addressRepository = $addressRepository;
/**
* Return address Id.
*
* @return int
I created this button to send customer address information to my custom controller.
Can you please suggest where I went wrong?
adminhtml magento2.3 customer-address
adminhtml magento2.3 customer-address
asked Jun 6 at 7:05
BojjaiahBojjaiah
2,4703081
2,4703081
add a comment |
add a comment |
0
active
oldest
votes
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%2f277425%2fcreating-custom-button-in-customer-address-section-magento-v2-3-1%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f277425%2fcreating-custom-button-in-customer-address-section-magento-v2-3-1%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