New answers tagged

0

You have to implement extension_attribute for is_seller attribute then you have to enable to add is_seller to the database. First, read the article https://store.fooman.co.nz/blog/an-introduction-to-extension-attributes.html First, you have to implement the service contract for your custom table to save the data. Assume that your data interface class ...


0

You need to create a module to override "Magento\Customer\Api\Data\CustomerInterface" interface and add your methods in it "getIsSeller" and "setIsSeller". Once this is done, override the model "Magento\Customer\Model\Data\Customer" and add the definition of these methods in it. once this is done, you can set and get this value to save and fetch from DB. ...


0

Customer attributes don't have an input_renderer. You got to set custom renderer (it uses interface Varien_Data_Form_Element_Renderer_Interface) for a form element in your form block class.


1

I am new to Magento but I am quite certain that this should be the solution. $customerSession = $objectManager->create("Magento\Customer\Model\Session"); And then use this: echo $customerSession->getCustomerId(); This should yield you the perfect result


0

You can easily remove one of the buttons added into vendor/magento/module-customer/view/base/ui_component/customer_form.xml, declaring a new customer_form.xml file into a custom module with the following path: app/code/VendorName/ModuleName/view/base/ui_component/customer_form.xml and the content will be: <?xml version="1.0" encoding="UTF-8"?> <...


2

I am quite certain that this should be the soltuon $customerSession = $objectManager->create("Magento\Customer\Model\Session"); And then use this: echo $customerSession->getCustomerId(); This should yield you the perfect result


1

Depends on the required scope. Default behavior is that customers in different stores under same website can be shared. So you allocate website ID based on this. Customer can log in different stores using same credentials. If however customers need to work on different stores in different websites you must create new customer records.


0

you can hook into customer_save_after_data_object event where it will provide previous customer object and new object as observer parameters for deletion you can use customer_delete_after


1

You can use "customer_delete_after" event in Magento 2.3. <event name="customer_delete_after"> <observer name="ddg_remove_contact" instance="Dotdigitalgroup\Email\Observer\Customer\RemoveContact"/> </event> This event is used in Magento's dotmailer module in the vendor. Below is the link for the event list in Magento 2. https://...


0

I think I understand what you are trying to do. Have you tried to just extend the DefaultRenderer class and add any additional methods you need for your module? As long as you pass the correct parameters to the parent constructor you should be good to go. Let me provide a code sample of what I am thinking would work below (keyword "thinking", have not tested)...


2

You can check this with class MyClass { protected $customerSession; public function __construct(\Magento\Customer\Model\Session $customerSession) { $this->customerSession = $customerSession; } public isCustomerLoggedIn() { return $this->_customerSession->isLoggedIn(); } }


2

You can do this by making this following Code in your .phtml file: <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $customerSession = $objectManager->create("Magento\Customer\Model\Session"); $contractAddress = $block->getContractAddress(); if($customerSession->isLoggedIn()) { //Your Code }...


0

You can use method getCustomerSession() in \Magento\Checkout\Model\Cart to get customer data. $cart = $objectManager->get('\Magento\Checkout\Model\Cart'); $customerId = $cart->getCustomerSession()->getCustomerId();


2

This should be the right code: $customerSession = $objectManager->create("Magento\Customer\Model\Session"); echo $customerSession->getCustomerId(); By using this great code it should work. Therefore, the customer ID will get returned to you.


0

The references up can't help me cause i'm touching JS at checkout process. I finally solved it doing a jQuery check: if add new address button are visible in the code, then, the user are registered and configured they address. Thanks for the help!


0

Please share your code if you are done...or please check with below url which have ajax login popup. https://www.siphor.com/add-a-login-popup-in-magento-2/


0

Its available frontend via customerData (private data) https://devdocs.magento.com/guides/v2.3/extension-dev-guide/cache/page-caching/private-content.html You can combine this with jquery. Something like this. https://magento.stackexchange.com/a/243312/70343


0

You can try this code: public function getCustomerId(){ $session = $this->objectManager->get('Magento\Customer\Model\Session'); return $session->getCustomer()->getId(); } Here, firstly you need to check customer is logged in or not: $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $customerSession = $...


2

Please try with below code... $customerSession = $objectManager->create("Magento\Customer\Model\Session"); echo $customerSession->getCustomerId(); I hope its work for you.


0

I am facing same issue in Magento2.3 $eavSetup->addAttribute(Customer::ENTITY, 'organization', [ // Attribute parameters 'type' => 'varchar', 'label' => 'Organization', 'input' => 'text', 'required' => false, 'visible' => true, 'is_visible' => true, ...


1

You need to create even observer as below <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="customer_login"> <observer name="customer_login_observer" instance="<Your_packagename>\<...


2

The field "Associate to Website" is used to associate the customer created with a particular website or to the admin. 1) When user is created with Associate to website as "Admin" then the user will not be able to login in the frontend. For this the values of store_id and website_id stored in database are 0. 2) When user is created with Associate to website ...


0

You can use this below code in your block file : protected $customerSession; /** * Construct * * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Customer\Model\Session $customerSession * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\...


2

Try with changing the session object <?php namespace YourCompanyName\YourModuleName\Block; class YourCustomBlock extends \Magento\Framework\View\Element\Template { protected $_customerSession; public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Customer\Model\SessionFactory $...


0

You can execute this sql request. Simply identify the customers created by bot and delete them and their relationships in the database. To select: SELECT * FROM customer_entity -- [Α-Ωα-ωА-Яа-я] > cyrillic character -- ^(..)*(E[4-9]) > chinese character WHERE customer_entity.firstname REGEXP '[Α-Ωα-ωА-Яа-я]|^(..)*(E[4-9])' -- all email with *.qq.com ...


0

I used the following method <?php function randomPassword() { $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789"; $password = []; $alphaLength = strlen($alphabet) - 1; for ($i = 0; $i < 8; $i++) { $n = rand(0, $alphaLength); $password[]...


0

In my case there is a issue with the missing Attribute that is password_created_at attribute in the eav_attribute table. while installing the magento the upgrade script is not run properly, due to this reason password_created_at attribute is not created. I just downgraded the customer_setup version to 1.6.2.0.5 in the core_resource table After created ...


0

Is this the redirection issue or you not able to set login session? If the redirection issue then follow steps as @pЯincƏ suggesting. Else proper cookie is not set. Set cookie Path to / set cookie domain to .example.com Rest is OK.


0

I know the question was posted a while ago but I will leave it here for a reference. Magento keeps products you put to the cart on the server side. If you log in on the front-end as the same customer as using REST API, you should be able to see the products in the cart. It works on a clean installation of Magento 2, an example of which you can find under ...


Top 50 recent answers are included