@@ 223-237 (lines=15) @@ | ||
220 | * |
|
221 | * @return int |
|
222 | */ |
|
223 | public function getOrderConversionValues($dateRange) |
|
224 | { |
|
225 | $result = 0; |
|
226 | ||
227 | list($start, $end) = $this->dateHelper->getPeriod($dateRange, 'OroCRMMagentoBundle:Order', 'createdAt'); |
|
228 | $visitsQb = $this->channelRepository->getVisitsCountForChannelTypeQB(ChannelType::TYPE); |
|
229 | $this->applyDateFiltering($visitsQb, 'visit.firstActionTime', $start, $end); |
|
230 | $visits = (int)$this->aclHelper->apply($visitsQb)->getSingleScalarResult(); |
|
231 | if ($visits != 0) { |
|
232 | $ordersCount = $this->getOrdersNumberValues($dateRange); |
|
233 | $result = $ordersCount / $visits; |
|
234 | } |
|
235 | ||
236 | return $result; |
|
237 | } |
|
238 | ||
239 | /** |
|
240 | * @param array $dateRange |
|
@@ 244-259 (lines=16) @@ | ||
241 | * |
|
242 | * @return int |
|
243 | */ |
|
244 | public function getCustomerConversionValues($dateRange) |
|
245 | { |
|
246 | $result = 0; |
|
247 | ||
248 | list($start, $end) = $this->dateHelper->getPeriod($dateRange, 'OroCRMMagentoBundle:Customer', 'createdAt'); |
|
249 | ||
250 | $visitsQb = $this->channelRepository->getVisitsCountForChannelTypeQB(ChannelType::TYPE); |
|
251 | $this->applyDateFiltering($visitsQb, 'visit.firstActionTime', $start, $end); |
|
252 | $visits = (int)$this->aclHelper->apply($visitsQb)->getSingleScalarResult(); |
|
253 | if ($visits !== 0) { |
|
254 | $customers = $this->getNewCustomersCountValues($dateRange); |
|
255 | $result = $customers / $visits; |
|
256 | } |
|
257 | ||
258 | return $result; |
|
259 | } |
|
260 | ||
261 | /** |
|
262 | * @return OrderRepository |