2011-03-07 4 views
1

두 명의 비즈니스 계좌를 만들 수있는 사람은 누구입니까? 사실, 제 카트의 총액이 100USD보다 커지면 제 2 상인 이메일을 전달하려는 첫 번째 판매자 계정으로 전달하고 싶습니다. 나는 그것이 가능하다는 것을 안다. 페이지가 페이팔로 리디렉션 될 때 카트 총계를 기반으로 다른 이메일을 전달해야합니다. 두 개의 판매자 전자 메일을 제공 할 수있는 양주 모듈을 만들고 싶습니다. 이렇게 입력 한 두 이메일은 장바구니 합계를 기준으로 사용할 수 있습니다. ?페이팔 표준으로 두 개의 비즈니스 계좌 생성

+0

실제로 두 개 이상의 비즈니스 계좌를 가질 수 있도록하려면 Paypal T & C를 확인해야합니다. – nfechner

+1

사실 나는 두 개의 sendbox 상인 계좌를 가지고 있는데, 나는 이미이 두 개의 다른 계좌를 사용하여 체크 아웃했으며 금액은 구매자 계좌에서 공제됩니다. 하지만 지금은 카트 합계를 기반으로 두 가지를 모두 사용하고 싶습니다. admin-> config에서 페이팔 설정에 하나의 이메일 만 입력 할 수 있습니다. 두 이메일 주소를 가져오고 redirect.php 블록에서 변경하고 싶습니다. 그러나 – Kamal

답변

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 파일을 만든 다음 standard.php을 무시하고 위에서 작성된 로직을 넣어야하는 getStandardCheckoutFormFields() 방법을 선언

<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> 

붙여 넣기 논평. 당신은 분명히 private method _getAggregatedCartSummary()의 에러를 얻게 될 것이므로, 단지 core가 범위가 public 인 것처럼 재정의하십시오. 그리고 끝났다.

+0

@sixlettervariables thx man! – Kamal

0

두 개의 Authorize.net 계정 사용과 관련하여 this recent answer을 살펴보십시오. Paypal의 개념은 같습니다.

/** 
* 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; 
}  

이 재정의에 대한 가장 좋은 건 다음과 같습니다 모델 Mage_Paypal_Model_Standard에서 getConfig라는 방법이있다. 이 시점에서 전화하실 수 있습니다 :

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

견적 객체를 얻으려면. 이 정보를 사용하여로드 할 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

+0

getStandardCheckoutFormFields()이 함수는 블록/redirect.php에서 페이팔에 변수를 제공하는 데 사용됩니다. 이제 getStandardCheckoutFormFields()를 정의하고 내 요구 사항에 따라 변수 비즈니스를 반환하는 모델을 재정의하려고합니다. – Kamal

+0

그리고 나는 마술 :: getSingleton ('checkout/session') -> getQuote() -> getGrandTotal();을 사용해야한다고 생각합니다. – Kamal

0

마지막으로, 나는이를 생성하고 설정을 저장 한 후

<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> 

로 태그 한 후 system.xml을 추가 한, 당신은 페이팔 '로 마지막에 설정된 경로가 있음을 core_config_data 표에서 볼 수 있습니다/일반/business_account2 '. 이제 지불에 $result = $api->getStandardCheckoutRequest();

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

로 getStandardCheckoutFormFields을() 변경/모델/Standard.php, 나는 코어 파일이 변경 한,하지만 모두가 알다시피 나는이 사용하여 로컬 folder.I이 희망 만들어야합니다 당신을 도울 수 있습니다.

+0

고맙습니다, 조셉. – Kamal