在 paypal 标准中创建两个企业帐户

发布于 2024-10-20 22:45:28 字数 198 浏览 2 评论 0原文

谁能告诉我如何创建两个企业帐户?实际上,我想要这样的功能,如果我的购物车总额超过 100 美元,我想将其传递到我的第一个商家帐户,否则我想传递第二个商家电子邮件。我知道,这是可行的。当页面重定向到 paypal 时,我必须根据购物车总数传递不同的电子邮件。我想创建一个单独的模块,通过它我可以提供两个商家电子邮件,因此这两个输入的电子邮件都可以根据购物车总数使用。TIA,任何帮助?

Can anyone tell me how can i create two business accounts? Actually, i want functionality like this, if my cart total becomes greater than 100USD than i want to pass it to my first merchant account else want to pass second merchant email. I know, its feasible. When page is redirected to paypal i have to pass different emails based on cart total.I want to create a saparate module by which i can provide two merchant emails , so these both entered emails can be used based on cart total.TIA, any help?

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

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

发布评论

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

评论(3

掩于岁月 2024-10-27 22:45:28

创建 system.xml 并粘贴

<config>
  <sections>
    <paypal>
        <groups>
            <account translate="label">
                <label>Merchant Account</label>
                <fieldset_css>paypal-config</fieldset_css>
                <frontend_type>text</frontend_type>
                <sort_order>0</sort_order>
                <show_in_default>1</show_in_default>
                <show_in_website>1</show_in_website>
                <fields>
                    <business_account2 translate="label comment tooltip">
                        <label>Email Associated with PayPal Merchant Account more than 5 amount</label>
                        <comment><![CDATA[<a href="http://www.magentocommerce.com/paypal">Start accepting payments via PayPal!</a>]]></comment>
                        <tooltip>Don't have a PayPal account? Simply enter your email address.</tooltip>
                        <config_path>paypal/general/business_account2</config_path>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <sort_order>10</sort_order>
                        <frontend_class>validate-email</frontend_class>
                    </business_account2>
                </fields>
            </account>
        </groups>
    </paypal>
  </sections>
</config>

创建 config.xml 并粘贴

<config>
    <modules>
        <My_CustomPaypal>
            <version>1.0.0</version>
            <depends>
            <!-- no dependencies -->
            </depends>
        </My_CustomPaypal>
    </modules>
    <global>
        <models>
          <paypal>
              <rewrite>
                  <standard>My_CustomPaypal_Model_Standard</standard>
              </rewrite>
          </paypal>
        </models>
        <resources />
        <extraconfig />
        <blocks />
    </global>
</config>

然后覆盖 standard.php 并声明 getStandardCheckoutFormFields() 方法,其中必须放置上面注释中所写的逻辑。您肯定会收到私有方法 _getAggreeratedCartSummary() 的错误,因此请重新定义,因为它在核心中只是范围是公共的。并完成了。

Create system.xml and paste

<config>
  <sections>
    <paypal>
        <groups>
            <account translate="label">
                <label>Merchant Account</label>
                <fieldset_css>paypal-config</fieldset_css>
                <frontend_type>text</frontend_type>
                <sort_order>0</sort_order>
                <show_in_default>1</show_in_default>
                <show_in_website>1</show_in_website>
                <fields>
                    <business_account2 translate="label comment tooltip">
                        <label>Email Associated with PayPal Merchant Account more than 5 amount</label>
                        <comment><![CDATA[<a href="http://www.magentocommerce.com/paypal">Start accepting payments via PayPal!</a>]]></comment>
                        <tooltip>Don't have a PayPal account? Simply enter your email address.</tooltip>
                        <config_path>paypal/general/business_account2</config_path>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <sort_order>10</sort_order>
                        <frontend_class>validate-email</frontend_class>
                    </business_account2>
                </fields>
            </account>
        </groups>
    </paypal>
  </sections>
</config>

And create config.xml and paste

<config>
    <modules>
        <My_CustomPaypal>
            <version>1.0.0</version>
            <depends>
            <!-- no dependencies -->
            </depends>
        </My_CustomPaypal>
    </modules>
    <global>
        <models>
          <paypal>
              <rewrite>
                  <standard>My_CustomPaypal_Model_Standard</standard>
              </rewrite>
          </paypal>
        </models>
        <resources />
        <extraconfig />
        <blocks />
    </global>
</config>

Then override standard.php and declare getStandardCheckoutFormFields() method in which have to put logic as written in above comment. You will surely get error of private method _getAggregatedCartSummary() so redefine as it is as in core just scope is public. And finished.

爱情眠于流年 2024-10-27 22:45:28

查看有关使用两个 Authorize.net 帐户的最新答案 。 Paypal 的概念是相同的。在模型 Mage_Paypal_Model_Standard 中,有一个名为 getConfig 的方法:

/**
 * Config instance getter
 * @return Mage_Paypal_Model_Config
 */
public function getConfig()
{
    if (null === $this->_config) {
        $params = array($this->_code);
        if ($store = $this->getStore()) {
            $params[] = is_object($store) ? $store->getId() : $store;
        }
        $this->_config = Mage::getModel('paypal/config', $params);
    }
    return $this->_config;
}    

这看起来是覆盖的最佳选择。此时您应该能够调用:

$this->getCheckout()->getQuote();

来获取您的报价对象。用它来决定加载哪些 Paypal 信息。将 paypal 信息保存在数据库中的备用路径下(例如 paypal/config_alt)并根据需要返回。

希望有帮助!

Take a look at this recent answer regarding using two Authorize.net accounts. The concept for Paypal is the same. In the model Mage_Paypal_Model_Standard, there is a method called getConfig:

/**
 * Config instance getter
 * @return Mage_Paypal_Model_Config
 */
public function getConfig()
{
    if (null === $this->_config) {
        $params = array($this->_code);
        if ($store = $this->getStore()) {
            $params[] = is_object($store) ? $store->getId() : $store;
        }
        $this->_config = Mage::getModel('paypal/config', $params);
    }
    return $this->_config;
}    

This looks like your best bet for an override. At this point you should be able to call:

$this->getCheckout()->getQuote();

to get your quote object. Use that to decide which Paypal information to load. Save that paypal information in the database under an alternate path (say paypal/config_alt) and return as necessary.

Hope that helps!

假面具 2024-10-27 22:45:28

最后,我在 system.xml 标签后添加了

<business_account2 translate="label comment tooltip">
    <label>Email Associated with PayPal Merchant Account more than 100 amount</label>
    <comment><![CDATA[<a href="http://www.magentocommerce.com/paypal">Start accepting payments via PayPal!</a>]]></comment>
    <tooltip>Don't have a PayPal account? Simply enter your email address.</tooltip>
    <config_path>paypal/general/business_account2</config_path>
    <show_in_default>1</show_in_default>
    <show_in_website>1</show_in_website>
    <sort_order>10</sort_order>
    <frontend_class>validate-email</frontend_class>
</business_account2>

创建此并保存配置后,您可以在 core_config_data 表中看到最后设置为“paypal/general/business_account2”的路径。现在将 getStandardCheckoutFormFields() 更改为

$business2 = Mage::getStoreConfig('paypal/general/business_account2');
$grandTotal = $order->getGrandTotal();
if($grandTotal >= 100) {
    unset($result['business']);
    $result['business'] = $business2;
}

Payment/Model/Standard.php 中的 $result = $api->getStandardCheckoutRequest(); 之后,我已在 Core 文件中进行了这些更改,但正如你们所知,我必须使用本地文件夹创建它。我希望这可以帮助您。

Finally,I have added in system.xml after tag as

<business_account2 translate="label comment tooltip">
    <label>Email Associated with PayPal Merchant Account more than 100 amount</label>
    <comment><![CDATA[<a href="http://www.magentocommerce.com/paypal">Start accepting payments via PayPal!</a>]]></comment>
    <tooltip>Don't have a PayPal account? Simply enter your email address.</tooltip>
    <config_path>paypal/general/business_account2</config_path>
    <show_in_default>1</show_in_default>
    <show_in_website>1</show_in_website>
    <sort_order>10</sort_order>
    <frontend_class>validate-email</frontend_class>
</business_account2>

After creating this and save config,you can see in core_config_data table that there is a path set at last as 'paypal/general/business_account2'. Now change getStandardCheckoutFormFields() as

$business2 = Mage::getStoreConfig('paypal/general/business_account2');
$grandTotal = $order->getGrandTotal();
if($grandTotal >= 100) {
    unset($result['business']);
    $result['business'] = $business2;
}

after $result = $api->getStandardCheckoutRequest(); in Payment/Model/Standard.php, I have made these changes in Core files, But as you all know i have to create this using local folder.I hope this may help you.

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