Jump to content

order-confirmation.tpl - smarty variable with underscore not works


Recommended Posts

Hi , I need to add order total to my template but I can't figure out why it is not work.

Template theme/xxx/templates/checkout/order-confirmation.tpl 

I print_r whole $order.details and see all variables what I want.  So I try print required variables to page:

{$order.details.payment} <- this works
{$order.details.id_customer} <- this do NOT works
{$order.details.total_paid_tax_incl} <- this do NOT works also
                                        
                                       

All variables with no underscore character work good, all variables with underscore not works :(  I need just add variable (total_paid_tax_incl) to theme page. Any advice ? thanks a lot guys

Link to comment
Share on other sites

58 minutes ago, tdsoft said:

Are you sure Order.details have total_paid_tax_incl variable ?

You can use statement to view all variables from $order.details


{$order.details|var_dump}

 

Hi,  there is output of {$order.details|@print_r}

 

Quote


  PrestaShop\PrestaShop\Adapter\Presenter\Order\OrderDetailLazyArray Object
(
    [order:PrestaShop\PrestaShop\Adapter\Presenter\Order\OrderDetailLazyArray:private] =&gt; Order Object
        (
            [id_address_delivery] =&gt; 21013
            [id_address_invoice] =&gt; 21013
            [id_shop_group] =&gt; 1
            [id_shop] =&gt; 1
            [id_cart] =&gt; 1189
            [id_currency] =&gt; 1
            [id_lang] =&gt; 1
            [id_customer] =&gt; 8673
            [id_carrier] =&gt; 43
            [current_state] =&gt; 10
            [secure_key] =&gt; a69d00482b1df2d13bd9a424c3a71f08
            [payment] =&gt; Platba bankovním převodem
            [module] =&gt; ps_wirepayment
            [conversion_rate] =&gt; 1.000000
            [recyclable] =&gt; 0
            [gift] =&gt; 0
            [gift_message] =&gt; 
            [mobile_theme] =&gt; 0
            [shipping_number] =&gt; 
            [total_discounts] =&gt; 0.000000
            [total_discounts_tax_incl] =&gt; 0.000000
            [total_discounts_tax_excl] =&gt; 0.000000
            [total_paid] =&gt; 312.000000
            [total_paid_tax_incl] =&gt; 312.000000
            [total_paid_tax_excl] =&gt; 274.000000
            [total_paid_real] =&gt; 0.000000
            [total_products] =&gt; 179.000000
            [total_products_wt] =&gt; 217.000000
            [total_shipping] =&gt; 95.000000
            [total_shipping_tax_incl] =&gt; 95.000000
            [total_shipping_tax_excl] =&gt; 95.000000
            [carrier_tax_rate] =&gt; 0.000
            [total_wrapping] =&gt; 0.000000
            [total_wrapping_tax_incl] =&gt; 0.000000
            [total_wrapping_tax_excl] =&gt; 0.000000
            [invoice_number] =&gt; 0
            [delivery_number] =&gt; 0
            [invoice_date] =&gt; 0000-00-00 00:00:00
            [delivery_date] =&gt; 0000-00-00 00:00:00
            [valid] =&gt; 0
            [date_add] =&gt; 2019-04-25 08:00:32
            [date_upd] =&gt; 2019-04-25 08:00:33
            [reference] =&gt; 427-2019
            [round_mode] =&gt; 2
            [round_type] =&gt; 3
            [webserviceParameters:protected] =&gt; Array
                (
                    [objectMethods] =&gt; Array
                        (
                            [add] =&gt; addWs
                        )

                    [objectNodeName] =&gt; order
                    [objectsNodeName] =&gt; orders
                    [fields] =&gt; Array
                        (
                            [id_address_delivery] =&gt; Array
                                (
                                    [xlink_resource] =&gt; addresses
                                )

                            [id_address_invoice] =&gt; Array
                                (
                                    [xlink_resource] =&gt; addresses
                                )

                            [id_cart] =&gt; Array
                                (
                                    [xlink_resource] =&gt; carts
                                )

                            [id_currency] =&gt; Array
                                (
                                    [xlink_resource] =&gt; currencies
                                )

                            [id_lang] =&gt; Array
                                (
                                    [xlink_resource] =&gt; languages
                                )

                            [id_customer] =&gt; Array
                                (
                                    [xlink_resource] =&gt; customers
                                )

                            [id_carrier] =&gt; Array
                                (
                                    [xlink_resource] =&gt; carriers
                                )

                            [current_state] =&gt; Array
                                (
                                    [xlink_resource] =&gt; order_states
                                    [setter] =&gt; setWsCurrentState
                                )

                            [module] =&gt; Array
                                (
                                    [required] =&gt; 1
                                )

                            [invoice_number] =&gt; Array
                                (
                                )

                            [invoice_date] =&gt; Array
                                (
                                )

                            [delivery_number] =&gt; Array
                                (
                                )

                            [delivery_date] =&gt; Array
                                (
                                )

                            [valid] =&gt; Array
                                (
                                )

                            [date_add] =&gt; Array
                                (
                                )

                            [date_upd] =&gt; Array
                                (
                                )

                            [shipping_number] =&gt; Array
                                (
                                    [getter] =&gt; getWsShippingNumber
                                    [setter] =&gt; setWsShippingNumber
                                )

                        )

                    [associations] =&gt; Array
                        (
                            [order_rows] =&gt; Array
                                (
                                    [resource] =&gt; order_row
                                    [setter] =&gt; 
                                    [virtual_entity] =&gt; 1
                                    [fields] =&gt; Array
                                    

 

Link to comment
Share on other sites

  • 11 months later...
  • 1 month later...

Hi!

I have this same problem, not only in order confirmation, but in order detail table and detail by order.

I could not find how to get the right variable to call the total with tax included, so I made a sum : 

 

I add this line

{$line3 = $line.amount + $line3}

and show in {$line3|string_format:"%.2f"} {l s=' $'} replacing $order.totals.total.label

<tfoot>	
      {foreach $order.subtotals as $line}	  
        {if $line.value}
		{$line3 = $line.amount + $line3}
          <tr class="text-right line-{$line.type}">
            <td colspan="3">{$line.label}</td>
            <td class="price">{$line.value}</td>
          </tr>
        {/if}
      {/foreach} 	  
	  
      <tr class="text-right line-{$order.totals.total.type}">
        <td colspan="3">{$order.totals.total.label}</td>
        <td class="price">{$line3|string_format:"%.2f"} {l s=' $'}</td>
      </tr>
  
</tfoot>

 

I would prefer the variable, but at the moment I could fix with this

Link to comment
Share on other sites

Hi! Me again.

I just find this post

https://www.prestashop.com/forums/topic/1012224-how-to-show-the-total-with-tax-in-the-order-history-any-variables/

In this post he change 

<tr class="text-right line-{$order.totals.total.type}">
        <td colspan="3">{$order.totals.total.label}</td>
          <td>{$order.totals.total.value}</td>
      </tr>

 

for

<tr class="text-right line-{$order.totals.total.type}">
        <td colspan="3">{$cart.totals.total_including_tax.label}</td>
        <td class="price">{$order.totals.total_paid.value}</td>
      </tr>

 

Is more easy this one to modify

Link to comment
Share on other sites

  • 2 months later...
On 8/6/2020 at 0:33, thymus said:

Las variables correctas requeridas son ...

{$ order.totals.total_including_tax.label}

{$ order.totals.total_including_tax.value}

Hola! Me funciono!!, una pregunta, solo de información, sabes como se crean esas variables? cual es la logica y porque funciona.

Link to comment
Share on other sites

  • 6 months later...

Hi, 

I'm using PS 1.7.5

I want to show id_order and one custom field to order history page.

Template themes/xxx/templates/customer/history.tpl

both the values are in ps_orders table, can someone please tell me how to get those values and show on the order-history page?

I tried the following - $order.details.id_order but not working.

Thanks in advance

Edited by Shweta Bhatia (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...