每次客户在magento 1.7中退房时更改付款方式

时间:2013-09-20 11:53:00

标签: magento magento-1.7 payment

我正在使用magento 1.7我有3种付款方式,所以我想在客户结账时在3种付款方式中随机显示一种付款方式。等待有价值的建议。谢谢阅读。

1 个答案:

答案 0 :(得分:0)

看看@ Disable payment options-only cash on delivery for particular product-magentoCash On Delivery activated Admin Only ( Not Frontend enabled ) - Magento?

class MagePal_PaymentFilterByProduct_ActivePaymentMethod
{
    //get all active (enable) payment method
    public function toOptionArray()
    {
       $payments = Mage::getSingleton('payment/config')->getActiveMethods();

       //Get current customer id

       //remove method below after check if customer place order before or first order

       foreach ($payments as $paymentCode=>$paymentModel) {
           if($paymentModel->canUseCheckout() == 1){
                $paymentTitle = Mage::getStoreConfig('payment/'.$paymentCode.'/title');
                $methods[$paymentCode] = array(
                    'label'   => $paymentTitle,
                    'value' => $paymentCode,
                );
           }
        }

        return $methods;
    }
}