我找到了一个解决方案,这里是:
首先,在 template/downloadable/ 创建一个新的 .phtml 文件,我叫我的 downloadablelist.phtml
然后将所有 template/downloadable/customer/products/list.phtml 复制到我们新的 downloadablelist.phtml 中
这将为我们提供一份客户帐户我的可下载产品列表的副本。
在成功页面中调用我们的块:
<?php echo $this->getLayout()->createBlock('downloadable/customer_products_list')->setTemplate('downloadable/checkout/downloadablelist.phtml')->toHtml(); ?>
现在我从产品列表中清理了我不需要的东西。我删除了表格并添加了一个 ul 。
接下来是只显示最后一个订单生产的产品。
<?php
$_items = $this->getItems();
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
if(count($_items)):
$_group_id = Mage::helper('customer')->getCustomer()->getGroupId();
echo '<p><strong>'.$this->__('Downloadable products').' : </strong></p>'; ?>
<ul style="margin-left: 30px; list-style: disc;">
<?php foreach ($_items as $_item):
$itemOrderId = $_item->getPurchased()->getOrderIncrementId();
if($itemOrderId == $orderId) {?>
<li><?php echo $this->htmlEscape($_item->getPurchased()->getProductName()) ?> - <a href="<?php echo $this->getUrl('downloadable/download/link/', array('id' => $_item->getLinkHash(), '_secure' => true)) ?>" title="<?php echo Mage::helper('downloadable')->__('Start Download') ?>" <?php echo $this->getIsOpenInNewWindow()?'onclick="this.target=\'_blank\'"':''; ?>><?php echo $_item->getLinkTitle() ?></a></li>
<?php }
endforeach; ?>
</ul>
<?php endif; ?>
我将原始可下载文件的 url 更改为:
href="<?php echo $this->getUrl('downloadable/download/link/', array('id' => $_item->getLinkHash(), '_secure' => true)) ?>"
谢谢