주문 페이지 만들기에서 배송 주소를 가져 오는 방법은 무엇입니까?
-
13-12-2019 - |
문제
고객의 기본 운송 주소 정보를 얻는 방법을 알고 있지만 주문이 제출되기 전에 "일회성"배송 주소를 얻을 수 있습니까?
예제
고객은 조지아의 기본 주소가 있지만이 새로운 주문을 위해 플로리다로 운송됩니다.배송 주소 가이 경우에 무엇인지 알고 싶다면 어떻게 알 수 있습니까?
나는 세금 계산 목적 으로이 정보를 필요로하므로 선적이 플로리다에가는 경우 세금을 부과 할 수 있습니다.이게 훨씬 가능하니?
편집
R.S.의 제안을 토대로 관찰자가 를 설정하려고 노력하고 있지만 기대했던 것처럼 작동하지 않습니다 현재 내가 가진 것입니다 :
config.xml
<?xml version="1.0"?>
<config>
<modules>
<Mbs_Tax>
<version>0.1</version>
</Mbs_Tax>
</modules>
<global>
<events>
<sales_quote_collect_totals_before>
<observers>
<tax>
<type>singleton</type>
<class>Mbs_Tax_Model_Observer</class>
<method>salesQuoteCollectTotalsBefore</method>
</tax>
</observers>
</sales_quote_collect_totals_before>
</events>
</global>
</config>
.
observer.php
class Mbs_Tax_Model_Observer {
public function salesQuoteCollectTotalsBefore($observer) {
$quote = $observer->getQuote();
$address = $quote->getShippingAddress();
$region = $address->getData('region');
Mage::log("Address from salesQuoteCollectTotalsBefore: region ".$region,null,"tax.log");
if(strtoupper($region)==="FLORIDA") {
Mage::log("Shipping to Florida: ".print_r($quote->getShippingAddress()->getData('tax_amount'), true),null,"tax.log");
}
}
}
. 해결책
<sales_quote_collect_totals_before>
다음 옵저버
$quote = $observer->getQuote();
$address = $quote->getShippingAddress()
. 제휴하지 않습니다 magento.stackexchange