public function initInstantOrder($customerId)
    {
        if (! $customerId) {
            throw new RecordNotFoundException('customerId not passed');
        }
        
        $this->Customer = TableRegistry::getTableLocator()->get('Customers');
        $instantOrderCustomer = $this->Customer->find('all', [
            'conditions' => [
                'Customers.id_customer' => $customerId
            ],
            'contain' => [
                'AddressCustomers'
            ]
        ])->first();
        if (! empty($instantOrderCustomer)) {
            $this->getRequest()->getSession()->write('Auth.instantOrderCustomer', $instantOrderCustomer);
        } else {
            $this->Flash->error(__d('admin', 'No_member_found_with_id_{0}.', [$customerId]));
        }
        $this->redirect('/');
    }
public function initInstantOrder($customerId)
    {
        if (! $customerId) {
            throw new RecordNotFoundException('customerId not passed');
        }
        
        $this->Customer = TableRegistry::getTableLocator()->get('Customers');
        $instantOrderCustomer = $this->Customer->find('all', [
            'conditions' => [
                'Customers.id_customer' => $customerId
            ],
            'contain' => [
                'AddressCustomers'
            ]
        ])->first();
        if (! empty($instantOrderCustomer)) {
            $this->getRequest()->getSession()->write('Auth.instantOrderCustomer', $instantOrderCustomer);
        } else {
            $this->Flash->error(__d('admin', 'No_member_found_with_id_{0}.', [$customerId]));
        }
        $this->redirect('/');
    }
public function initInstantOrder ( $ customerId ) { if ( ! $ customerId ) { throw new RecordNotFoundException ( 'customerId not passed' ) ; } $ this -> Customer = TableRegistry :: getTableLocator ( ) -> get ( 'Customers' ) ; $ instantOrderCustomer = $ this -> Customer -> find ( 'all' , [ 'conditions' => [ 'Customers.id_customer' => $ customerId ] , 'contain' => [ 'AddressCustomers' ] ] ) -> first ( ) ; if ( ! empty ( $ instantOrderCustomer ) ) { $ this -> getRequest ( ) -> getSession ( ) -> write ( 'Auth.instantOrderCustomer' , $ instantOrderCustomer ) ; } else { $ this -> Flash -> error ( __d ( 'admin' , 'No_member_found_with_id_{0}.' , [ $ customerId ] ) ) ; } $ this -> redirect ( '/' ) ; }
this url is called if instant order is initialized
saves the desired user in session
this url is called if instant order is initialized saves the desired user in session