Esempio n. 1
0
 public function collect(Axis_Checkout_Model_Total $total)
 {
     $checkout = Axis::single('checkout/checkout');
     if (null === $checkout->shipping()) {
         return false;
     }
     if (!($taxClassId = $checkout->shipping()->config()->taxClass)) {
         if (!($taxClassId = Axis::config()->tax->shipping->taxClass)) {
             return false;
         }
     }
     if (!($taxBasis = $checkout->shipping()->config()->taxBasis)) {
         if (!($taxBasis = Axis::config()->tax->shipping->taxBasis)) {
             return false;
         }
     }
     $address = $checkout->getStorage()->{$taxBasis};
     if (!$address || !$address->hasCountry()) {
         return false;
     }
     $countryId = $address->country->id;
     $zoneId = $address->hasZone() && $address->zone->hasId() ? $address->zone->id : null;
     $geozoneIds = Axis::single('location/geozone')->getIds($countryId, $zoneId);
     if (!count($geozoneIds)) {
         return false;
     }
     $customerGroupId = Axis::single('account/customer')->getGroupId();
     if (!$customerGroupId) {
         return false;
     }
     $type = $checkout->shipping()->getType($checkout->getShippingRequest(), $checkout->getShippingMethodCode());
     $tax = Axis::single('tax/rate')->calculateByPrice($type['price'], $taxClassId, $geozoneIds, $customerGroupId);
     $total->addCollect(array('code' => $this->getCode(), 'title' => $this->getTitle(), 'total' => $tax, 'sortOrder' => $this->_config->sortOrder));
 }
Esempio n. 2
0
 public function collect(Axis_Checkout_Model_Total $total)
 {
     $checkout = Axis::single('checkout/checkout');
     $shipping = $checkout->shipping();
     if (null === $shipping) {
         return false;
     }
     $type = $shipping->getType($checkout->getShippingRequest(), $checkout->getShippingMethodCode());
     $total->addCollect(array('code' => $this->getCode(), 'title' => $this->getTitle(), 'total' => $type['price'], 'sortOrder' => $this->_config->sortOrder));
 }
Esempio n. 3
0
 public function collect(Axis_Checkout_Model_Total $total)
 {
     $checkout = Axis::single('checkout/checkout');
     $taxBasis = null;
     if (null !== $checkout->shipping()) {
         $taxBasis = $checkout->shipping()->_config->taxBasis;
     }
     if (!$taxBasis && !($taxBasis = Axis::config()->tax->main->taxBasis)) {
         return false;
     }
     $address = $checkout->getStorage()->{$taxBasis};
     if (!$address || !$address->hasCountry()) {
         return false;
     }
     $countryId = $address->country->id;
     $zoneId = $address->hasZone() && $address->zone->hasId() ? $address->zone->id : null;
     $geozoneIds = Axis::single('location/geozone')->getIds($countryId, $zoneId);
     $customerGroupId = Axis::single('account/customer')->getGroupId();
     $tax = Axis::single('tax/rate')->calculateByCartId($checkout->getCart()->getCartId(), $geozoneIds, $customerGroupId);
     $total->addCollect(array('code' => $this->getCode(), 'title' => $this->getTitle(), 'total' => $tax, 'sortOrder' => $this->_config->sortOrder));
 }
Esempio n. 4
0
 public function collect(Axis_Checkout_Model_Total $total)
 {
     $total->addCollect(array('code' => $this->getCode(), 'title' => $this->getTitle(), 'total' => Axis::single('checkout/cart')->getTotalPrice(), 'sortOrder' => $this->_config->sortOrder));
 }