News:

Looking for documentation? Take a look on our wiki

Main Menu

Cart Comment Different for each category

Started by lostpanther, October 30, 2013, 17:50:17 PM

Previous topic - Next topic

lostpanther

Hi Guys,
really need help,
i have two product categories but each category requires a different comment respnse box at the bottom of the cart,
iv located the default.php file from the virtuemart assets/cart folder.

i am hopiing to use a php if else instruction but am limited on knowledge of its use,
i have two categorys in my shop
cat id = 1
and
cat id = 2
i wish to display the comment for cat id 1 and hide the comment for cat id 2
the original code is below and my own version is below that

OLD
----

<?php // Leave A Comment Field ?>
   <div class="customer-comment marginbottom15">
         <span class="comment"><?php echo JText::_ ('COM_VIRTUEMART_COMMENT_CART'); ?></span><br/>
         <textarea class="customer-comment" name="customer_comment" cols="60" rows="1"><?php echo $this->cart->customer_comment; ?></textarea>
      


         <!--<span class="comment"><?php echo JText::_ ('COM_VIRTUEMART_COMMENTNAME_CART'); ?></span><br/>-->
         <!--<textarea class="customer-comment" name="customer_commentname" cols="60" rows="1"><?php echo $this->cart->customer_commentname; ?></textarea>-->
      </div>


      <?php // Leave A Comment Field END ?>


NEW
-----

<?php // Leave A Comment Field ?>
<?php
if (JRequest::getVar('option') == 'com_virtuemart' ){?>
      <?php $catid = JRequest::getInt('category_id');
      if($catid=1)
{
      <div class="customer-comment marginbottom15">
         <span class="comment"><?php echo JText::_ ('COM_VIRTUEMART_COMMENT_CART'); ?></span><br/>
         <textarea class="customer-comment" name="customer_comment" cols="60" rows="1"><?php echo $this->cart->customer_comment; ?></textarea>
      


         <!--<span class="comment"><?php echo JText::_ ('COM_VIRTUEMART_COMMENTNAME_CART'); ?></span><br/>-->
         <!--<textarea class="customer-comment" name="customer_commentname" cols="60" rows="1"><?php echo $this->cart->customer_commentname; ?></textarea>-->
      </div>
}
?>

  <?php }?>

      <?php // Leave A Comment Field END ?>

----------

can anyone point me in the right direction please :)

regards matt