1

Extension "Sales Reps and Dealers" by Amasty

I have the User ID of my customer and the Dealer ID of the Dealer I want them to have, how can i programmatically change their dealer to the new one?

In my observer when a customer is successfully registered I grab their ID:

$customerId = $observer->getCustomer()->getId();

Then I load the customer with:

$customer = Mage::getModel('customer/customer')->load($customerId);

At this point I also have the dealer's ID but don't know how to change the customer's dealer to that dealer. It doesn't show as an attribute when I var_export the $customer.

closed as off-topic by Rajeev K Tomy, Siarhey Uchukhlebau, Keyul Shah, Arunendra, Murtuza Zabuawala Feb 23 '17 at 11:44

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about third-party modules are generally off-topic because the scope of functionality and code are not available. For more information, see this meta post/answer." – Rajeev K Tomy, Siarhey Uchukhlebau, Keyul Shah, Arunendra, Murtuza Zabuawala
If this question can be reworded to fit the rules in the help center, please edit the question.

1

Please use the following php code:

Mage::getModel('amperm/perm')->assignOneCustomer($uid, $cid);

where:

$uid - dealer (user) entity id;
$cid - customer entity id.
  • This doesn't work. Does it matter if I'm trying to do this in an event observer when a customer is successfully registered? – CodingMageSheen Feb 22 '17 at 19:19
  • Wait it may work let me do some testing before up voting your answer – CodingMageSheen Feb 22 '17 at 19:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.