2

I have a SQL query where I want to append $customerID, how to achieve that?

>    SELECT `e`.*, `at_assigned_campus_manager`.`value` AS
> `assigned_campus_manager`, `at_physical_verify`.`value` AS
> `physical_verify` FROM `customer_entity` AS `e` INNER JOIN
> `customer_entity_varchar` AS `at_assigned_campus_manager` ON
> (`at_assigned_campus_manager`.`entity_id` = `e`.`entity_id`) AND
> (`at_assigned_campus_manager`.`attribute_id` = '183') LEFT JOIN
> `customer_entity_int` AS `at_physical_verify` ON
> (`at_physical_verify`.`entity_id` = `e`.`entity_id`) AND
> (`at_physical_verify`.`attribute_id` = '209') WHERE
> (`e`.`entity_type_id` = '1') AND (at_assigned_campus_manager.value 
> **LIKE '"$customerId/%"' )** AND (at_physical_verify.value IS NULL) AND
> (`e`.`group_id` IN(4, 5, 6)) LIMIT ".$page." 50 " 
> 
> 
> getting error Parse error: syntax error, unexpected '$customerId'
> (T_VARIABLE)
Here is the collection  Mage::getModel("customer/customer")->getCollection()
                                                                      ->addAttributeToSelect('firstname, entity_id')
                                                                      ->addFieldToFilter('assigned_campus_manager',array('like' => $customerId . '/%'))
                                                                      ->addAttributeToFilter('physical_verify', array('null' => true),'left')
                                                                      ->addFieldToFilter('group_id', array('in' => array(4,5,6)))
                                                                      ->setPage($page,50)
3
  • send collection code please Aug 18 '17 at 6:14
  • Added in Question Aug 18 '17 at 6:22
  • I assume you are using custom field created in customer ->addAttributeToFilter('assigned_campus_manager',array('like' => $customerId . '%')). shall i know where you got $customerID? you writing right $customerID is right in model. try to use ->setCurPage($page) ->setPageSize(50); Aug 18 '17 at 9:00
0
Mage::getModel("customer/customer")->getCollection()
    ->addAttributeToSelect('firstname, entity_id')
    ->addFieldToFilter('assigned_campus_manager',array('like' =>"{$customerId}/%"))
    ->addAttributeToFilter('physical_verify', array('null' => true),'left')
    ->addFieldToFilter('group_id', array('in' => array(4,5,6)))
    ->setPage($page,50)

Please try it

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.