php - Disable Cash on Delivery for specific products -


i have website name shopeling.com running on magento v1.9.0.1. want disable cash on delivery specific products. have installed cod extension magento commerce.

please me code can above mention solution problem. also, have search every on internet no 1 has ever provided code magento v1.9.0.1.

please not provide me other links.

create custom attribute attribute code cod , assign general of attribute sets.

now per requirement change methods.phtml (if there no custom code included in this) follows.

<?php     $methods = $this->getmethods();     $onemethod = count($methods) <= 1; ?> <?php if (empty($methods)): ?>     <dt>         <?php echo $this->__('no payment methods') ?>     </dt> <?php else:     foreach ($methods $_method):         $_code = $_method->getcode(); ?>     <dt>     <?php      //cod verification starts     $attr_cod = array();     $cartitems = mage::getsingleton('checkout/session')->getquote()->getallitems();     foreach ($cartitems $item) {         $attr_cod[] = mage::getmodel('catalog/product')->load($item->getproduct()->getid())->getcod();      }     if(in_array('1', $attr_cod) && $_code == 'cashondelivery') {continue; }     //cod verification ends ?>     <?php if(!$onemethod): ?>          <input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" title="<?php echo $this->escapehtml($_method->gettitle()) ?>" onclick="payment.switchmethod('<?php echo $_code ?>')"<?php if($this->getselectedmethodcode()==$_code): ?> checked="checked"<?php endif; ?> class="radio" />     <?php else: ?>         <span class="no-display"><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" class="radio" /></span>         <?php $onemethod = $_code; ?>     <?php endif; ?>         <label for="p_method_<?php echo $_code ?>"><?php echo $this->escapehtml($this->getmethodtitle($_method)) ?> <?php echo $this->getmethodlabelafterhtml($_method) ?></label>     </dt>     <?php if ($html = $this->getpaymentmethodformhtml($_method)): ?>     <dd>         <?php echo $html; ?>     </dd>     <?php endif; ?> <?php endforeach;     endif; ?> <?php echo $this->getchildchildhtml('additional'); ?> <script type="text/javascript">     //<![cdata[     <?php echo $this->getchildchildhtml('scripts'); ?>     payment.init();     <?php if (is_string($onemethod)): ?>     payment.switchmethod('<?php echo $onemethod ?>');         <?php endif; ?>     //]]> </script> 

i have tested , works fine.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -