Reading a customer attribute (Magento 2)

Want to read a particular customer attribute in Magento 2? Use the following code to retrieve an attribute value for any customer by customer ID:

Excluding the login page from Google’s index (Magento 2)

By default, the login page /customer/account/login/referer/aHR0cHM6Ly93d3cuc2FuaWRvZS5kZS9jdXN0b21lci9hY2NvdW50L2luZGV4Lw~~/ may be indexed by search engines such as Google. To prevent this, create or override the file customer_account_login.xml in your theme and add the following code:

Redeploy the content, clear the cache and…

Resetting a customer password using SQL (Magento 2)

Use the following SQL code to reset a customer’s password directly in your Magento 2 database.

Show address data (like company, name) on registration form (Magento 2)

By default, the Magento 2 registration form does not show address data such as the company, name or street. To change that, simply create customer_account_create.xml in the folder app/design/Your Vendor/Your Theme/Magento_Customer/layout and add the following code:

Now just clear…

Showing address fields during registration (Magento 2)

To request address details during registration, create the file customer_account_create.xml im Verzeichnis app/design/YourVendor/YourTheme/Magento_Customer/layout and insert the following content:

Clear the cache afterwards. Address fields should then appear when registering a new account.

Reading recurring profile data (Magento 1)

Magento stores the recurring profile directly on the customer object. You can read its data using the following code: $collection = Mage::getResourceModel(‘sales/recurring_profile_collection’)->addFieldToFilter(‘customer_id’, $customerId); $profileData = $collection->getData(); $profileData = Mage::getModel(‘sales/recurring_profile’)->load($profileData[0]['profile_id']); $profileShippingAddress = $profileData->getShippingAddressInfo(); // …