douyi4544 2018-08-26 13:09
浏览 42

如何在商品中的订单页面上加价

I have overridden the order page in shopware and i want to create a total of all the orders that not yet been processed. i have wtitten this to just show the variables that i need. i want to add up all the totals of the invoice_amount of the orders.

{extends file="parent:frontend/account/orders.tpl"}

{block name="frontend_account_orders_welcome"}
    {$smarty.block.parent}
    {debug}
    <ul>
        {foreach $sOpenOrders as $sOpenOrder}
        <li> Order number :{$sOpenOrder['ordernumber']}</li>
        <li> User ID :{$sOpenOrder['userID']}</li>
        <li> Invoice_amount :{$sOpenOrder['invoice_amount']}</li>
        <li> ordertime : {$sOpenOrder['ordertime']}</li>
        <li> paymentID : {$sOpenOrder['paymentID']}</li>
        <hr>
        {/foreach}
    </ul> 
{*show here the total of the prices for the the products above something like $Total=[invoice_amount_1+invoice_amount_2]*}
{/block}

Any ideas on how to do that? Am a bit new to shopware and smarty

  • 写回答

3条回答 默认 最新

  • duankuang1046 2018-08-26 13:29
    关注

    I'm not familiar with this application either, but this should work:

        {extends file="parent:frontend/account/orders.tpl"}
    
        {block name="frontend_account_orders_welcome"}
            {$smarty.block.parent}
            {debug}
            {$sOrderTotal = 0}
            <ul>
                {foreach $sOpenOrders as $sOpenOrder}
                <li> Order number :{$sOpenOrder['ordernumber']}</li>
                <li> User ID :{$sOpenOrder['userID']}</li>
                <li> Invoice_amount :{$sOpenOrder['invoice_amount']}</li>
                {$sOrderTotal += $sOpenOrder['invoice_amount']}
                <li> ordertime : {$sOpenOrder['ordertime']}</li>
                <li> paymentID : {$sOpenOrder['paymentID']}</li>
                <hr>
                {/foreach}
            </ul> 
        <p>{$sOrderTotal}</p>
        {/block}
    

    I added three lines.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用