gpt4 book ai didi

Magento 1.6.2 删除 Paypal 订单状态

转载 作者:太空宇宙 更新时间:2023-11-03 16:20:12 25 4
gpt4 key购买 nike

我正在运行 Magento 1.6.2 并想删除 Paypal 订单状态。它们根本没有被使用,它们污染了我的订单状态列表。禁用 Paypal 不起作用。

Magento 1.6.2 确实具有在管理员中管理订单状态的良好功能,但 Paypal 状态是不可删除的。

有什么方法可以从数据库中硬删除它们,或者只是以某种方式隐藏它们?

最佳答案

我可以告诉您,您不想删除它们,Mage_Paypal_Model_Info 使用它们来检查付款是否正在审查、欺诈、处理或完成。我建议你只处理它们。它们作为 const 存在是为了某种目的,即使您实际上可能没有使用它们,但它们是在幕后使用的。他们做的好事比他们真正做的坏事多。

   /**
* Check whether the payment is in review state
*
* @param Mage_Payment_Model_Info $payment
* @return bool
*/
public static function isPaymentReviewRequired(Mage_Payment_Model_Info $payment)
{
$paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL);
if (self::PAYMENTSTATUS_PENDING === $paymentStatus) {
$pendingReason = $payment->getAdditionalInformation(self::PENDING_REASON_GLOBAL);
return !in_array($pendingReason, array('authorization', 'order'));
}
return false;
}

/**
* Check whether fraud order review detected and can be reviewed
*
* @param Mage_Payment_Model_Info $payment
* @return bool
*/
public static function isFraudReviewAllowed(Mage_Payment_Model_Info $payment)
{
return self::isPaymentReviewRequired($payment)
&& 1 == $payment->getAdditionalInformation(self::IS_FRAUD_GLOBAL);
}

/**
* Check whether the payment is completed
*
* @param Mage_Payment_Model_Info $payment
* @return bool
*/
public static function isPaymentCompleted(Mage_Payment_Model_Info $payment)
{
$paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL);
return self::PAYMENTSTATUS_COMPLETED === $paymentStatus;
}

/**
* Check whether the payment was processed successfully
*
* @param Mage_Payment_Model_Info $payment
* @return bool
*/
public static function isPaymentSuccessful(Mage_Payment_Model_Info $payment)
{
$paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL);
if (in_array($paymentStatus, array(
self::PAYMENTSTATUS_COMPLETED, self::PAYMENTSTATUS_INPROGRESS, self::PAYMENTSTATUS_REFUNDED,
self::PAYMENTSTATUS_REFUNDEDPART, self::PAYMENTSTATUS_UNREVERSED, self::PAYMENTSTATUS_PROCESSED,
))) {
return true;
}
$pendingReason = $payment->getAdditionalInformation(self::PENDING_REASON_GLOBAL);
return self::PAYMENTSTATUS_PENDING === $paymentStatus
&& in_array($pendingReason, array('authorization', 'order'));
}

/**
* Check whether the payment was processed unsuccessfully or failed
*
* @param Mage_Payment_Model_Info $payment
* @return bool
*/
public static function isPaymentFailed(Mage_Payment_Model_Info $payment)
{
$paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL);
return in_array($paymentStatus, array(
self::PAYMENTSTATUS_DENIED, self::PAYMENTSTATUS_EXPIRED, self::PAYMENTSTATUS_FAILED,
self::PAYMENTSTATUS_REVERSED, self::PAYMENTSTATUS_VOIDED,
));
}

如果你查看 app/code/core/Mage/Paypal/etc/config.xml 你可以找到这个,

<sales>
<order>
<statuses>
<pending_paypal translate="label">
<label>Pending PayPal</label>
</pending_paypal>
</statuses>
</order>
</sales>

但是看看 app/code/core/Mage/Sales/etc/config.xml

        <!-- /**
* @depraceted after 1.4.2, statuses are saved into sales_order_status table
*/
-->

如果您使用的是 1.4.2 之后的版本,您应该查看数据库中的 sales_order_status 表,这是它们存在于 config.xml 中以确保向后兼容性的唯一原因。

这是添加 Pending PayPal 状态的部分,您可以评论/删除并删除它,但我建议您在删除之前找出使用此状态的位置,这样您就没有任何看不见的冲突,您可以在 app/code 和 lib/中使用 grep -r 'sales_order_status' * 来查找可能使用此表的任何内容以及何时可能使用 Pending PayPal

关于Magento 1.6.2 删除 Paypal 订单状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10171425/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com