2011-03-07 115 views
1

任何人都可以告诉我如何创建两个商业帐户?其实,我想要这样的功能,如果我的购物车总额超过100美元比我想将其传递给我的第一个商家帐户,否则要通过第二个商家的电子邮件。我知道,它是可行的。当页面重定向到PayPal时,我必须根据购物车总数传递不同的电子邮件。我想创建一个可以提供两个商家电子邮件的分开的模块,因此这两个输入的电子邮件都可以基于购物车total.TIA,任何帮助?在PayPal标准中创建两个商业帐户

+0

您应该检查贝宝条款与条件,如果他们实际上允许您有多个企业帐户。 – nfechner 2011-03-07 14:19:36

+1

其实我有两个发送箱商家帐户,我已经使用这两个不同的帐户检出,金额从买家帐户中扣除。但是现在我想根据购物车总数来使用它们。我只能在admin-> config中输入paypal设置中的一个电子邮件地址,我想要获得两个电子邮件地址,并且想要在redirect.php.block thblock中更改thx – Kamal 2011-03-07 14:52:54

回答

0

创建的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()的错误,所以重新定义,因为它在核心范围内是公开的。并完成。

+0

@sixlettervariables thx man! – Kamal 2011-04-11 07:39:35

0

关于使用两个Authorize.net帐户,请看this recent answer。 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),并根据需要返回。

希望有帮助!

+0

thx joseph,我很感激你,但实际上我想提供两个电子邮件地址,以便管理员可以输入两个电子邮件,通过更改system.xml它可能。现在看一下standard.php中的getStandardCheckoutFormFields()使用$ api = Mage :: getModel('paypal/api_standard') - > setConfigObject($ this-> getConfig());这样可以得到api_standard,这里使用config。现在在这个函数中调用getStandardCheckoutRequest(),从这里开始,business_account 2不会被完全返回。第二封电子邮件以path ='paypal/general/business_account2'的形式存储在core_config_data中。 – Kamal 2011-03-08 06:01:39

+0

getStandardCheckoutFormFields()这个函数在block/redirect.php中用于向paypal提供变量。现在我想覆盖定义getStandardCheckoutFormFields()的模型,并根据我的要求返回变量业务。 – Kamal 2011-03-08 06:06:39

+0

我想要包括所有东西的最终总数,我认为我必须使用Mage :: getSingleton('checkout/session') - > getQuote() - > getGrandTotal();对吧? – Kamal 2011-03-08 06:09:25

0

最后,我的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表中看到,有作为“贝宝设定在最后的路径/一般/ business_account2' 。现在改变getStandardCheckoutFormFields()作为

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

在付款后$result = $api->getStandardCheckoutRequest(); /型号/ Standard.php,我已在核心文件中的这些变化,但是大家都知道我要创建这个使用本地folder.I希望这可以帮助你。

+0

谢谢你,约瑟夫。 – Kamal 2011-03-09 05:20:51

相关问题