Piwik\Tracker\GoalManager::detectIsThereExistingCartInVisit PHP Method

detectIsThereExistingCartInVisit() public method

public detectIsThereExistingCartInVisit ( $visitInformation )
    public function detectIsThereExistingCartInVisit($visitInformation)
    {
        if (empty($visitInformation['visit_goal_buyer'])) {
            return false;
        }
        $goalBuyer = $visitInformation['visit_goal_buyer'];
        $types = array(GoalManager::TYPE_BUYER_OPEN_CART, GoalManager::TYPE_BUYER_ORDERED_AND_OPEN_CART);
        // Was there a Cart for this visit prior to the order?
        return in_array($goalBuyer, $types);
    }

Usage Example

 public function afterRequestProcessed(VisitProperties $visitProperties, Request $request)
 {
     $goalsConverted = $request->getMetadata('Goals', 'goalsConverted');
     if (!empty($goalsConverted)) {
         $isThereExistingCartInVisit = $this->goalManager->detectIsThereExistingCartInVisit($visitProperties->getProperties());
         $request->setMetadata('Goals', 'isThereExistingCartInVisit', $isThereExistingCartInVisit);
     }
 }
All Usage Examples Of Piwik\Tracker\GoalManager::detectIsThereExistingCartInVisit