Esempio n. 1
0
 /**
  * Process the gift rules
  * 
  * @param Mage_Sales_Model_Quote_Address $address
  */
 protected function _processGiftRules($address)
 {
     $quote = $address->getQuote();
     $store = Mage::app()->getStore($quote->getStoreId());
     $validator = Mage::getSingleton('gift/rule_validator')->init($store->getWebsiteId(), $quote->getCustomerGroupId());
     $validator->process($address);
 }
Esempio n. 2
0
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     if ($address->getDamageWaiverAmount() > 0) {
         $address->addTotal(array('code' => $this->getCode(), 'title' => $this->getLabel(), 'value' => $address->getDamageWaiverAmount()));
     }
     return $this;
 }
 /**
  * Add convenienceservice information to address
  *
  * @param Mage_Sales_Model_Quote_Address $address
  * @return Magentix_Convenienceservice_Model_Sales_Quote_Address_Total_Convenienceservice
  */
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $amount = $address->getConvenienceserviceAmount();
     $convenienceservicechargepercentage = Mage::getStoreConfig('convenience/convenience_group/convenienceservicechargepercentage');
     $address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('convenienceservice')->__("Service Tax ({$convenienceservicechargepercentage}% of Conv. Fee)"), 'value' => $amount));
     return $this;
 }
 protected function _saveAppliedTaxes(Mage_Sales_Model_Quote_Address $address, $applied, $amount, $baseAmount, $rate)
 {
     $previouslyAppliedTaxes = $address->getAppliedTaxes();
     $process = count($previouslyAppliedTaxes);
     foreach ($applied as $row) {
         if (!isset($previouslyAppliedTaxes[$row['id']])) {
             $row['process'] = $process;
             $row['amount'] = 0;
             $row['base_amount'] = 0;
             $previouslyAppliedTaxes[$row['id']] = $row;
         }
         if (!is_null($row['percent'])) {
             $row['percent'] = $row['percent'] ? $row['percent'] : 1;
             $rate = $rate ? $rate : 1;
             $appliedAmount = $amount;
             $baseAppliedAmount = $baseAmount;
         } else {
             $appliedAmount = 0;
             $baseAppliedAmount = 0;
             foreach ($row['rates'] as $rate) {
                 $appliedAmount += $rate['amount'];
                 $baseAppliedAmount += $rate['base_amount'];
             }
         }
         if ($appliedAmount || $previouslyAppliedTaxes[$row['id']]['amount']) {
             $previouslyAppliedTaxes[$row['id']]['amount'] = $appliedAmount;
             $previouslyAppliedTaxes[$row['id']]['base_amount'] = $baseAppliedAmount;
         } else {
             unset($previouslyAppliedTaxes[$row['id']]);
         }
     }
     $address->setAppliedTaxes($previouslyAppliedTaxes);
 }
Esempio n. 5
0
 /**
  * Check if address actionable to calculate tax
  *
  * @param Mage_Sales_Model_Quote_Address $address
  * @return bool
  */
 protected function _isAddressActionable($address)
 {
     /** @var OnePica_AvaTax_Helper_Data $helper */
     $helper = Mage::helper('avatax');
     $storeId = $address->getQuote()->getStoreId();
     return $helper->isAddressActionable($address, $storeId, OnePica_AvaTax_Model_Config::REGIONFILTER_TAX);
 }
Esempio n. 6
0
 /**
  * Prepare Data to Storage for Order
  * 
  * @param Mage_Sales_Model_Quote_Address $address
  * @return Magestore_Webpos_Model_Total_Quote_Cash
  */
 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $quote = $address->getQuote();
     $cashin = Mage::getSingleton('webpos/session')->getWebposCash();
     if ($cashin && $cashin <= 0) {
         return $this;
     }
     $baseCashin = $cashin / $quote->getStore()->convertPrice(1);
     $quote->setWebposCash($cashin);
     $quote->setWebposBaseCash($baseCashin);
     if (!$quote->isVirtual() && $address->getAddressType() == 'billing') {
         return $this;
     }
     $address->setWebposCash($quote->getWebposCash())->setWebposBaseCash($quote->getWebposBaseCash());
     /*
      $address->setTotalPaid($quote->getWebposCash())
      ->setBaseTotalPaid($quote->getWebposBaseCash());
     */
     if ($quote->getWebposCash() >= $address->getGrandTotal()) {
         /*
          $address->setTotalRefunded($quote->getWebposCash() - $address->getGrandTotal())
          ->setBaseTotalRefunded($quote->getWebposBaseCash() - $address->getBaseGrandTotal());
          if ($payment = $quote->getPayment()) {
          if ($method = $payment->getMethodInstance()) {
          $address->setTotalPaid($address->getTotalRefunded())
          ->setBaseTotalPaid($address->getBaseTotalRefunded());
          }
          }
         */
     } else {
         //$address->setGrandTotal($address->getGrandTotal() - $quote->getWebposCash()  );
         //$address->setBaseGrandTotal($address->getBaseGrandTotal() - $quote->getWebposBaseCash());
     }
     return $this;
 }
Esempio n. 7
0
 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     foreach ($address->getAllItems() as $item) {
         Mage::getSingleton('rewards/redeem')->refactorRedemptions($item, false);
     }
     return parent::collect($address);
 }
Esempio n. 8
0
 /**
  * Add fee information to address
  *
  * @param Mage_Sales_Model_Quote_Address $address
  * @return Brander_PaymentFee_Model_Sales_Quote_Address_Total_Fee
  */
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $amount = $address->getFeeAmount();
     $title = Mage::getModel('payment_fee/fee')->getTotalTitle(null, $address->getQuote());
     $address->addTotal(array('code' => $this->getCode(), 'title' => $title, 'value' => $amount));
     return $this;
 }
Esempio n. 9
0
 protected function _importCustomerAddressTo(Mage_Sales_Model_Quote_Address $address)
 {
     $customerAddress = $this->getCustomer()->getPrimaryShippingAddress();
     if ($customerAddress) {
         $address->importCustomerAddress($customerAddress)->setSaveInAddressBook(0);
     }
 }
Esempio n. 10
0
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     if (!method_exists($address->getQuote(), 'isR4q') || !$address->getQuote()->isR4q() || Mage::helper('request4quote')->isTaxEstimatesEnabled()) {
         parent::fetch($address);
     }
     return $this;
 }
Esempio n. 11
0
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     if ($amount = $address->getAffiliateCredit()) {
         $address->addTotal(array('code' => $this->getCode(), 'title' => $this->_getConfigHelper()->__('Paid by Affiliate Credit'), 'value' => $amount));
     }
     return $this;
 }
Esempio n. 12
0
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $amt = $address->getPaymentInstallmentFeeAmount();
     if ($amt != 0) {
         $address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('adyen')->__('Installment Fee'), 'value' => $amt));
     }
     return $this;
 }
 public function fetchTotals(Mage_Sales_Model_Quote_Address $address)
 {
     $amount = $address->getGiftcertAmount();
     if ($amount) {
         $address->addTotal(array('code' => 'giftcert', 'title' => AO::helper('giftcert')->__('Gift Certificate') . ' (' . $address->getGiftcertCode() . ')', 'value' => -$amount, 'output' => true));
     }
     return $this;
 }
Esempio n. 14
0
 /**
  * Collect gift wrapping tax totals
  *
  * @param \Mage_Sales_Model_Quote_Address $address
  * @return $this
  */
 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $storeId = $address->getQuote()->getStore()->getId();
     if ($this->_getAvaTaxDataHelper()->isAvataxEnabled($storeId)) {
         return $this;
     }
     return parent::collect($address);
 }
Esempio n. 15
0
 public function testRenderAddress()
 {
     $block = new Mage_Paypal_Block_Express_Review();
     $addressData = (include __DIR__ . '/../../../Sales/_files/address_data.php');
     $address = new Mage_Sales_Model_Quote_Address($addressData);
     $address->setAddressType('billing');
     $this->assertContains('Los Angeles', $block->renderAddress($address));
 }
 /**
  * Update the address with totals data used for display in a total line,
  * e.g. a total line in the cart.
  *
  * @param Mage_Sales_Model_Quote_Address
  * @return self
  */
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $total = $address->getTotalAmount($this->getCode());
     if ($total) {
         $address->addTotal(['code' => $this->getCode(), 'title' => $this->_helper->__(self::TAX_TOTAL_TITLE), 'value' => $total]);
     }
     return $this;
 }
Esempio n. 17
0
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     if ($address->getAddressType() == Mage_Sales_Model_Quote_Address::TYPE_SHIPPING) {
         return $this;
     }
     $address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('sales')->__('Points Earned')));
     return $this;
 }
Esempio n. 18
0
 /**
  * @param Mage_Sales_Model_Quote_Address $address
  *
  * @return $this
  */
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $amt = $address->getShopgatePaymentFee();
     if ($amt != 0) {
         $address->addTotal(array('code' => $this->getCode(), 'title' => $this->getLabel(), 'value' => $amt));
     }
     return $this;
 }
Esempio n. 19
0
 public function fetchTotals(Mage_Sales_Model_Quote_Address $address)
 {
     $amount = $address->getTaxAmount();
     if ($amount != 0) {
         $address->addTotal(array('code' => 'tax', 'title' => Mage::helper('sales')->__('Tax'), 'value' => $amount));
     }
     return $this;
 }
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $amount = $address->getPaymentCharge();
     if ($amount != 0) {
         $address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('sales')->__('Payment Charge'), 'full_info' => array(), 'value' => $amount));
     }
     return $this;
 }
Esempio n. 21
0
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $amount = $address->getPaymentCharge();
     if ($amount != 0) {
         $address->addTotal(array('code' => $this->getCode(), 'title' => Mage::getStoreConfig('pay_payment/general/text_payment_charge', Mage::app()->getStore()), 'full_info' => array(), 'value' => $amount, 'base_value' => $amount));
     }
     return $amount;
 }
Esempio n. 22
0
 public function fetchTotals(Mage_Sales_Model_Quote_Address $address)
 {
     $amount = $address->getShippingAmount();
     if ($amount != 0) {
         $address->addTotal(array('code' => 'shipping', 'title' => Mage::helper('sales')->__('Shipping & Handling') . ' (' . $address->getShippingDescription() . ')', 'value' => $address->getShippingAmount()));
     }
     return $this;
 }
Esempio n. 23
0
 public function fetchTotals(Mage_Sales_Model_Quote_Address $address)
 {
     $custbalance = $address->getCustbalanceAmount();
     if ($custbalance != 0) {
         $address->addTotal(array('code' => 'custbalance', 'title' => Mage::helper('sales')->__('Store Credit'), 'value' => -$custbalance));
     }
     return $this;
 }
Esempio n. 24
0
 /**
  * Fetch collected nominal items
  *
  * @param Mage_Sales_Model_Quote_Address $address
  * @return Mage_Sales_Model_Quote_Address_Total_Nominal
  */
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $items = $address->getAllNominalItems();
     if ($items) {
         $address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('Mage_Sales_Helper_Data')->__('Nominal Items'), 'items' => $items, 'area' => 'footer'));
     }
     return $this;
 }
Esempio n. 25
0
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $amount = $address->getCapayableFee();
     $paymentTitle = Mage::helper('capayable')->getMethodTitle($address->getQuote()->getPayment()->getMethod());
     if ($amount != 0) {
         $address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('capayable')->__($paymentTitle), 'value' => $amount));
     }
     return $this;
 }
Esempio n. 26
0
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $amount = $address->getOnestepcheckoutDiscountAmount();
     $title = Mage::helper('sales')->__('Discount(Admin)');
     if ($amount != 0) {
         $address->addTotal(array('code' => $this->getCode(), 'title' => $title, 'value' => '-' . $amount));
     }
     return $this;
 }
Esempio n. 27
0
 /**
  * Collect totals process.
  *
  * @param Mage_Sales_Model_Quote_Address $address
  *
  * @return $this
  */
 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $store = $address->getQuote()->getStore();
     if (!$this->getHelper()->isActive($store)) {
         return parent::collect($address);
     }
     // We do all the subtotal tax processing in the tax total collector
     return $this;
 }
Esempio n. 28
0
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $quote = $address->getQuote();
     if ($quote->getPayment()->getMethod() == "cashondelivery") {
         $amt = $address->getFeeAmount();
         $address->addTotal(array('code' => $this->getCode(), 'title' => "Cash On Delivery Charges", 'value' => $amt));
     }
     return $this;
 }
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $amount = $address->getCodFee();
     if ($amount != 0) {
         $quote = $address->getQuote();
         $address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('phoenix_cashondelivery')->__('Cash on Delivery fee'), 'value' => $amount));
     }
     return $this;
 }
Esempio n. 30
0
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $amount = $address->getLuckydrawDiscount();
     $title = $this->_getConfigHelper()->__('Lucky Draw Discount');
     if ($amount != 0) {
         $address->addTotal(array('code' => $this->getCode(), 'title' => $title, 'value' => $amount));
     }
     return $this;
 }