Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Magento签出过程的每个选项卡中显示购物车内容?_Magento_Cart - Fatal编程技术网

如何在Magento签出过程的每个选项卡中显示购物车内容?

如何在Magento签出过程的每个选项卡中显示购物车内容?,magento,cart,Magento,Cart,客户希望每个步骤(登录/注册、计费、发货等)的结帐过程看起来都像是独立的页面,所以我修改了模板,使其看起来像那样,一切正常。但是,现在他们希望在每个步骤中显示购物车内容 我假设我可以使用购物车侧边栏模块,但我无法让它正确显示 我怀疑这部分是因为我不了解Magento使用的某些模块/块配置。我已经试着读过了,但就像所有的Magento一样,它非常不清楚 那么,如何将购物车内容插入custom/template/checkout/onepage/billing.phtml的模板中呢?我确信有多种方法

客户希望每个步骤(登录/注册、计费、发货等)的结帐过程看起来都像是独立的页面,所以我修改了模板,使其看起来像那样,一切正常。但是,现在他们希望在每个步骤中显示购物车内容

我假设我可以使用购物车侧边栏模块,但我无法让它正确显示

我怀疑这部分是因为我不了解Magento使用的某些模块/块配置。我已经试着读过了,但就像所有的Magento一样,它非常不清楚


那么,如何将购物车内容插入custom/template/checkout/onepage/billing.phtml的模板中呢?我确信有多种方法可以做到这一点,我只是在寻找最简单的方法。

这应该在任何地方都能奏效,而不仅仅是在计费阶段:

$quote = Mage::helper('checkout')->getQuote();
foreach ($quote->getItemsCollection() as $item) {
    // output details of an item.
    echo $item->getName();
}
每个
$item
都是一个

PS.

听起来好像您正在尝试重新创建在引入onepage签出之前存在的旧多芯片签出。这可以通过系统>配置>结帐>结帐选项中的第一个设置重新激活。

钟表匠让我从这个答案开始,但我还需要显示产品数量、价格,然后是购物车的总价格。Magento文档充其量是密集的,因此在搜索之后,以下是在Magento中显示购物车内容的答案,其中包含一些用于格式化的表格HTML:

<?php $quote = Mage::helper('checkout')->getQuote(); //gets the cart contents ?>
<table>
<thead>    
<th>Product</th>
<th>Quantity</th>
<th>Price/ea.</th>
<th>Total</th>
</thead>

<?php foreach ($quote->getItemsCollection() as $item) { ?>
<tr><td><?php echo $item->getName(); ?></td>
<td><?php echo $item->getQty(); ?></td> 
<td><?php echo $this->helper('checkout')->formatPrice($item->getPrice(), 2); ?></td>
<td><?php $floatQty = floatval($item->getQty());
$total = $floatQty * $item->getPrice();
echo $this->helper('checkout')->formatPrice($total, 2); //multiply the quantity by the price and convert/format ?></td>
</tr>       
<?php  } ?>

<tfoot>
<td></td>
<td></td>
<td></td>
<td><?php echo $this->helper('checkout')->formatPrice($quote->getGrandTotal()); ?></td>
</tfoot>
</table>

产品
量
价格/每件。
全部的
这可能是一些非常难看的代码,包括找到每个$item的总数的粗略方法,但它是有效的。我确信有更好的方法来获得$item总数(calcRowTotal似乎从来都不起作用),但它完成了任务

感谢发条怪送我走上正确的道路