문제

My Magento 웹 사이트에서는 제품 가격이 12.5 %의 세금을 포함하고 있습니다. 고객이 B2B 인 경우 (onepagecheckout에 C 형을 선택하는지 알게됩니다) 다음과 같이 세금을 재 계산하고 싶습니다 :

  • 는 제품 가격에서 12.5 %를 줄입니다.I.E.. 귀하의 제품 가격이 50000이면 50000
  • 에서 12.5 %를 줄입니다.
  • 는 12.5 %의 감소 후 가격에 2 %를 추가합니다

예 :

Product Price : 50000
Base Price: 50000 - 12.5% of Product Price
CST (2%): 2% of the Base Price
Total: Base Price + CST
.

나를 안내 해주세요.

도움이 되었습니까?

해결책 5

I had done this with myself by adding custom logic in the sales_quote_collect_totals_before observer

Step 1:- Declare Observer in config.xml

<events>
    <sales_quote_collect_totals_before>
        <observers>
            <new_tax>
                <type>singleton</type>
                <class>Neo_Cform_Model_Observer</class>
                <method>newTax</method>
            </new_tax>
        </observers>
    </sales_quote_collect_totals_before>
</events>

Step 2:- Declare Observer's function in Observer.php

public function newTax($observer){
    $quote = $observer->getQuote();
    foreach ($quote->getAllItems() as $quoteItem) {
        if ($quote->getData('customer_cform') === 'true') { // check if customer is b2b customer and selects for the cform option
            $product = $quoteItem->getProduct();
            $product->setTaxClassId(0); // tax class removed.now the price is with no tax
            $basePrice = $product->getFinalPrice() / (1+(12.5/100)); // calcuated 12.5 % of total price and subtracted from the price to get base price
            $final_cst_price = $basePrice * (2/100); // added 2% in the base price to get fincal cst price
            $finalPrice = $basePrice + $final_cst_price;
            $product->setPrice($basePrice);
            $product->setTaxClassId(8); // here 8 is a tax rule defined in the magento admin just to show the split of base price and tax (2%) in the cart page and checkout page
        }
    }
}

다른 팁

모든 B2B 고객 및 세금 규칙에 대해 고객 그룹을 설정하는 것은 어떻습니까?

사용자 정의 제품 가격은 Mage_Catalog_model_Product_Type_Price에서 GetFinalPrice 메소드를 확장하는 모듈을 작성하여 달성 할 수 있습니다.

제품의 유형에 따라 구성 가능하고 간단한 제품에 대해 다른 가격 방법이 다른 것으로 다른 가격 코드를 확장해야 할 수도 있습니다.

여기서는 B2B 고객의 고정 비율로 최종 제품 가격을 할인하는 모듈의 EXCEPRT입니다.

먼저 GetFinalPrice 메소드를 확장

class PAJ_Price_Model_Simple extends Mage_Catalog_Model_Product_Type_Price
{
    public function getFinalPrice($qty = null, $product)
    {

        if (is_null($qty) && !is_null($product->getCalculatedFinalPrice())) {
            return $product->getCalculatedFinalPrice();
        }

        $finalPrice = $this->getBasePrice($product, $qty);
        $product->setFinalPrice($finalPrice);

        Mage::dispatchEvent('catalog_product_get_final_price', array('product' => $product, 'qty' => $qty));

        $finalPrice = $product->getData('final_price');
        $finalPrice = $this->_applyOptionsPrice($product, $qty, $finalPrice);
        $finalPrice = max(0, $finalPrice);

        // get B2B Final Price
        if ($_B2BFinalPrice=Mage::helper('PAJ_Price/B2BFinalPrice')->getB2BFinalPrice($product,$finalPrice)) { return max(0, $_B2BFinalPrice); }

        $product->setFinalPrice($finalPrice);

        return $finalPrice;
    }
}
.

볼 수 있듯이 가격 계산이 헬퍼 방법 b2bfinalprice에서 수행됩니다. 여기서 고객이 B2B I.E.E. 특정 그룹의 구성원인지 여부를 결정한 논리를 적용한 다음 예제에서 최종 가격에 대한 계산을 수행합니다.

class PAJ_Price_Helper_B2BFinalPrice extends Mage_Core_Helper_Abstract
{
    public function getB2BFinalPrice($product,$finalPrice)
    {
                    $basePrice=$finalPrice - ($finalPrice * (12.5/100));
                    $cst=$basePrice + ($basePrice * (2/100));

                    $finalPrice=$basePrice+$cst;

                    return $finalPrice;
    }
}
.

이것은 세금 계산이 아닌 제품 최종 가격을 변경합니다. 이 예제 세금은 최종 가격으로 계산됩니다.

계층 가격과 같은 다른 가격을 표시하는 경우 Frintend 테마 에서이 계산을 수행하여 B2B 고객을 위해 Tier 가격을 올바르게 표시해야합니다.

이와 같은 솔루션을 구현하려면 사용자 정의 모듈을 만들고 Magento Core 코드를 확장하는 데 익숙해 져야합니다.

올바른 결과를 얻을 수 있도록 많은 테스트를 수행해야합니다. 당신은 제품 가격으로 실수를하고 싶지 않습니다!

나는 보지 않았지만 Magento Connect에서 유사한 것을 발견 할 수도 있습니다.

희망이 도움이됩니다.

"NoFollow"> Mailople 면제 ...에그것은 특정 조건에 대한 세금을 제거 할 수 있습니다.

You can add a shopping price rule under which can be found under:

Promotions->Shopping Cart Price Rule 

and then place that rule at certain customer group that you will create. The customer group is located under:

Customers->Customer Groups
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top