如何将购买的产品图片添加到Magento结帐中的“订单审核”部分?
我希望在订单审核中看到产品图片吗?
答案 0 :(得分:8)
Order Review表的设计模板位于frontend / {your_theme} / decault / template / checkout / onepage / review /文件夹中。您需要更新的文件是info.phtml(添加列)和item.phtml(添加实际图像)。
前端/ {your_theme} /decault/template/checkout/onepage/review/info.phtml
<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" />
<col width="1" /> <!-- <---Add this new col in table description -->
...
然后找到表头并添加图像列:
<thead>
<tr>
<th rowspan="<?php echo $rowspan ?>"> </th> <!-- Here's the empty col for the image -->
<th rowspan="<?php echo $rowspan ?>"><?php echo $this->__('Product Name') ?></th>
<th colspan="<?php echo $colspan ?>" class="a-center"><?php echo $this->__('Price') ?></th>
...
前端/ {your_theme} /decault/template/checkout/onepage/review/item.phtml
在item.phtml文件的开头,添加您的图片:
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
?>
<?php $_item = $this->getItem()?>
<tr>
<!-- Product Image Here -->
<td><img src="<?php echo $this->getProductThumbnail()->resize(75); ?>" width="75" height="75" alt="<?php echo $this->htmlEscape($this->getProductName()) ?>" /></td>
<td><h3 class="product-name"><?php echo $this->htmlEscape($this->getProductName()) ?></h3>
...
记住 - 请勿更改核心文件,而是更新您自己主题中的模板文件。
答案 1 :(得分:2)
此外,您还必须编辑总计模板:
frontend / {your theme} /default/template/checkout/onepage/review/totals.phtml
调整botto列colspan:
<?php if ($this->getTotals()): ?>
<tfoot>
<?php $_colspan = $this->helper('tax')->displayCartBothPrices() ? 6 : 4; ?>
答案 2 :(得分:1)
实际上info.phtml
的空列应使用$colspan
,否则其宽度会变得太大:
<th rowspan="<?php echo $colspan ?>"> </th>
答案 3 :(得分:1)
修改结帐/ onepage / review / item.phtml
添加以下代码
$_product = Mage::getModel('catalog/product')->load($_item->getProductId());
<img src="<?php echo Mage::helper('catalog/image')->init($_product, 'thumbnail')->resize(75, 75); ?>" alt="<?php echo $this->htmlEscape($_product['name']); ?>" border="0"/>
答案 4 :(得分:0)
我修改了info.phtml
中的表格,以使表格与购物车保持一致
<table class="data-table" id="checkout-review-table">
<?php if ($this->helper('tax')->displayCartBothPrices()): $colspan = $rowspan = 2; else: $colspan = $rowspan = 1; endif; ?>
<col width="1" /> <!-- <---Add width="1" to first column (Image) -->
<col /> <!-- <---no width for 'Product Name' to show all options nicely -->
<col width="1" />
<col width="1" />
<col width="1" /> <!-- <---Add this new col in table description -->