我正在使用magento 1.7我有3种付款方式,所以我想在客户结账时在3种付款方式中随机显示一种付款方式。等待有价值的建议。谢谢阅读。
答案 0 :(得分:0)
看看@ Disable payment options-only cash on delivery for particular product-magento或Cash 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;
}
}