문제

모든 사용자가 청구서 수정을 방지하는 방법이 있습니까? 등록시 청구서 주소를 입력 한 후 사용자는 사용자가 수정할 수 없도록합니다. 고맙습니다.

도움이 되었습니까?

해결책

통지

Magento가 청구서를 관리하는 방법을 고려하면 묻는 메시지가 까다로워집니다. 주소는 청구 주소가 될 수 있습니다. 고객은 시스템의 다양한 포인트의 메뉴 구성 요소에서 단순히 선택할 수 있습니다 (즉, 체크 아웃, 주소록 화면).

"기본 청구서 주소"에서 편집을 제한해도 Magento는 주소록의 주소를 기본 결제 주소로 설정할 수있게 해주는 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; ?>
.

타이틀 아래에서 편집중인 주소가 기본 청구인지 확인하는 추가 논리를 추가합니다. 그렇다면 편집 양식을 렌더링하지 않고 일반 메시지를 표시하지 않습니다.

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