diff --git a/Checkout/Service/Extractor/Quote/Address.php b/Checkout/Service/Extractor/Quote/Address.php index b297788..388c695 100644 --- a/Checkout/Service/Extractor/Quote/Address.php +++ b/Checkout/Service/Extractor/Quote/Address.php @@ -57,7 +57,7 @@ public static function extract(Mage_Sales_Model_Quote_Address $address) 'id' => (int)$address->getId() ?: null, 'region' => $address->getRegion(), 'region_id' => (int)$address->getRegionId() ?: null, - 'region_code' => $address->getRegionCode(), + 'region_code' => $address->getRegionId() ? $address->getRegionCode(): null, 'country_id' => $address->getCountryId(), 'street' => $street, 'telephone' => $address->getTelephone(), diff --git a/Checkout/Service/Extractor/Quote/Item.php b/Checkout/Service/Extractor/Quote/Item.php index 768c9c2..62f9b71 100644 --- a/Checkout/Service/Extractor/Quote/Item.php +++ b/Checkout/Service/Extractor/Quote/Item.php @@ -233,7 +233,8 @@ private static function getTaxData( Mage_Sales_Model_Quote $quote, Mage_Sales_Model_Quote_Item $item ) { - $itemTaxDetails = []; + $itemTaxDetails = new stdClass(); + $itemTaxDetails->taxes = []; $itemTaxAmount = $item->getTaxAmount(); foreach ($quote->getTaxesForItems() as $itemId => $taxDetails) { if ((int)$item->getId() !== (int)$itemId) { @@ -242,21 +243,29 @@ private static function getTaxData( $appliedTaxNumber = count($taxDetails); $i = 1; foreach ($taxDetails as $tax) { - $calculatedAmount = Mage::app()->getStore()->roundPrice($item->getPrice() * ($tax['percent'] / 100)); + $calculatedAmount = (float)$item->getPrice() * ($tax['percent'] / 100); $amount = $i < $appliedTaxNumber && $calculatedAmount < $itemTaxAmount ? $calculatedAmount : $itemTaxAmount; $itemTaxAmount = $itemTaxAmount - $amount; - $itemTaxDetails[] = [ - 'id' => $tax['id'], - 'amount' => $amount, - 'percent' => $tax['percent'], - 'rates' => $tax['rates'], - ]; + $taxData = new stdClass(); + $taxData->id = $tax['id']; + $taxData->amount = $calculatedAmount; + $taxData->percent = $tax['percent']; + $taxData->rates = $tax['rates']; + $itemTaxDetails->taxes[] = $taxData; $i++; } } - return $itemTaxDetails; + Mage::dispatchEvent( + 'bold_checkout_item_tax_extract_after', + [ + 'item_tax_details' => $itemTaxDetails, + 'quote_item' => $item, + 'quote' => $quote, + ] + ); + return array_values($itemTaxDetails->taxes); } /** diff --git a/Checkout/Service/Extractor/Quote/ShippingMethods.php b/Checkout/Service/Extractor/Quote/ShippingMethods.php index 7375154..348f185 100644 --- a/Checkout/Service/Extractor/Quote/ShippingMethods.php +++ b/Checkout/Service/Extractor/Quote/ShippingMethods.php @@ -35,7 +35,7 @@ private static function extractShippingMethod(Mage_Sales_Model_Quote_Address_Rat 'carrier_code' => $rate->getCarrier(), 'method_code' => $rate->getMethod(), 'carrier_title' => $rate->getCarrierTitle(), - 'method_title' => $rate->getMethodTitle(), + 'method_title' => strip_tags($rate->getMethodTitle()), 'amount' => (float)$rate->getPrice(), 'base_amount' => (float)$rate->getPrice(), 'available' => true, diff --git a/CheckoutTmFireCheckout/etc/config.xml b/CheckoutTmFireCheckout/etc/config.xml index 164ce41..b7c557b 100644 --- a/CheckoutTmFireCheckout/etc/config.xml +++ b/CheckoutTmFireCheckout/etc/config.xml @@ -6,16 +6,7 @@ - - - - - Bold_Checkout_Observer_OnepageControllerObserver - afterShippingSave - - - @@ -24,64 +15,6 @@ - - - - Bold_Checkout_Observer_CheckoutObserver - beforeCheckout - - - - - - - Bold_Checkout_Observer_OnepageControllerObserver - afterBillingSave - - - - - - - Bold_Checkout_Observer_OnepageControllerObserver - afterShippingSave - - - - - - - Bold_Checkout_Observer_OnepageControllerObserver - afterShippingMethodSave - - - - - - - - - Bold_Checkout_Observer_OnepageControllerObserver - afterBillingSave - - - - - - - Bold_Checkout_Observer_OnepageControllerObserver - afterShippingSave - - - - - - - Bold_Checkout_Observer_OnepageControllerObserver - afterShippingMethodSave - - -