Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged

0

You can modiy code as per you need. I suggest you to observe customer_register_success event. More about observers here. $uploaderFactory = $this->uploaderFactory->create(['fileId' => 'my_file']); //Magento\MediaStorage\Model\File\UploaderFactory $uploaderFactory->setAllowedExtensions(['jpg', 'jpeg', 'png', 'pdf']); ...


0

Instead of making a module or having to recode anything, I did it through phpmyadmin. When you go in your files, go to customer_entity Go to the customer that you want to LOCK out of their account. Click edit and go to the part that says failures_num and I typed 10 because max failed attempts is only 3. Go down to lock_expires and use the calendar ...


0

You can try the steps below. Assume you are using a custom module names "Company_MyModule" Step 1) Create di.xml under YOUR-MAGENTO-ROOT/app/code/Company/MyModule/etc File : YOUR-MAGENTO-ROOT/app/code/Company/MyModule/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="...


0

The block responsible for rendering the template which contains the logic above is cached. Couple of options To disable caching of custom block on a Magento 2 product view page, you can implement a couple of different approaches: In a layout, set cacheable=”false”. Note that this attribute will make the whole page non-cacheable. Alternatively, you can ...


1

Within standard Magento 2 OOTB there is not really an option like that, if you will run: DESCRIBE newsletter_subscriber It gives this, the standard table: subscriber_id store_id change_status_at customer_id subscriber_email subscriber_status subscriber_confirm_code So no data available in DB to answer your question. The way to address your need would be ...


0

Inject the following public function __construct( \Magento\Customer\Api\CustomerRepositoryInterface $customerRepositoryInterface, ) { $this->customerRepositoryInterface = $customerRepositoryInterface; } Load by ID /** * Get customer by Id. * * @param int $customerId * * @return \Magento\Customer\Model\Data\Customer ...


0

Add following in you Constructor:- protected $_customer; protected $_customerFactory; public function __construct(... \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Customer\Model\Customer $customers ) { ... $this->_customerFactory = $customerFactory; $...


0

Try use: public function __construct( Magento\Customer\Api\CustomerRepositoryInterface $customerRepo){ $this->customerRepo = $customerRepo; } And your code check customer exist: $customer = $this->customerRepo->getById('your customer id'); if($customer){ //process your code }


0

Link For Free Extension :- Force Login Force Login Module for Magento® 2


0

It is throwing error because getCompany method is property of Magento\Customer\Api\Data\AddressInterface. So please access this property by loading customer address and then save the company field


1

Update your host file. /etc/hosts 127.0.0.1 localhost And also update your database table "core_config_data" web/unsecure/base_url "http://localhost/magento226/" to "http://127.0.0.1/magento226/" web/secure/base_url "http://localhost/magento226/" to "http://127.0.0.1/magento226/" Then after please follow below command: rm -rf generated/metadata/ ...


0

If you want to perform some action before logout then Create an observer before customer logout: event: customer_logout In your custom module create app/code/Vendorname/Modulename/etc/frontend/events.xml Then create your observer in VendornameModulename\Observer\Frontend\CustomerLogOutObserver.php namespace ...


0

you need to assign customer to quote $quote->assignCustomer($customer); more info you can found https://webkul.com/blog/create-quote-and-order-programmatically-in-magento2/ hope it will help you


0

The solution is to : double (yes double) check if there is max 1 account per email per store. In our case somehow customers were created with store is admin, but storeview is the same as a store where the user already existed. So the solution was to clean the data and make absolutely certain there are no duplicate emails


0

You need to do following things. $store_Id = ''; // PASS STORE ID FOR WHICH YOU GET COLLECTION $store = Mage::getModel('core/store')->load($store_Id); $customers = Mage::getModel('customer/customer')->getCollection() ->addFieldToFilter('store_id',$store_Id) ->addNameToSelect(); foreach ($customers as $customer) { .......


0

Overwrite app\code\local\Mage\ImportExport\Model\Export\Entity\Customer.php And in line 200 modify code like this: if ($addressAttribute) { if ($addressAttribute->getFrontendInput() == 'multiselect') { $optionIds = explode(',', $value); $optionTexts = array(); ...


0

Another answer: <?php $_loggedin = $block->getLayout()->createBlock('Magento\Customer\Block\Account\AuthorizationLink')->isLoggedIn() ?> <?php if( $_loggedin ) : ?> // your code <?php endif; ?> What do you think?


1

Create XML file at in your custom extension : app/code/Vendor/Module/view/frontend/layout/customer_account_login.xml Add below content: <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> ...


1

All you need is the following steps Not sure if you are still looking for the answer: Step one is in your module create -> view/frontend/templates/layout/customer_account_login.xml You are only focusing on the login page so do the following and view/frontend/templates/form/login.phtml add what you change is example: add the h1 tag and test it out Link ...


0

All you need is the following steps Not sure if you are still looking for the answer: Step one is in your module create -> view/frontend/templates/layout/customer_account_login.xml You are only focusing on the login page so do the following and view/frontend/templates/form/login.phtml add what you change is example: add the h1 tag and test it out


0

I'm using Magento 2.2, PUT and POST both do not work for adding a new address to an existing account. I get the following error: "A customer with the same email already exists in an associated website" Is adding an address to an existing Magento customer only supported in version 2.3 and later?


0

Take a look on the class: Magento\Sales\Block\Order\History at the method getOrders() this method is responsible for order collection at frontend customer account page. If you want to change anything at collection then you have to work getOrders() For this requirement, you need to override that class Create di.xml at app/code/{Vendorname}/{Modulename}/...


0

You need to do following things. create your block file with following code : protected $_customerSession; public function __construct(\Magento\Customer\Model\Session $customerSession) { $this->_customerSession = $customerSession; } public function getCustomerInfo() { return $this->_customerSession->getCustomer(); } Now call the code into ...


0

Get customer session and display name of customer using below code. Add below code in your file. $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $customerSession = $objectManager->get('Magento\Customer\Model\Session'); <?php if($customerSession->isLoggedIn()):?> <a href="<?php echo $this->getUrl('customer/...


0

It is still available. Here is Magento's user guide about this - https://docs.magento.com/m2/ce/user_guide/sales/checkout-guest.html. You should be able to go to Stores -> Settings -> Configuration -> Sales -> Checkout -> Checkout Options and find the setting there. This is the opposite situation as yours, but still provides instructions on how to find the ...


0

Assuming you are getting the array data in $response variable. You can get it by decoding first the response: $data = json_decode($response, true); And then echo or save it to a variable like this: echo $data['student_number']['_data:protected']['value']; And for getting all of it in a response, use foreach loop: foreach($data as $key => $...


0

All Customer Data Including Logs In This Table :- customer_address_entity; customer_address_entity_datetime; customer_address_entity_decimal; customer_address_entity_int; customer_address_entity_text; customer_address_entity_varchar; customer_entity; customer_entity_datetime; customer_entity_decimal; customer_entity_int; customer_entity_text; ...


0

You are not able to get the getTelephone() on Magento\Customer\Api\Data\CustomerInterface because Telephone is part of customer address Magento\Customer\Api\Data\AddressInterface object not for customer object. So If you want the Telephone then you need to get the address object of the customer then you can get the Telephone value i.e $block->...


1

Try this.. InstallData.php <?php namespace Vendor\Module\Setup; use Magento\Eav\Setup\EavSetupFactory; use Magento\Customer\Setup\CustomerSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements ...


1

Give a try with below: $customerSetup->addAttribute(Customer::ENTITY, 'is_mobile_verified', [ 'label' => 'Is Mobile Verified ?', 'input' => 'select', 'required' => false, 'sort_order' => 100, 'visible' => false, 'system' => false, ...


Top 50 recent answers are included