本文整理汇总了PHP中Mage_Sales_Model_Quote::getCustomerTaxClassId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote::getCustomerTaxClassId方法的具体用法?PHP Mage_Sales_Model_Quote::getCustomerTaxClassId怎么用?PHP Mage_Sales_Model_Quote::getCustomerTaxClassId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote::getCustomerTaxClassId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProductTaxRate
private function getProductTaxRate()
{
/** @var $taxCalculator Mage_Tax_Model_Calculation */
$taxCalculator = Mage::getSingleton('tax/calculation');
$request = $taxCalculator->getRateRequest($this->quote->getShippingAddress(), $this->quote->getBillingAddress(), $this->quote->getCustomerTaxClassId(), $this->quote->getStore());
$request->setProductClassId($this->getProduct()->getTaxClassId());
return $taxCalculator->getRate($request);
}
示例2: getCustomerTaxClassId
public function getCustomerTaxClassId()
{
/** @var $customer Mage_Customer_Model_Customer */
$customer = Mage::getSingleton('customer/session')->getCustomer();
if ($taxClassId = $customer->getTaxClassId()) {
$this->setCustomerTaxClassId($taxClassId);
return $this->getData('customer_tax_class_id');
}
return parent::getCustomerTaxClassId();
}
示例3: toOrder
/**
* Convert quote model to order model
*
* @param Mage_Sales_Model_Quote $quote
* @return Mage_Sales_Model_Order
*/
public function toOrder(Mage_Sales_Model_Quote $quote, $order = null)
{
if (!$order instanceof Mage_Sales_Model_Order) {
$order = Mage::getModel('sales/order');
}
/* @var $order Mage_Sales_Model_Order */
$order->setStoreId($quote->getStoreId())->setQuoteId($quote->getId())->setRemoteIp($quote->getRemoteIp())->setCustomerId($quote->getCustomerId())->setCustomerEmail($quote->getCustomerEmail())->setCustomerFirstname($quote->getCustomerFirstname())->setCustomerLastname($quote->getCustomerLastname())->setCustomerGroupId($quote->getCustomerGroupId())->setCustomerTaxClassId($quote->getCustomerTaxClassId())->setCustomerNote($quote->getCustomerNote())->setCustomerNoteNotify($quote->getCustomerNoteNotify())->setCustomerIsGuest($quote->getCustomerIsGuest())->setBaseCurrencyCode($quote->getBaseCurrencyCode())->setStoreCurrencyCode($quote->getStoreCurrencyCode())->setOrderCurrencyCode($quote->getQuoteCurrencyCode())->setStoreToBaseRate($quote->getStoreToBaseRate())->setStoreToOrderRate($quote->getStoreToQuoteRate())->setCouponCode($quote->getCouponCode())->setGiftcertCode($quote->getGiftcertCode())->setIsVirtual($quote->getIsVirtual())->setIsMultiPayment($quote->getIsMultiPayment())->setAppliedRuleIds($quote->getAppliedRuleIds());
Mage::dispatchEvent('sales_convert_quote_to_order', array('order' => $order, 'quote' => $quote));
return $order;
}
示例4: _getProductTaxClassId
protected function _getProductTaxClassId()
{
if (is_null($this->_productTaxClassId)) {
// Init product tax class
// -------------------------
$productTaxClass = Mage::getModel('tax/class')->getCollection()->addFieldToFilter('class_name', 'eBay Product Tax Class')->addFieldToFilter('class_type', Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT)->getFirstItem();
if (is_null($productTaxClass->getId())) {
$productTaxClass->setClassName('eBay Product Tax Class')->setClassType(Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT);
$productTaxClass->save();
}
// -------------------------
// Init customer tax class
// -------------------------
if (is_null($customerTaxClassId = $this->_quote->getCustomerTaxClassId())) {
$customerTaxClass = Mage::getModel('tax/class')->getCollection()->addFieldToFilter('class_name', 'eBay Customer Tax Class')->addFieldToFilter('class_type', Mage_Tax_Model_Class::TAX_CLASS_TYPE_CUSTOMER)->getFirstItem();
if (is_null($customerTaxClass->getId())) {
$customerTaxClass->setClassName('eBay Customer Tax Class')->setClassType(Mage_Tax_Model_Class::TAX_CLASS_TYPE_CUSTOMER);
$customerTaxClass->save();
}
$customerTaxClassId = $customerTaxClass->getId();
}
// -------------------------
// Init tax rate
// -------------------------
$taxRate = Mage::getModel('tax/calculation_rate')->load('eBay Tax Rate', 'code');
$taxRate->setRate((double) $this->_taxPercent)->setCode('eBay Tax Rate')->setTaxCountryId('US');
$taxRate->save();
// -------------------------
// Combine tax classes and tax rate in tax rule
// -------------------------
$taxRule = Mage::getModel('tax/calculation_rule')->load('eBay Tax Rule', 'code');
$taxRule->setCode('eBay Tax Rule')->setTaxCustomerClass(array($customerTaxClassId))->setTaxProductClass(array($productTaxClass->getId()))->setTaxRate(array($taxRate->getId()));
$taxRule->save();
// -------------------------
$this->_productTaxClassId = $productTaxClass->getId();
}
return $this->_productTaxClassId;
}
示例5: _getBuckarooFeeTaxRequest
/**
* Get the tax request object for the current quote.
*
* @param Mage_Sales_Model_Quote $quote
*
* @return bool|Varien_Object
*/
protected function _getBuckarooFeeTaxRequest(Mage_Sales_Model_Quote $quote)
{
$store = $quote->getStore();
$codTaxClass = Mage::getStoreConfig(self::XPATH_BUCKAROO_TAX_CLASS, $store);
/**
* If no tax class is configured for the Buckaroo fee, there is no tax to be calculated.
*/
if (!$codTaxClass) {
return false;
}
$taxCalculation = $this->getTaxCalculation();
$customerTaxClass = $quote->getCustomerTaxClassId();
$shippingAddress = $quote->getShippingAddress();
$billingAddress = $quote->getBillingAddress();
$request = $taxCalculation->getRateRequest($shippingAddress, $billingAddress, $customerTaxClass, $store);
$request->setProductClassId($codTaxClass);
return $request;
}