결제 과정의 검토 단계에서 국제 운송을위한 최신 관세/세금을 받으려면 제 3 자 API에 전화해야합니다. API 호출을 사용할 준비가되었지만 견적에 반환 된 관세 및 세금을 추가 할 방법이 없습니다.Magento : 재검토 중 견적에 관세/세금 추가
기본 제공 방법이 있습니까?
메신저가 기대하기는 단계를 수행 할 필요가
$quote->addCostComponent("Duties", 5.0);
결제 과정의 검토 단계에서 국제 운송을위한 최신 관세/세금을 받으려면 제 3 자 API에 전화해야합니다. API 호출을 사용할 준비가되었지만 견적에 반환 된 관세 및 세금을 추가 할 방법이 없습니다.Magento : 재검토 중 견적에 관세/세금 추가
기본 제공 방법이 있습니까?
메신저가 기대하기는 단계를 수행 할 필요가
$quote->addCostComponent("Duties", 5.0);
같은 것입니다 :
당신이 순서대로 표시하여 관세/세금에 대한 속성을 만드는 데 필요한 모든우선 , 그냥 총액에 추가 할뿐만 아니라. 웹 사이트 통화의 가치에 대해 하나씩 두 가지 속성 (결제 캡쳐에 사용되며 접두어는 base_
이어야 함)과 표시된 통화의 값이 하나 있어야합니다 (고객에게 원하는 통화로 금액을 표시하기 위해 사용됨). 이 속성은 재무 부분 (quote_address, order, invoice)이있는 모든 엔티티에 추가되어야합니다. 예를 들어, 숫자는 base_your_attribute_code
및 your_attribute_code
이어야합니다.
/**
* Your custom total model
*
*/
class Your_Module_Model_Total_Custom extends Mage_Sales_Model_Quote_Address_Total_Abstract
{
/**
* Constructor that should initiaze
*/
public function __construct()
{
$this->setCode('your_attribute_code');
}
/**
* Used each time when collectTotals is invoked
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Your_Module_Model_Total_Custom
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
parent::collect($address);
// ... Some your api calls to retrive amount ...
// Set base amount of your custom fee
$this->_setBaseAmount($calculatedAmount);
// Set amount of your custom fee in displayed currency
$this->_setAmount(
$address->getQuote()->getStore()->convertPrice($calculatedAmount, false)
);
return $this;
}
/**
* Used each time when totals are displayed
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Your_Module_Model_Total_Custom
*/
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
// Display total only if it is not zero
if ($address->getYourAttributeCode() != 0) {
$address->addTotal(array(
'code' => $this->getCode(),
'title' => 'My Custom Duty',
'value' => $address->getYourAttributeCode()
));
}
}
}
콜렉터 모델은 당신이 추가 필요 만든 후 :
은 그럼 당신은 수집하고이 예에서와 같은 방법을 가져 Mage_Sales_Model_Quote_Address_Total_Abstract에서 확장되어야 총 컬렉터 모델을 생성하고 구현해야합니다 구성 :
<config>
<global>
<sales>
<quote>
<totals>
<your_total_code>
<class>your_module/total_custom</class>
<before>grand_total</before>
<after>shipping</after>
</your_total_code>
</totals>
</quote>
</sales>
</global>
</config>
당신은 주문 또는 송장에 복사 계산 된 데이터에 사용됩니다-세트 필드에 총 속성을 추가해야합니다 : 이것은 당신이 볼 수있는 단계를 수행 한 후
<config>
<global>
<fieldsets>
<!-- copies data from quote address to order during the order placement -->
<sales_convert_quote_address>
<base_your_attribute_code><to_order>*</to_order></base_your_attribute_code>
<your_attribute_code><to_order>*</to_order></your_attribute_code>
</sales_convert_quote_address>
<!-- copies data from order to invoice/shipment/creditmemo during their creation -->
<sales_convert_order>
<base_your_attribute_code><to_invoice>*</to_invoice><to_shipment>*</to_shipment><to_cm>*</to_cm></base_your_attribute_code>
<your_attribute_code><to_invoice>*</to_invoice><to_shipment>*</to_shipment><to_cm>*</to_cm></your_attribute_code>
</sales_convert_order>
</fieldsets>
</global>
</config>
당신의 주문 내역 합계
네, 있습니다. 하지만 정확히 어떻게 잊어 버렸어. Magento 포럼에서이 질문에 더 잘 대답하지 않겠습니까? –
@Joe, Magento 포럼은 코드에 대한 도움을 찾고 있다면 황무지 다. 이것은 코드 관련 질문이기 때문에 여기서는 관객에게 이상적인 것 같습니다. –
@JosephMastey Magento에 관해서는 [area 51 magento proposal] (http://area51.stackexchange.com/proposals/48872/magento) – Khez