22 $sampleId = $this->
getRequest()->getParam(
'sample_id', 0);
24 $sample = $this->_objectManager->create(\
Magento\Downloadable\Model\Sample::class)->load($sampleId);
25 if ($sample->getId()) {
28 if ($sample->getSampleType() == DownloadHelper::LINK_TYPE_URL) {
30 $resourceType = DownloadHelper::LINK_TYPE_URL;
31 }
elseif ($sample->getSampleType() == DownloadHelper::LINK_TYPE_FILE) {
33 $helper = $this->_objectManager->get(\
Magento\Downloadable\Helper\File::class);
34 $resource =
$helper->getFilePath($sample->getBasePath(), $sample->getSampleFile());
35 $resourceType = DownloadHelper::LINK_TYPE_FILE;
38 $this->_processDownload(
$resource, $resourceType);
40 }
catch (\Exception $e) {
41 $this->messageManager->addError(
42 __(
'Sorry, there was an error getting requested content. Please contact the store owner.')
_redirect($path, $arguments=[])
elseif(isset( $params[ 'redirect_parent']))