I want customerId in _initselect method. How can I achieve this ?

protected function _initSelect()
        ['cp1' => $this->getTable('2checkout_ins')],
        'cp1.id =main_table.two_checkout_message_id OR cp1.id = NULL',
        ['cp2' => $this->getTable('paypal_result')],
        'main_table.paypal_id = cp2.id OR cp2.id = NULL',
        return $this;

PLease check below Image: enter image description here

  • please elaborate more where you want customer id is this your custom code or magento code, if it is magento code then write filename and also clarify do you want login customer id ? – Prashant Valanda Jun 18 '18 at 9:50
  • I want customerId in customer edit page in my custom listing page – Rutvee Sojitra Jun 18 '18 at 9:58
  • in admin customer edit page right? – Prashant Valanda Jun 18 '18 at 10:09
  • yes, right@PrashantValanda – Rutvee Sojitra Jun 18 '18 at 10:14
  • $this->getRequest()->getParam('id'); You can get ID by this code in Controller. – anonymous Jun 18 '18 at 10:16

Use \Magento\Backend\Model\SessionFactory $adminsession and get

$admin =  $this->adminsession->create();
return $customerData['customer_data']['customer_id'];
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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