谁能告诉我如何创建两个企业帐户?实际上,我想要这样的功能,如果我的购物车总金额大于 100 美元,我想将其传递给我的第一个商家帐户,否则我想传递第二个商家电子邮件。我知道,这是可行的。当页面被重定向到贝宝时,我必须根据购物车总数传递不同的电子邮件。我想创建一个单独的模块,通过它我可以提供两个商家电子邮件,所以这两个输入的电子邮件都可以根据购物车总数使用。TIA,任何帮助?
3 回答
创建 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()
必须按照上面注释中所写的逻辑放置的方法。你肯定会得到私有方法的错误,_getAggregatedCartSummary()
所以重新定义它就像在核心只是范围是公共的一样。并完成。
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.
看看这个关于使用两个 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/config_alt
)并根据需要返回。
希望有帮助!