Skip to content

[BUG] Taxvat, Dob, and Gender Attributes Ignore WEBSITE Scope and Only Work on GLOBAL Scope #4732

Open
@empiricompany

Description

@empiricompany

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The Taxvat attribute (along with other account-level attributes such as dob and gender) only works at the GLOBAL scope and does not respect custom values set at the WEBSITE scope.

For example, if Taxvat is disabled GLOBALLY but required for a specific WEBSITE, it does not appear on the Account Edit form.

config_website

The issue comes from app\code\core\Mage\Customer\Block\Widget\Taxvat.php

class Mage_Customer_Block_Widget_Taxvat extends Mage_Customer_Block_Widget_Abstract
{
    public function _construct()
    {
        parent::_construct();
        $this->setTemplate('customer/widget/taxvat.phtml');
    }

    /**
     * @return bool
     */
    public function isEnabled()
    {
        return (bool)Mage::getStoreConfig('customer/address/taxvat_show'); <==== possible fix read from config
        return (bool)$this->_getAttribute('taxvat')->getIsVisible();
    }

    /**
     * @return bool
     */
    public function isRequired()
    {
        return (bool)Mage::getStoreConfig('customer/address/taxvat_show') == 'req'; <==== possible fix read from config
        return (bool)$this->_getAttribute('taxvat')->getIsRequired();
    }

    /**
     * @return Mage_Customer_Model_Customer
     */
    public function getCustomer()
    {
        return Mage::getSingleton('customer/session')->getCustomer();
    }
}

Called from various templates such as app\design\frontend\rwd\default\template\customer\form\edit.phtml

<?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
<?php if ($_dob->isEnabled()): ?>
    <li><?php echo $_dob->setDate($this->getCustomer()->getDob())->toHtml() ?></li>
<?php endif ?>
<?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
<?php if ($_taxvat->isEnabled()): ?>
    <li><?php echo $_taxvat->setTaxvat($this->getCustomer()->getTaxvat())->toHtml() ?></li>
<?php endif ?>
<?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
<?php if ($_gender->isEnabled()): ?>
    <li><?php echo $_gender->setGender($this->getCustomer()->getGender())->toHtml() ?></li>
<?php endif ?>

Expected Behavior

The Taxvat, Dob, and gender attributes should respect the WEBSITE scope configuration.
If an attribute is disabled GLOBALLY but enabled for a specific WEBSITE, it should be visible and functional on the Account Edit form accordingly.

Steps To Reproduce

  1. Go to Admin PanelStoresConfigurationCustomersCustomer ConfigurationName and Address Options.
  2. Set Taxvat to Disabled at the GLOBAL scope.
  3. Switch to a specific WEBSITE scope and set Taxvat to Required.
  4. Save the configuration and clear the cache.
  5. Log in to the storefront as a customer on the WEBSITE where Taxvat was set to Required, then navigate to Account Edit.

Issue: The Taxvat field does not appear, despite being set as Required for that WEBSITE.

Environment

- OpenMage:20.12.0
- php:8.2.2

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions