12 class Collection extends \Magento\Quote\Model\ResourceModel\Quote\Collection
31 \Psr\Log\LoggerInterface
$logger,
64 'main_table.is_active',
67 'main_table.customer_id',
75 if (isset($filter[
'email']) || isset($filter[
'customer_name'])) {
78 if (is_array($storeIds) && !empty($storeIds)) {
93 $customersSelect = $this->customerResource->getConnection()->select();
94 $customersSelect->from(
95 [
'customer' => $this->customerResource->getTable(
'customer_entity')],
98 if (isset($filter[
'customer_name'])) {
99 $customerName = $this->customerResource->getConnection()
100 ->getConcatSql([
'customer.firstname',
'customer.lastname'],
' ');
101 $customersSelect->where($customerName .
' LIKE ?',
'%' . $filter[
'customer_name'] .
'%');
103 if (isset($filter[
'email'])) {
104 $customersSelect->where(
'customer.email LIKE ?',
'%' . $filter[
'email'] .
'%');
106 $filteredCustomers = $this->customerResource->getConnection()->fetchCol($customersSelect);
107 $this->
getSelect()->where(
'main_table.customer_id IN (?)', $filteredCustomers);
120 if (is_array($storeIds)) {
122 [
'subtotal' =>
'(main_table.base_subtotal_with_discount*main_table.base_to_global_rate)']
124 $this->_joinedFields[
'subtotal'] =
125 '(main_table.base_subtotal_with_discount*main_table.base_to_global_rate)';
127 $this->
getSelect()->columns([
'subtotal' =>
'main_table.base_subtotal_with_discount']);
128 $this->_joinedFields[
'subtotal'] =
'main_table.base_subtotal_with_discount';
131 if ($filter && is_array($filter) && isset($filter[
'subtotal'])) {
132 if (isset($filter[
'subtotal'][
'from'])) {
134 $this->_joinedFields[
'subtotal'] .
' >= ?',
135 $filter[
'subtotal'][
'from'],
139 if (isset($filter[
'subtotal'][
'to'])) {
141 $this->_joinedFields[
'subtotal'] .
' <= ?',
142 $filter[
'subtotal'][
'to'],
158 $select = $this->customerResource->getConnection()->select();
159 $customerName = $this->customerResource->getConnection()->getConcatSql([
'firstname',
'lastname'],
' ');
162 [
'customer' => $this->customerResource->getTable(
'customer_entity')],
163 [
'entity_id',
'email']
166 [
'customer_name' => $customerName]
169 'customer.entity_id IN (?)',
175 $customersData = $this->customerResource->getConnection()->fetchAll(
$select);
178 foreach ($customersData as $customerItemData) {
179 if (
$item[
'customer_id'] == $customerItemData[
'entity_id']) {
180 $item->setData(array_merge(
$item->getData(), $customerItemData));
addFieldToFilter($attribute, $condition=null)
addCustomerData($filter=null)
__construct(\Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory, \Psr\Log\LoggerInterface $logger, \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Framework\Event\ManagerInterface $eventManager, \Magento\Framework\Model\ResourceModel\Db\VersionControl\Snapshot $entitySnapshot, \Magento\Customer\Model\ResourceModel\Customer $customerResource, \Magento\Framework\DB\Adapter\AdapterInterface $connection=null, \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource=null)
prepareForAbandonedReport($storeIds, $filter=null)
addSubtotal($storeIds='', $filter=null)