質問

マゼントのウェブサイトには、私が製品価格が12.5%の税金を含む。 顧客がB2Bの場合(彼がOnePageCheckoutにCフォームがあるかどうかを知るようになるでしょう)それから、次のように税を再計算したいです。

  • 製品価格から12.5%を減らします。すなわち、私の製品価格が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であるかどうかを決定するロジックを特定のグループのメンバーで、その後最終価格の計算を実行できます。

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;
    }
}
.

税計算ではなく製品最終価格を変更していることに注意してください。この例では税金は最終価格で計算されます。

階層価格などの他の価格を表示している場合は、B2B顧客のティア価格を正しく表示するためにフロントエンドのテーマでこの計算を実行する必要があります。

このような解決策を実装するには、カスタムモジュールの作成とMagentoコアコードの拡張に精通している必要があります。

あなたが正しい結果を得ていることを確認するために多くのテストをする必要があります。あなたは製品の価格設定で間違いをしたくない!

私は見ていませんが、Magento Connectから入手可能なものも同様のものを見つけることができます。

これが役立つことを願っています。

あなたは VAT免除。それは特定の条件で税を削除するかもしれません推測あなたの要求が少しのビットをカスタマイズすることによって達成できると思います。

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