Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Remove payment method when cart qty more than X
 
Vofka
Jr. Member
 
Avatar
Total Posts:  30
Joined:  2008-06-19
 

Hello magento developers,
It would be great if you help me, I need to remove payment method if cart qty more than some value, 5 for example.

Thank you, I’ll be looking forward.

 
Magento Community Magento Community
Magento Community
Magento Community
 
gabrielk
Sr. Member
 
Avatar
Total Posts:  83
Joined:  2007-11-30
 

Edit app/design/frontend/default/default/template/checkout/onepage/payment/methods.phtml and add in this line:

<?php
    
if($this->helper('checkout/cart')->getItemsQty() > && $_code=='my_payment_method'continue; } ?>

Change “my_payment_method” to whatever the code for the payment method is, e.g. ‘paypal_standard’ or ‘verisign’.

You want to put it at the start of the foreach loop, like so:

<div class="payment-methods">
    <
dl id="checkout-payment-method-load">
    
<?php foreach ($this->getMethods() as $_method): $_code $_method->getCode() ?>
    <?php
    
if($this->helper('checkout/cart')->getItemsQty() > && $_code=='my_payment_method'continue; } ?>
        
<dt>
        
<?php if( sizeof($this->getMethods()) > ): ?>
            
<input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" title="<?php echo $this->htmlEscape($_method->getTitle()) ?>" class="radio" onclick="payment.switchMethod('<?php echo $_code ?>')"<?php if($this->getSelectedMethodCode()==$_code): ?> checked="checked"<?php endif; ?> />
        
<?php else: ?>
            
<span class="no-display"><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" /></span>
        
<?php endif; ?>
            
<label for="p_method_<?php echo $_code ?>"><?php echo $_method->getTitle() ?></label>
        </
dt>
        
<?php if($html $this->getChildHtml('payment.method.'.$_code)): ?>
        
<dd>
            
<?php echo $html?>
        
</dd>
        
<?php endif; ?>
    <?php 
endforeach; ?>
    
</dl>
</
div>
<
script type="text/javascript">payment.init();</script>
 
Magento Community Magento Community
Magento Community
Magento Community
 
Vofka
Jr. Member
 
Avatar
Total Posts:  30
Joined:  2008-06-19
 

Thx gabrielk!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top