請求先住所を無効にします
-
12-12-2019 - |
質問
すべてのユーザーによる請求先アドレス変更を防ぐ方法はありますか? 登録時に請求先住所を入力した後、ユーザーにそれを明記させたくありません。 ありがとうございました。
解決
通知
マゼントが請求先住所をどのように管理するかを検討するときに求めているのは難しいことになるのです。 任意のアドレスは請求先アドレスになる可能性があります。顧客は、システム内のさまざまな点でメニューコンポーネントからそれを選択することができます(つまり、チェックアウト、アドレス帳画面)。
「デフォルトの請求先住所」で編集を制限しても、Magentoがあなたのアドレス帳の任意のアドレスをデフォルトの請求先住所として設定することができるように、これもあなたのために何らかのオーバーヘッドを作成します。言い換えれば、顧客は「課金以外」アドレスを編集してから、デフォルトの請求先アドレスとして設定することができます。これを管理するためのコードを書くのは面倒です。
そしてフロントエンドでアドレス編集を提供するサードパーティ製の拡張機能を使用していますか?ここで考えることはたくさんあります。
溶液
邪魔になる免責事項では、単にを変更することで、2テンプレートを変更してアドレスを編集する機能を防ぎます。
# File: app/design/frontend/[package]/[theme]/template/customer/address/book.phtml
...
<h2><?php echo $this->__('Default Addresses') ?></h2>
<ol>
<?php if($_pAddsses = Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling()): ?>
<li class="info-box">
<div class="title-wrap">
<h3><?php echo $this->__('Default Billing Address') ?></h3>
<?php /*<a href="<?php echo $this->getAddressEditUrl(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?>"><?php echo $this->__('Change Billing Address') ?></a>*/ ?>
</div>
<address class="box-content">
<?php echo $this->getAddressHtml(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?>
</address>
</li>
<?php else: ?>
<li class="info-box">
<h3><?php echo $this->__('Default Billing Address') ?></h3>
<?php echo $this->__('You have no default billing address in your address book.') ?>
...
.
線9を参照してください。ここでは、アドレスを編集するためのリンクをコメントアウトします。安全ではありませんが、始める場所をお届けします。
# File: app/design/frontend/[package]/[theme]/template/customer/address/edit.phtml
...
<?php
/**
* Edit customer address template
*
* @see Mage_Customer_Block_Address_Edit
*/
?>
<?php if($this->getTitle()): ?>
<div class="page-title">
<h1><?php echo $this->getTitle() ?></h1>
</div>
<?php endif; ?>
<?php if ($address->getId() === Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling()) :?>
<p><?php echo $this->__('Sorry, but you cannot modify this address.'); ?></p>
<?php else : ?>
...
<?php endif; ?>
.
タイトルの下には、編集中のアドレスがデフォルトの請求があるかどうかを確認する追加のロジックを追加します。もしそうなら、それは編集形式をレンダリングし、代わりに汎用メッセージを表示します。
# File: app/design/frontend/[package]/[theme]/template/customer/address/book.phtml
...
<h2><?php echo $this->__('Default Addresses') ?></h2>
<ol>
<?php if($_pAddsses = Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling()): ?>
<li class="info-box">
<div class="title-wrap">
<h3><?php echo $this->__('Default Billing Address') ?></h3>
<?php /*<a href="<?php echo $this->getAddressEditUrl(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?>"><?php echo $this->__('Change Billing Address') ?></a>*/ ?>
</div>
<address class="box-content">
<?php echo $this->getAddressHtml(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?>
</address>
</li>
<?php else: ?>
<li class="info-box">
<h3><?php echo $this->__('Default Billing Address') ?></h3>
<?php echo $this->__('You have no default billing address in your address book.') ?>
...
.
# File: app/design/frontend/[package]/[theme]/template/customer/address/edit.phtml
...
<?php
/**
* Edit customer address template
*
* @see Mage_Customer_Block_Address_Edit
*/
?>
<?php if($this->getTitle()): ?>
<div class="page-title">
<h1><?php echo $this->getTitle() ?></h1>
</div>
<?php endif; ?>
<?php if ($address->getId() === Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling()) :?>
<p><?php echo $this->__('Sorry, but you cannot modify this address.'); ?></p>
<?php else : ?>
...
<?php endif; ?>
.