Friday 8 April 2016

magento how to get sample file of downloadable products

 <?php $_myprodsamples = Mage::getModel('downloadable/sample');
 $download_fileUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)."downloadable/files/samples";
$_mySampleCollection = $_myprodsamples->getCollection()
                   ->addProductToFilter($_product->getId())
                   ->addTitleToResult($_product->getStoreId());
?>



<?php foreach ($_mySampleCollection as $_sample1){
  //echo $_samplelink = $this->getUrl('downloadable/download/linkSample/link_id/'.$_sample ->getId());
   echo $_sample1->getSampleType(); //get file type
  echo $download_fileUrl.$_sample1->getSampleFile(); //Get file with url
  echo $_sample1->getSampleUrl();//get url if exist
   echo $_sample1->getTitle();
   print_r($_sample1); }?>

No comments:

Post a Comment