| @@ 107-119 (lines=13) @@ | ||
| 104 | * @param string $countryCode The two letter code for a country (US, CA, DE, etc...) |
|
| 105 | * @return string|null The HTS Code for the product/country combination. Null if no HTS code is available. |
|
| 106 | */ |
|
| 107 | public function getProductHtsCodeByCountry(Mage_Catalog_Model_Product $product, $countryCode) |
|
| 108 | { |
|
| 109 | $htsCodes = unserialize($product->getHtsCodes()); |
|
| 110 | if (is_array($htsCodes)) { |
|
| 111 | foreach ($htsCodes as $htsCode) { |
|
| 112 | if ($countryCode === $htsCode['destination_country']) { |
|
| 113 | return $htsCode['hts_code']; |
|
| 114 | } |
|
| 115 | } |
|
| 116 | } |
|
| 117 | ||
| 118 | return null; |
|
| 119 | } |
|
| 120 | ||
| 121 | /** |
|
| 122 | * Make an API request to the TDF service for the quote and return any |
|
| @@ 719-731 (lines=13) @@ | ||
| 716 | * @param string $countryCode the two letter code for a country (US, CA, DE, etc...) |
|
| 717 | * @return string | null the htscode matching the country code for that product otherwise null |
|
| 718 | */ |
|
| 719 | public function getProductHtsCodeByCountry(Mage_Catalog_Model_Product $product, $countryCode) |
|
| 720 | { |
|
| 721 | $htsCodes = unserialize($product->getHtsCodes()); |
|
| 722 | if ($htsCodes) { |
|
| 723 | foreach ($htsCodes as $htsCode) { |
|
| 724 | if ($countryCode === $htsCode['destination_country']) { |
|
| 725 | return $htsCode['hts_code']; |
|
| 726 | } |
|
| 727 | } |
|
| 728 | } |
|
| 729 | ||
| 730 | return null; |
|
| 731 | } |
|
| 732 | ||
| 733 | /** |
|
| 734 | * Save an EAV collection, disabling the indexer if the collection is |
|