0

I am working on the downloadable products site.i had uploaded sample file for the product.now i need to play this sample file in the video player.

I know their is one setting in the backend under System > Config > Catalog > Dowloaded Information Tab.

Their Use Content-Disposition if i use inline i can play this video.but if i do this then my customers from myaccount under Downloadble Products not able to download. they can download if the setting is attachment.then in this case on the frontend the sample file also gets dowladed.

in General I need frontend file to play and customer myaccount file to download.

I tried giving src to the video player like in the following format.

http://www.mywebsite.com/downloadable/files/samples/v/i/video.mp4

but video player says this file or src not found.

Please Help me.

Thanks

0

check these controller Mage_Downloadable_DownloadController, below is the action which is called when you hit the preview button

public function sampleAction()
    {
        $sampleId = $this->getRequest()->getParam('sample_id', 0);
        $sample = Mage::getModel('downloadable/sample')->load($sampleId);
        if ($sample->getId()) {
            $resource = '';
            $resourceType = '';
            if ($sample->getSampleType() == Mage_Downloadable_Helper_Download::LINK_TYPE_URL) {
                $resource = $sample->getSampleUrl();
                $resourceType = Mage_Downloadable_Helper_Download::LINK_TYPE_URL;
            } elseif ($sample->getSampleType() == Mage_Downloadable_Helper_Download::LINK_TYPE_FILE) {
                $resource = Mage::helper('downloadable/file')->getFilePath(
                    Mage_Downloadable_Model_Sample::getBasePath(), $sample->getSampleFile()
                );
                $resourceType = Mage_Downloadable_Helper_Download::LINK_TYPE_FILE;
            }
            try {
                $this->_processDownload($resource, $resourceType);
                exit(0);
            } catch (Mage_Core_Exception $e) {
                $this->_getSession()->addError(Mage::helper('downloadable')->__('Sorry, there was an error getting requested content. Please contact the store owner.'));
            }
        }
        return $this->_redirectReferer();
    }

modify the conditions as per your requirement.

1
  • Thanks for your hint.i had debugged and solved.but it was the other function.but your hint had worked for me.thanks a lot. Jul 3 '14 at 19:04
0

After Some Debug in the core file i found the solution to my problem and i am sharing my answer.

I had to override function in controller to achieve this task.for this i had created one module which overrides Mage_Downloadable's Download Controller.

and answer to this question is at http://magento.stackexchange.com/a/25946/4556

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.