title: Magento Have terms and conditions if customer buys certain products
body: <p>I would like to display the terms and conditions (agreements.phtml) only if the customer purchases certain products.  For example, some of our products require a prescription.  It a customer purchases one of these, we would like the terms to appear.</p>
  
  <p>I have created an attribute in the backend: prescription_required</p>
  
  <p>psuedo code is the following:</p>
  
  <pre><code>Loop through products in the basket
      if prescription_required == yes
          set flag to yes
      end if
  end loop
  </code></pre>
  
  <p>if flag is set to yes, go through code in agreements.phtml</p>
  
  <p>I think the main problem I am having is getting the product information in agreements.phmtl and looping through the basket.</p>
  
  <p>I have tried </p>
  
  <pre><code>&lt;?php 
      $_product = Mage::getModel('catalog/product')-&gt;load($this-&gt;getData('product_id'));
      echo $_product-&gt;getName();
  ?&gt; 
  </code></pre>
  
  <p>but nothing is returned.</p>