문제

B2B 고객을 위한 카탈로그에 세금 없이 가격을 표시하고 싶지만 평소대로 세금을 포함하여 계산합니다.

두 번째 매장 보기로 이 작업을 수행할 수 있다는 것을 알고 있지만 두 번째 보기 없이도 이것이 가능합니까?

도움이 되었습니까?

해결책

그것이 받아들여지는 질문이라 할지라도 나는 몇 가지 추가적인 조언을 드리고 싶습니다:

관찰자를 만들지 않았지만 복제했기 때문에 app/code/core/Mage/Tax/Model/Config.php 로컬로 변경했습니다. getPriceDisplayType 몇 가지 추가 기능이 있습니다.

허용되는 답변은 그룹 ID만 확인합니다.더 나아가 TaxClassId를 확인했습니다.지금은 하드코딩되어 있지만 관찰자나 확장으로 래핑될 때 백엔드에서도 구성 설정을 통해 수행할 수 있습니다.

내 수정된 기능은 다음과 같습니다

public function getPriceDisplayType($store = null)
{
    $customerGroupId = Mage::getModel('customer/customer')->getGroupId();
    $customerGroup = Mage::getModel('customer/group')->load($customerGroupId);
    $customerTaxId = $customerGroup->getTaxClassId($customerGroupId);

    if ($customerTaxId == 5) {
        $this->changeConfigTemp('tax/cart_display/price', '1');
        $this->changeConfigTemp('tax/cart_display/subtotal', '1');
        $this->changeConfigTemp('tax/display/type', '1');
        $this->changeConfigTemp('tax/sales_display/price', '1');
        $this->changeConfigTemp('tax/sales_display/subtotal', '1');
        $this->changeConfigTemp('tax/display/show_in_catalog', '1');
    } else {
        return (int)$this->_getStoreConfig(self::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, $store);
    }
}

이것으로 필요한 모든 작업이 완료되었으며 지금까지 디스플레이나 논리적 "오류"가 발생하지 않았습니다.

설정은 세금을 포함하여 총합계가 표시되는 반면 다른 값은 세금 없이 표시되므로 약간 '독일어와 유사'합니다.이것이 다른 사람들에게도 도움이 되기를 바랍니다.

다른 팁

시스템> 구성> 세금으로 이동하여 마지막 탭 "디스플레이"를 찾으십시오."디스플레이 제품 가격"에서는 "세금 포함을 포함하여"세금을 포함하여 구성을 저장합니다.

https://github.com/astorm/chaos 변경되는 옵저버를 만들었습니다.페이지 및 사용자 그룹에 따라 세금없이 tax/calculation/price_includes_tax의 Config 값 값.

이것은 의견이 짧지 만 누군가를 도울 수 있습니다 :

class YourThing_TaxChanger_Model_Observer
{
    static protected $_hasRun = false;

    public function setup($observer)
    {
        if($this->_shouldBail($observer))
        {
            return;
        }

        $roleId = Mage::getSingleton('customer/session')->getCustomerGroupId();
        //echo Mage::getSingleton('customer/group')->load($roleId)->getData('customer_group_code');
        $page = Mage::app()->getFrontController()->getRequest()->getControllerName();

        // check user group and page
        if ($roleId == 2 && (in_array($page, array('product', 'category', 'result'))))
        {
            // show price without tax
            $this->changeConfigTemp('tax/calculation/price_includes_tax', '1');
            // germansetup tax info
            //$this->changeConfigTemp('tax/sales_display/price', Mage_Tax_Model_Config::DISPLAY_TYPE_EXCLUDING_TAX);
        }
    }

    /**
     * Change a config value without saving it.
     */
    protected function changeConfigTemp($path, $value)
    {
        $config = Mage::getConfig();
        $store = Mage::app()->getStore();
        $code  = $store->getCode();
        $config->setNode("stores/$code/" . $path, $value);
    }

    protected function _shouldBail($observer)
    {
        $config = Mage::getConfig();
        if(!$config)
        {
            return true;
        }
        if(Mage::app()->getStore()->isAdmin())
        {
            return true;
        }

        return false;
    }
}
.

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