magento 想做国内市场的朋友,肯定会觉得账单地址,和发货地址,只取其一就可以了,没必要两个都要。今天在看了水水的博客后,写一个具体的步骤,以作记忆。
1.修改onepage.phtml 修改foreach 下的li
<?php if (!$this->getChild($_stepId) || !$this->getChild($_stepId)->isShow()): continue; endif; $i++; ?>
<li <?php if($_stepId == 'shipping') $i--; ?> id="opc-<?php echo $_stepId ?>" class="section<?php echo !empty($_stepInfo['allow'])?' allow':'' ?><?php echo !empty($_stepInfo['complete'])?' saved':'' ?>">
<div class="step-title">
<span class="number"><?php echo $i ?></span>
<h2><?php echo $_stepInfo['label'] ?></h2>
<a href="#"><?php echo $this->__('Edit') ?></a>
</div>
<div id="checkout-step-<?php echo $_stepId ?>" class="step a-item" style="display:none;">
<?php echo $this->getChildHtml($_stepId) ?>
</div>
</li>
其中就添加了 <?php if($_stepId == 'shipping') $i--; ?> ,
2.然后修改css添加
#checkoutSteps #co-billing-form .control {
display:none;
}
#checkoutSteps #opc-shipping {
display:none;
}
#shipping-progress-opcheckout {
display:none;
}
这些css 将隐藏,账单地址下面的用这个地址为发货地址,和隐藏第二步发货地址
3. 在发送方式,返回键的处理,还是修改onepage.html 添加
<script type="text/javascript">
//<![CDATA[
var accordion = new Accordion('checkoutSteps', '.step-title', true);
<?php if($this->getActiveStep()): ?>
accordion.openSection('opc-<?php echo $this->getActiveStep() ?>');
<?php endif ?>
var checkout = new Checkout(accordion,{
progress: '<?php echo $this->getUrl('checkout/onepage/progress') ?>',
review: '<?php echo $this->getUrl('checkout/onepage/review') ?>',
saveMethod: '<?php echo $this->getUrl('checkout/onepage/saveMethod') ?>',
failure: '<?php echo $this->getUrl('checkout/cart') ?>'}
);
jQuery("#shipping-method-buttons-container a").click(function(){
checkout.back();
checkout.back();
return false;
});
//]]>
</script>
其中jQuery("#shipping-method-buttons-container a").click(function(){ checkout.back(); checkout.back(); return false; });是添加的