public function download(VirtualProductOrderDownloadResponseEvent $event)
 {
     $orderProduct = $event->getOrderProduct();
     if ($orderProduct->getVirtualDocument()) {
         // try to get the file
         $path = THELIA_ROOT . ConfigQuery::read('documents_library_path', 'local/media/documents') . DS . "product" . DS . $orderProduct->getVirtualDocument();
         if (!is_file($path) || !is_readable($path)) {
             throw new \ErrorException(Translator::getInstance()->trans("The file [%file] does not exist", ["%file" => $orderProduct->getId()]));
         }
         $response = new BinaryFileResponse($path);
         $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT);
         $event->setResponse($response);
     }
 }
 public function download(VirtualProductOrderDownloadResponseEvent $event)
 {
     $orderProduct = $event->getOrderProduct();
     if ($orderProduct->getVirtualDocument()) {
         $baseSourceFilePath = ConfigQuery::read('documents_library_path');
         if ($baseSourceFilePath === null) {
             $baseSourceFilePath = THELIA_LOCAL_DIR . 'media' . DS . 'documents';
         } else {
             $baseSourceFilePath = THELIA_ROOT . $baseSourceFilePath;
         }
         // try to get the file
         $path = $baseSourceFilePath . DS . 'product' . DS . $orderProduct->getVirtualDocument();
         if (!is_file($path) || !is_readable($path)) {
             throw new \ErrorException(Translator::getInstance()->trans("The file [%file] does not exist", ["%file" => $orderProduct->getId()], VirtualProductDelivery::MESSAGE_DOMAIN));
         }
         $response = new BinaryFileResponse($path);
         $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT);
         $event->setResponse($response);
     }
 }