SHARE
TWEET

Untitled

a guest Jul 16th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if($_product->getTypeId() == 'downloadable') {
  2.     /** @var Mage_Downloadable_Model_Resource_Sample_Collection $samples */
  3.     $samples = Mage::getModel('downloadable/sample')->getCollection()->addProductToFilter($product_id);
  4.     if ($samples) {
  5.         $_myprodsamples = Mage::getModel('downloadable/link');
  6.         $_mySampleCollection = $_myprodsamples->getCollection()->addProductToFilter($_product->getId());
  7.         foreach ($_mySampleCollection as $_sample){
  8.             $_samplelink = $this->getUrl('downloadable/download/linkSample/link_id/'.$_sample ->getId());
  9.         }  
  10.     }  
  11. }
  12.  
  13.  
  14. <?php if($_samplelink): ?>
  15.   <a href="<?php echo $_samplelink ?>" class="button btn-cart piwik_download" target="_blank">Downnload</a>
  16. <?php else: ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top