有人知道将magento checkout onepage成功样式作为发票的参考或链接,我用来将一些代码从review.phtml页面复制到checkout_onepage_success
<div id="checkout-review-table-wrapper">
<table class="data-table" id="checkout-review-table">
<?php if ($this->helper('tax')->displayCartBothPrices()): $colspan = $rowspan = 2; else: $colspan = $rowspan = 1; endif; ?>
<col />
<col width="1" />
<col width="1" />
<col width="1" />
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
<col width="1" />
<col width="1" />
<?php endif; ?>
<thead>
<tr>
<th rowspan="<?php echo $rowspan ?>"><?php echo $this->__('Product Name') ?></th>
<th colspan="<?php echo $colspan ?>" class="a-center"><?php echo $this->__('Price') ?></th>
<th rowspan="<?php echo $rowspan ?>" class="a-center"><?php echo $this->__('Qty') ?></th>
<th colspan="<?php echo $colspan ?>" class="a-center"><?php echo $this->__('Subtotal') ?></th>
</tr>
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
<tr>
<th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
<th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
<th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
<th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
</tr>
<?php endif; ?>
</thead>
<?php echo $this->getChildHtml('totals'); ?>
<tbody>
<?php foreach($this->getItems() as $_item): ?>
<?php echo $this->getItemHtml($_item)?>
<?php endforeach ?>
</tbody>
</table>
</div>
<?php echo $this->getChildHtml('items_after'); ?>
<script type="text/javascript">
//<![CDATA[
decorateTable('checkout-review-table');
truncateOptions();
//]]>
</script>
但它只显示表头,我还需要包含地址而不是订单表,谢谢
答案 0 :(得分:0)
您可以获取最近的订单ID,然后在success.phtml文件中加载订单。
$order_id = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
您可以使用
$order
获取您要使用的任何数据。在您的情况下,您可以通过
获取所有项目 $items = $order->getAllItems();
然后循环播放。
答案 1 :(得分:0)
//get the order details.
$order_id = Mage::getSingleton('checkout/session')
>getLastRealOrderId();
$order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
//get billing address.
$billingAddress = $order->getBillingAddress();
//get shipping address.
$shippingAddress = $order->getShippingAddress();