Magento 1.4 贝宝错误

发布于 2024-09-11 02:26:22 字数 311 浏览 3 评论 0原文

我尝试在我的 magento 1.4 中运行 paypal 付款,但工作流程存在严重问题。在我选择 paypal 并路由到 paypal 帐户发送资金后,您通常会自动返回到 magento 商店以完成订单,但在我的情况下,magento 告诉您地址字段有问题。 paypal 没有正确地将地址发送回 magento:

Error: Please check shipping address information. Please enter last name.

这是一个已知的错误还是有补丁或解决方法?

请帮忙! 谢谢。

i try to get the paypal payment run in my magento 1.4 but there is a serious problem with the workflow. after i select paypal and get routed to the paypal account to send the money you normally come back automatically into the magento shop to finish the order, but in my case magento tells you there is aproblem with the adress field. paypal does'nt send the adress back to magento correctly:

Error: Please check shipping address information. Please enter last name.

is this a known bug or is there a patch or workaround?

please help!
thnx.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

遗弃M 2024-09-18 02:26:23

该错误似乎位于 /app/code/core/Mage/Paypal/Model/Api/Nvp.php 中。看起来变量映射得不好。因为我在这个文件中找不到具体的错误,所以我在 /app/code/core/Mage/Paypal/Model/Express/Checkout.php 中做了一些肮脏的解决方法。

1.4.2 中,只需将方法 returnFromPaypal() 替换为以下代码...

public function returnFromPaypal($token)
{
    $this->_getApi();
    $this->_api->setToken($token)
        ->callGetExpressCheckoutDetails();

    // import billing address
    $billingAddress = $this->_quote->getBillingAddress();
    $exportedBillingAddress = $this->_api->getExportedBillingAddress();

    // import shipping address
    $exportedShippingAddress = $this->_api->getExportedShippingAddress();
    if (!$this->_quote->getIsVirtual()) {
        $shippingAddress = $this->_quote->getShippingAddress();
        if ($shippingAddress) {
            if ($exportedShippingAddress) {
                foreach ($exportedShippingAddress->getExportedKeys() as $key) {
                    if('firstname' == $key || 'lastname' == $key){
                        continue;
                    } // if
                    $shippingAddress->setDataUsingMethod($key, $exportedShippingAddress->getData($key));
                    $billingAddress->setDataUsingMethod($key, $exportedShippingAddress->getData($key));
                }

                // Correct First- and Lastnames
                list($_firstname, $_lastname) = explode(' ', $exportedShippingAddress->getData('firstname'));

                $shippingAddress->setDataUsingMethod('firstname', $_firstname);
                $billingAddress->setDataUsingMethod('firstname', $_firstname);

                $shippingAddress->setDataUsingMethod('lastname', $_lastname);
                $billingAddress->setDataUsingMethod('lastname', $_lastname);

                $shippingAddress->setCollectShippingRates(true);
            }

            // import shipping method
            $code = '';
            if ($this->_api->getShippingRateCode()) {
                if ($code = $this->_matchShippingMethodCode($shippingAddress, $this->_api->getShippingRateCode())) {
                     // possible bug of double collecting rates :-/
                    $shippingAddress->setShippingMethod($code)->setCollectShippingRates(true);
                }
            }
            $this->_quote->getPayment()->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_METHOD, $code);
        }
    }
    $this->_ignoreAddressValidation();

    // import payment info
    $payment = $this->_quote->getPayment();
    $payment->setMethod($this->_methodType);
    Mage::getSingleton('paypal/info')->importToPayment($this->_api, $payment);
    $payment->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_PAYER_ID, $this->_api->getPayerId())
        ->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_TOKEN, $token)
    ;
    $this->_quote->collectTotals()->save();
}

修改后的代码将整个帐单地址替换为送货地址,并推送在中给出的名称$firstname 转换为 $firstname 和 $lastname。

不干净,但工作。 :-)

The error seems to be in /app/code/core/Mage/Paypal/Model/Api/Nvp.php. Looks like the vars aren't mapped well. Because I couldn't find the concrete error in this file, I did a bit dirty workaround in /app/code/core/Mage/Paypal/Model/Express/Checkout.php.

In 1.4.2 just replace the method returnFromPaypal() with the following code...

public function returnFromPaypal($token)
{
    $this->_getApi();
    $this->_api->setToken($token)
        ->callGetExpressCheckoutDetails();

    // import billing address
    $billingAddress = $this->_quote->getBillingAddress();
    $exportedBillingAddress = $this->_api->getExportedBillingAddress();

    // import shipping address
    $exportedShippingAddress = $this->_api->getExportedShippingAddress();
    if (!$this->_quote->getIsVirtual()) {
        $shippingAddress = $this->_quote->getShippingAddress();
        if ($shippingAddress) {
            if ($exportedShippingAddress) {
                foreach ($exportedShippingAddress->getExportedKeys() as $key) {
                    if('firstname' == $key || 'lastname' == $key){
                        continue;
                    } // if
                    $shippingAddress->setDataUsingMethod($key, $exportedShippingAddress->getData($key));
                    $billingAddress->setDataUsingMethod($key, $exportedShippingAddress->getData($key));
                }

                // Correct First- and Lastnames
                list($_firstname, $_lastname) = explode(' ', $exportedShippingAddress->getData('firstname'));

                $shippingAddress->setDataUsingMethod('firstname', $_firstname);
                $billingAddress->setDataUsingMethod('firstname', $_firstname);

                $shippingAddress->setDataUsingMethod('lastname', $_lastname);
                $billingAddress->setDataUsingMethod('lastname', $_lastname);

                $shippingAddress->setCollectShippingRates(true);
            }

            // import shipping method
            $code = '';
            if ($this->_api->getShippingRateCode()) {
                if ($code = $this->_matchShippingMethodCode($shippingAddress, $this->_api->getShippingRateCode())) {
                     // possible bug of double collecting rates :-/
                    $shippingAddress->setShippingMethod($code)->setCollectShippingRates(true);
                }
            }
            $this->_quote->getPayment()->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_METHOD, $code);
        }
    }
    $this->_ignoreAddressValidation();

    // import payment info
    $payment = $this->_quote->getPayment();
    $payment->setMethod($this->_methodType);
    Mage::getSingleton('paypal/info')->importToPayment($this->_api, $payment);
    $payment->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_PAYER_ID, $this->_api->getPayerId())
        ->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_TOKEN, $token)
    ;
    $this->_quote->collectTotals()->save();
}

The modified code replaces the whole billing address with the shipping address and pushes the name given in $firstname into $firstname and $lastname.

not clean, but working. :-)

撩起发的微风 2024-09-18 02:26:23

如果能找到解决方案就好了,我也遇到了同样的问题。

--- 更新 ---

我终于弄清楚这对我来说发生了什么。我安装了自定义运输管理模块,它覆盖了验证订单的地址控制器。我更新了覆盖的模块以反映我所使用的 Magento 版本并且它有效..没有问题。希望这对某人有帮助。

any luck finding a solution to this, I'm having the same issue.

--- update ---

I finally figured out what was happening on this one for me. I had the Custom Shipping Admin module installed and it was overriding the address controller that validates the order. I updated the overrided module to reflect the version of Magento I was on and it worked.. no problems. Hope this helps someone.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文