Sample URL Links not working for Downloadable Products in Magento

Posted by: Karen Friday, November 12th, 2010

On www.webshopapps.com we want to show our documentation under the docs&demos tab. We are using the samples feature in Magento to do this – all our products are downloadable. 

We found using a URL link sometimes works and sometimes causes issues. This is due to Magento adding a level of abstraction that we don’t believe is required. It would do something like this: 

www.webshopapps.com/downloadable/download/sample/id/product/3.  Whereas we just want it to do: 

wiki.webshopapps.com 

I looked in the codebase and changed the file app/code/core/Mage/Downloadable/Block/Catalog/Product/Samples.php as follows: 

 
public function getSampleUrl($sample) {
    if ($sample->getSampleType() == Mage_Downloadable_Helper_Download::LINK_TYPE_URL) {
          return $sample->getSampleUrl();  

     } else {

        return $this->getUrl(‘downloadable/download/sample’, array(‘sample_id’ => $sample->getId()));      

    }

Comments are closed.