Vinai / customer-activation

Magento extension which makes it impossible for a customer to log in until the account has been activated by the administrator.
120 stars 59 forks source link

Sending additional customer data to admin #45

Closed milenp closed 7 years ago

milenp commented 10 years ago

Hi Vinai, found a small issue in the module. In my configuration I require customer full details (including company name, address,country etc.). When I try to send for example Telephone, Country and Company to site admin they are empty. Small addition helped me in this. I call Mage::getModel("customer/customer")->load(...) and then use this object when passing billing and shipping params to the emails. Think it is wroth looking at.

Thanks Milen

Vinai commented 10 years ago

Hi Milen,

can you please let me know which Magento version you are using?

milenp commented 10 years ago

1.8.x is live site, but it is also valid for 1.7.2 admin template addition was kind of ((var.billing.getTelephone}} as a hint

Vinai commented 10 years ago

Thanks! I'll have to test if I can reproduce the issue to fix it. The next weeks I'm out of the office giving trainings, but I hope to squeeze it in as soon as possible!

Vinai commented 10 years ago

Has this issue already been resolved for you or is it still current?

milenp commented 10 years ago

I solved it myself on our live install, and since then I did not check if there are any updates. As per my original message modifying your original code with this Mage::getModel("customer/customer")->load(...) solved my problems.

Markblu commented 10 years ago

Hi Vinai, I'm testing your extension on magento 1.9.0.1, all work great! But I've the same problem, i've a registration form with billing address and shipping address, but I can't retrive the data on the notify email to admin.. how should I do? Thanks a lot!

milenp commented 10 years ago

Mrkblu, as I wrote before a simple change in the module's helper solved my issue. What I did is like this: In helper/data.php method _sendNotificationEmail(...) I added the following line $my_cust = Mage::getModel("customer/customer")->load($customer->getId()); just above the $mailTemplate->sendTransactional(......). Then I can pass anything to the email using for example this: array( 'customer' => $customer, 'shipping' => $my_cust->getPrimaryShippingAddress(), 'billing' => $my_cust->getPrimaryBillingAddress() } And of course then you need to adjust the email template and use variables passed. Hope this helps as an immediate solution. The $customer parameter of the _sendNotificationEmail(...) method is not a full instance of the customer, so that is why I am loading it first Regards Milen

Markblu commented 10 years ago

Thanks, I had seen your code but probably I'm wrong on calling the data from tha mail I've tried: Telefono: {{var shipping.getTelephone()}}

milenp commented 10 years ago

It works fine for me with customized template in the backend. You can try with {{var billing.getTelephone()}}. The other way is to add a var_dump or log and see what data is sent to the template. Also it wont work if the address at registration is not set as primary billing/shipping. Hope this helps.