Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. <?php
  2.  
  3. $installer = $this;
  4.  
  5. $installer->startSetup();
  6.  
  7. $installer->run("
  8.  
  9. DROP TABLE IF EXISTS {$this->getTable('customer_manager')};
  10. CREATE TABLE {$this->getTable('customer_manager')} (
  11. `manager_id` int(11) unsigned NOT NULL auto_increment,
  12. `title` varchar(255) NOT NULL default '',
  13. `email` varchar(255) NOT NULL default '',
  14. `password` varchar(255) NOT NULL default '',
  15. `parentuser_id` int(11) NOT NULL default ''
  16. PRIMARY KEY (`manager_id`)
  17. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  18.  
  19. ");
  20.  
  21. $installer->endSetup();
  22.  
  23. class Excellence_Manager_Model_Entity_Customer extends Mage_Customer_Model_Resource_Customer {
  24. public function loadByUsername(Mage_Customer_Model_Customer $customer, $username)
  25. {
  26.  
  27. try {
  28. $select = $this->_getReadAdapter()->select()
  29. ->from(array('c' => $this->getEntityTable()), array($this->getEntityIdField()))
  30. ->joinNatural(array('cev' => $this->getTable('customer_entity_varchar')))
  31. ->joinNatural(array('ea' => $this->getTable('eav/attribute')))
  32. ->joinLeft(array('mn' => $this->getTable('customer_manager')), 'mn.parentuser_id=c.entity_id')
  33. ->where('ea.attribute_code='username' AND cev.value=?',$username);
  34. }catch(Exception $ex)
  35. {
  36. echo $ex;
  37. }
  38. $this->load($customer, $id);
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement