سؤال

في موقع Magento الخاص بي، لدي أسعار المنتجات بما في ذلك ضريبة 12.5٪. إذا كان العميل B2B (سيحدد ما إذا كان يختار أنه يحتوي على نموذج C في onepagecheckout)، فأنا أرغب في إعادة حساب الضريبة على النحو التالي:

  • تقليل 12.5٪ من سعر المنتج.أي إذا كان سعر المنتج الخاص بي 50000 ثم تقليل 12.5٪ من 50000
  • ثم أضف 2٪ على السعر بعد تخفيض 12.5٪

على سبيل المثال:

giveacodicetagpre.

يرجى توجيه لي.

هل كانت مفيدة؟

المحلول 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 والقواعد الضريبية؟

تسعير المنتج المخصص قابلة للتحقيق من خلال كتابة وحدة نمطية لتوسيع طريقة GetFinalPrice في mage_catalog_model_product_type_price.

اعتمادا على نوع المنتجات التي قد تحتاجها إلى توسيع رمز التسعير الآخر حيث توجد طرق أسعار مختلفة للمنتجات القابلة للتكوين والمنتجات البسيطة.

هنا هو exceprt من وحدة نمطية كتبت أن تخفيضات سعر المنتج النهائي من خلال نسبة ثابتة لعملاء B2B.

أولا، نقوم بتوسيع طريقة GetFinalPrice

giveacodicetagpre.

كما ترى حساب السعر يتم الآن تنفيذها في طريقة المساعد B2BFinalPrice. يمكنك هنا تطبيق المنطق الذي يحدد ما إذا كان العميل هو B2B I.E. عضو مجموعة معينة، ثم في مثالك يؤدي الحساب للحصول على السعر النهائي:

giveacodicetagpre.

لاحظ أن هذا هو تغيير سعر المنتج النهائي، وليس الحساب الضريبي. في هذا المثال، سيتم حساب الضريبة على السعر النهائي.

إذا كنت تعرض أسعارا أخرى، مثل أسعار الدرجة، فستحتاج أيضا إلى تنفيذ هذا الحساب في سمة Frontend الخاصة بك لعرض تسعير المستوى لعملاء B2B بشكل صحيح.

لتنفيذ حل مثل هذا تحتاج إلى أن تكون على دراية بإنشاء وحدات مخصصة وتمديد رمز Magento Core.

تحتاج أيضا إلى القيام بالكثير من الاختبار للتأكد من أنك تحصل على النتائج الصحيحة. أنت لا تريد إجراء أي أخطاء مع تسعير المنتج!

لم أبحث ولكن يمكنك أيضا العثور على شيء مماثل متاح من Magento Connect.

نأمل أن يساعد هذا.

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