New answers tagged

0

Here is the code for get billing and shipping address. class SetCustomer { protected $_customerFactory; protected $_addressFactory; public function __construct(\Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Customer\Model\AddressFactory $addressFactory ) { $this->...


0

app/code/VendoreName/ModuleName/Setup InstallData.php <?php namespace VendoreName\ModuleName\Setup; use Magento\Customer\Setup\CustomerSetupFactory; use Magento\Customer\Model\Customer; use Magento\Eav\Model\Entity\Attribute\Set as AttributeSet; use Magento\Eav\Model\Entity\Attribute\SetFactory as AttributeSetFactory; use Magento\Framework\Setup\...


0

Here is another example(customer.isLoggedIn with ko.observable()):- define([ 'ko', 'jquery', 'uiComponent', 'Magento_Customer/js/model/customer', ], function (ko, $, Component, customer) { 'use strict'; var checkoutConfig = window.checkoutConfig, ConfigIsEnabled = checkoutConfig ? checkoutConfig.AppIsEnabled : {}; ...


1

you can go into Store >> Configuration >> Customers >> Customer Configuration >> Address Templates >> HTML. It is formatted address template you can adjust like below: {{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}{{depend firstname}...


2

create Model app/code/VendoreName/ModuleName/Model CustomerAddress.php <?php namespace VendoreName\ModuleName\Model; use Magento\Framework\Model\AbstractModel; use VendoreName\ModuleName\Model\ResourceModel\CustomerAddress as CustomerAddressResourceModel; class CustomerAddress extends AbstractModel { protected function _construct() { ...


1

app/code/VendoreName/ModuleName/Controller/Account Sampleorders.php <?php namespace VendoreName\ModuleName\Controller\Account; use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; use Magento\Framework\App\Action\Context; use Magento\Framework\View\Result\PageFactory; class Sampleorders extends \Magento\Customer\...


0

Try changing the innodb lock wait timeout setting in php.ini file. innodb_lock_wait_timeout=5000 If not working also try to ensure the nginx and php-fpm did not timeout. fastcgi_read_timeout 600; proxy_read_timeout 600;


0

Declare \Magento\Customer\Model\SessionFactory in construct of your class. protected $customerSession; public function __construct( \Magento\Customer\Model\SessionFactory $customerSession ) { $this->customerSession = $customerSession; } public function isLoggedIn() // You can use this function in phtml file { return $this->...


0

For everyone who is coming to this question, and hasn't got yet a solution. I have faced the same problem. My task was to validate if the customer was logged in on the VUE JS Storefront. Rest API for creating customer token doesn't create Session object for logged in customer. The solution, in this case, is, to get the customer token and load by token <...


0

Once your forgot this line we got same error. $customer = $this->accountManagement ->createAccount($customer, $password, $redirectUrl);


0

app/code/[CompanyName]/[PackageName]/registration.php <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, '[CompanyName]_[PackageName]', __DIR__ ); app/code/[CompanyName]/[PackageName]/etc/module.xml <?xml version="1.0" ?> <config xmlns:xsi="http://www.w3.org/...


0

This SQL works just fine to update the customer password. Just change YOURPASSWORD below (keep the xxx:es) 'UPDATE `customer_entity` SET `password_hash` = CONCAT(SHA2('xxxxxxxxYOURPASSWORD', 256), ':xxxxxxxx:1') WHERE `entity_id` = 1;'


2

Try to execute this query in your database : UPDATE `customer_entity` SET `password_hash` = SHA2('admin123', 256) WHERE `entity_id` = 1; or UPDATE `customer_entity` SET `password_hash` = CONCAT(SHA2('xxxxxxxadmin123', 256), ':xxxxxxx:1') WHERE `entity_id` = 1; replace value of password instead of admin123 replace value of xxxxxxx with crypt key. You can ...


0

I am using the Data Model to save my custom customer attribute value code is given below. $customer = $this->_customerRepoInterface->getById($customer->getId())**-getDataModel();** $customer->setCustomAttribute('dice_sum', '9999'); $customer->setCustomAttribute('place_of_birth','dome'); $this->_customerRepoInterface->save($customer);...


1

You can use below code to check Customer is Logged in Or Not ? Using Object Manager : $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $customerSession = $objectManager->get('Magento\Customer\Model\Session'); if($customerSession->isLoggedIn()) { // customer login action } In Controller : $this->_objectManager->get('...


0

Open the this file :- /vendor/magento/framework/Serialize/Serializer/Json.php Find: public function unserialize($string) { $result = json_decode($string, true); if (json_last_error() !== JSON_ERROR_NONE) { throw new \InvalidArgumentException('Unable to unserialize value.'); } return $result; } replace by: public function ...


2

EE provides two set of attributes. Customer and Customer Address Attributes attributes. As per question, it looks like you have created Martial status attribute typed drop-down on the Customer section. I can see all the new custom attributes in frontend. However, when I fill in the data and try to save, its not getting saving but when I do the same ...


Top 50 recent answers are included