0

我正在使用 magento 1.7 我有 3 种付款方式,所以我想在客户结帐期间在 3 种付款方式中随机显示一种付款方式。等待宝贵的建议。感谢阅读。

4

1 回答 1

0

看看@ Disable payment options-only cash on delivery for specific product-magentoCash On Delivery 激活 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;
    }
}
于 2013-09-20T15:48:32.993 回答