{extends file="admin-layout.tpl"} {block name="no-return-functions"} {$admin_current_location = 'order'} {/block} {block name="page-title"}{intl l='Edit an order'}{/block} {block name="check-resource"}admin.order{/block} {block name="check-access"}update{/block} {block name="main-content"} {assign order_tab {$tab|default:$smarty.get.tab|default:"cart"}}
{hook name="order-edit.top" order_id=$order_id} {$limit={$smarty.get.limit|default:25}} {$product_page={$smarty.get.page|default:1}}
{ifloop rel='the-order'} {loop type="order" name="the-order" id=$order_id customer="*" with_prev_next_info="true" backend_context="1"} {loop type="currency" name="order-currency" id=$CURRENCY} {$orderCurrency=$SYMBOL} {/loop}
{intl l='Order %ref - ID %id' id={$ID} ref={$REF}}

{intl l='Order placed on %order_date at %order_time' order_date={format_date date=$CREATE_DATE output='date'} order_time={format_date date=$CREATE_DATE output='time'}}

{if $HAS_PREVIOUS != 0} {else} {/if} {if $HAS_NEXT != 0} {else} {/if}
{hookblock name="order.tab" id={$order_id} fields="id,title,href,content"} {capture "order_tab_tab"} {forhook rel="order.tab"}
  • {$title nofilter}
  • {/forhook} {/capture} {capture "order_tab_content"} {forhook rel="order.tab"}
    {if $href} {* ajax *}
    {intl l="Please wait, loading"}
    {else} {$content nofilter} {/if}
    {/forhook} {/capture} {/hookblock}
    {hook name="order-edit.cart-top" location="order-edit-cart-top" order_id=$order_id}
    {if $smarty.get.update_status_error_message|default:null}
    {$smarty.get.update_status_error_message}
    {/if} {hook name="order-edit.before-order-product-list" location="before-order-product-list" order_id=$order_id} {hook name="order-edit.order-product-table-header" location="order_edit_table_header" } {$taxes = []} {loop type="order_product" page=$product_page limit=$limit name="order-products" order=$ID} {if ! isset($taxes[{$TAX_RULE_TITLE}])} {$taxes[{$TAX_RULE_TITLE}] = 0} {/if} {$taxes[{$TAX_RULE_TITLE}] = $taxes[{$TAX_RULE_TITLE}] + $REAL_PRICE_TAX * $QUANTITY} {hook name="order-edit.before-order-product-row" location="before-order-product-row" order_id=$order_id order_product_id=$ID} {hook name="order-edit.order-product-table-row" location="order_edit_table_row" order_product_id={$ID} } {hook name="order-edit.after-order-product-row" location="after-order-product-row" order_id=$order_id order_product_id=$ID} {/loop}
    {intl l='Cart - Prices in %currency' currency={$orderCurrency}}
    {intl l="Product"}{intl l="Unit. price"} {intl l="Tax"} {intl l="Unit taxed price"} {intl l="Quantity"} {intl l="Untaxed total"} {intl l="Tax total"} {intl l="Taxed total"}
    {ifloop rel="my_product_loop"} {loop type="product" name="my_product_loop" visible="*" ref=$REF return_url=false} {$REF} - {$TITLE} {if $VIRTUAL}{/if} {/loop}
    {intl l='Combination reference'}
    {$PRODUCT_SALE_ELEMENTS_REF}
    {/ifloop} {elseloop rel="my_product_loop"} {* The product doesn't exist anymore *} {$TITLE} {if $VIRTUAL}{/if} {/elseloop} {ifloop rel="combinations"}
    {loop type="order_product_attribute_combination" name="combinations" order_product=$ID}
    {$ATTRIBUTE_TITLE}
    {$ATTRIBUTE_AVAILABILITY_TITLE}
    {/loop}
    {/ifloop} {hook name="order-edit.product-list" location="order-product-list" order_id=$order_id order_product_id=$ID}
    {format_money number=$REAL_PRICE currency_id=$CURRENCY} {format_money number=$REAL_PRICE_TAX currency_id=$CURRENCY} {format_money number=$REAL_TAXED_PRICE currency_id=$CURRENCY} {$QUANTITY} {format_money number=$REAL_TOTAL_PRICE currency_id=$CURRENCY} {format_money number=$REAL_TOTAL_PRICE_TAX currency_id=$CURRENCY} {format_money number=$REAL_TOTAL_TAXED_PRICE currency_id=$CURRENCY}
    {include file = "includes/pagination.html" loop_ref = "order-products" max_page_count = 10 page_url = {url current="1"} }
    {intl l="Total without tax"} {format_money number=$TOTAL_ITEMS_AMOUNT currency_id=$CURRENCY}
    {intl l="Total with taxes before discount"} {format_money number=$TOTAL_TAXED_AMOUNT-$POSTAGE+$DISCOUNT currency_id=$CURRENCY}
    {intl l="Discount with taxes"} {if $DISCOUNT > 0}-{/if}{format_money number=$DISCOUNT currency_id=$CURRENCY}
    {intl l="Total with taxes after discount"} {format_money number=$TOTAL_TAXED_AMOUNT-$POSTAGE currency_id=$CURRENCY}
    {intl l="Shipping with taxes"} {format_money number=$POSTAGE currency_id=$CURRENCY}
    {intl l="ORDER TOTAL WITH TAXES"} {format_money number=$TOTAL_TAXED_AMOUNT currency_id=$CURRENCY}

    {intl l='Taxes'}

    {$tmp = 0} {foreach $taxes as $name => $amount} {if $amount != 0} {$tmp = $tmp + $amount} {/if} {/foreach} {if $tmp == 0} {/if} {if $POSTAGE_TAX != 0} {else} {/if} {if $DISCOUNT_TAX != 0} {else} {/if}
    {intl l='Items taxes'}
    {$name} {format_money number=$amount currency_id=$CURRENCY}
    {intl l="None"}
    {intl l='Shipping taxes'}
    {$POSTAGE_TAX_RULE_TITLE} {format_money number=$POSTAGE_TAX currency_id=$CURRENCY} {intl l="None"}
    {intl l='Discount tax'}
    {intl l='Average rate'} -{format_money number=$DISCOUNT_TAX currency_id=$CURRENCY} {intl l="None"}
    {intl l="Taxes total"} {format_money number=$TOTAL_TAX currency_id=$CURRENCY}
    {intl l="Coupon code"} {loop type="order_coupon" name="couponcode" order=$ID} {$CODE}{if $LOOP_COUNT != $LOOP_TOTAL}, {/if} {/loop} {elseloop rel="couponcode"} {intl l='No coupon for this order'} {/elseloop}
    {intl l="Weight"} {format_number number=$WEIGHT} {intl l="Kg"}
    {hook name="order-edit.after-order-product-list" location="after-order-product-list" order_id=$order_id} {loop type="order_address" name="order-invoice-address" id=$INVOICE_ADDRESS} {assign "orderInvoiceFirstName" $FIRSTNAME} {assign "orderInvoiceLastName" $LASTNAME} {assign "orderInvoiceCompany" $COMPANY} {/loop}

    {intl l='Customer information'}

    {if $orderInvoiceCompany} {/if}
    {intl l="Customer"} {$orderInvoiceFirstName|ucwords} {$orderInvoiceLastName|upper}
    {intl l="Email"} {loop type="customer" name="customer" id=$CUSTOMER backend_context="on" current="false"}{$EMAIL}{/loop}
    {intl l="Company"} {$orderInvoiceCompany}
    {hook name="order-edit.customer-information-bottom" order_id=$order_id customer_id=$CUSTOMER}

    {intl l='Payment information'}

    {intl l="Payment module"} {loop name="payment-module" type="module" id=$PAYMENT_MODULE order="code"}{$CODE} - {$TITLE}{/loop}
    {intl l="Transaction reference"} {if $TRANSACTION_REF} {$TRANSACTION_REF} {else} {intl l='No transaction for this order'} {/if}
    {hook name="order-edit.payment-module-bottom" order_id=$order_id module_id=$PAYMENT_MODULE}
    {hook name="order-edit.cart-bottom" location="order-edit-cart-bottom" order_id=$order_id}
    {hook name="order-edit.bill-top" location="order-edit-bill-top" order_id=$order_id}
    {intl l='Delivery information'}

    {intl l='Delivery module'}

    {loop name="delivery-module" type="module" id=$DELIVERY_MODULE order="code"}

    {$CODE} - {$TITLE}

    {if $DESCRIPTION}
    {$DESCRIPTION nofilter}
    {/if} {/loop}
    {hook name="order-edit.delivery-module-bottom" order_id=$order_id module_id=$DELIVERY_MODULE}

    {intl l='tracking reference'}

    {if $smarty.get.update_status_error_message|default:null}
    {$smarty.get.update_status_error_message}
    {/if}

    {intl l='Invoice informations'}

    {include file='renderer/buttons.html' with_text=false buttons=[ [ 'type' => 'view', 'title' => {intl l='View invoice PDF'}, 'href' => {url path="/admin/order/pdf/invoice/%id/%browser" browser=1 id=$ID}, 'attr' => ['target' => '_blank'] ], [ 'type' => 'download', 'title' => {intl l='Download invoice as PDF'}, 'href' => {url path="/admin/order/pdf/invoice/%id/%browser" browser=0 id=$ID} ], [ 'type' => 'print', 'class' => 'js-action-print', 'title' => {intl l='Print invoice'}, 'href' => {url path="/admin/order/pdf/invoice/%id/%browser" browser=1 id=$ID}, 'data' => [ 'type' => "invoice" ] ] ]}
    {include file='renderer/buttons.html' with_text=false buttons=[ [ 'type' => 'edit', 'class' => 'js-update-order-address', 'title' => {intl l='Edit invoice address'}, 'href' => "#edit_order_address_dialog", 'data' => [ 'address-id' => $INVOICE_ADDRESS, 'toggle' => 'modal' ] ] ]}
    {loop type="order_address" name="order-invoice-address" id=$INVOICE_ADDRESS} {/loop}
    {intl l="Invoice reference"} {if $INVOICE_REF} {$INVOICE_REF} {else} {intl l="None"} {/if}
    {intl l="Invoice date"} {format_date date=$INVOICE_DATE output="date"}
    {intl l="Company"} {$COMPANY}
    {intl l="Title"} {loop type="title" name="order-invoice-address-title" id=$TITLE}{$LONG}{/loop}
    {intl l="Firstname"} {$FIRSTNAME}
    {intl l="Lastname"} {$LASTNAME}
    {intl l="Street address"} {$ADDRESS1}
    {intl l="Additional address"} {$ADDRESS2}
    {intl l="Additional address"} {$ADDRESS3}
    {intl l="Zip code"} {$ZIPCODE}
    {intl l="City"} {$CITY}
    {intl l="Country"} {loop type="country" name="order-invoice-address-country" id=$COUNTRY visible="*"}{$TITLE}{/loop}
    {intl l="State"} {if $STATE} {loop type="state" name="order-invoice-address-state" id=$STATE visible="*"}{$TITLE}{/loop} {else} - {/if}
    {intl l="Phone"} {$PHONE}
    {intl l="Cellphone"} {$CELLPHONE}
    {intl l="Email"} {loop type="customer" name="customer" id=$CUSTOMER backend_context="on" current="false"}{$EMAIL}{/loop}

    {intl l='Delivery address'}

    {include file='renderer/buttons.html' with_text=false buttons=[ [ 'type' => 'view', 'title' => {intl l='View purchase order as PDF'}, 'href' => {url path="/admin/order/pdf/delivery/%id/%browser" browser=1 id=$ID}, 'attr' => ['target' => '_blank'] ], [ 'type' => 'download', 'title' => {intl l='Download purchase order as PDF'}, 'href' => {url path="/admin/order/pdf/delivery/%id/%browser" browser=0 id=$ID} ], [ 'type' => 'print', 'class' => 'js-action-print', 'title' => {intl l='Print purchase order'}, 'href' => {url path="/admin/order/pdf/delivery/%id/%browser" browser=1 id=$ID}, 'data' => [ 'type' => "purchase" ] ] ]}
    {include file='renderer/buttons.html' with_text=false buttons=[ [ 'type' => 'edit', 'class' => 'js-update-order-address', 'title' => {intl l='Edit delivery address'}, 'href' => "#edit_order_address_dialog", 'data' => [ 'address-id' => $DELIVERY_ADDRESS, 'toggle' => 'modal' ] ] ]}
    {ifhook rel="order-edit.bill-delivery-address"} {* delivery module can customize the delivery address *} {hook name="order-edit.bill-delivery-address" module="$DELIVERY_MODULE" order_id={$order_id}} {/ifhook} {elsehook rel="order-edit.bill-delivery-address"} {loop type="order_address" name="order-delivery-address" id=$DELIVERY_ADDRESS} {/loop} {/elsehook}
     
     
    {intl l="Company"} {$COMPANY}
    {intl l="Title"} {loop type="title" name="order-delivery-address-title" id=$TITLE}{$LONG}{/loop}
    {intl l="Firstname"} {$FIRSTNAME}
    {intl l="Lastname"} {$LASTNAME}
    {intl l="Street address"} {$ADDRESS1}
    {intl l="Additional address"} {$ADDRESS2}
    {intl l="Additional address"} {$ADDRESS3}
    {intl l="Zip code"} {$ZIPCODE}
    {intl l="City"} {$CITY}
    {intl l="Country"} {loop type="country" name="order-delivery-address-country" id=$COUNTRY visible="*"}{$TITLE}{/loop}
    {intl l="State"} {if $STATE} {loop type="state" name="order-delivery-address-state" id=$STATE visible="*"}{$TITLE}{/loop} {else} - {/if}
    {intl l="Phone"} {$PHONE}
    {intl l="Cellphone"} {$CELLPHONE}
    {hook name="order-edit.bill-bottom" location="order-edit-bill-bottom" order_id=$order_id}
    {$smarty.capture.order_tab_content nofilter}
    {* ugly fix : {hook name="order.tab-content"} *} {include file="includes/module-tab-content.html" hook="order.tab-content" location="order-edit" id=$order_id view="order-edit"}
    {/loop} {/ifloop} {elseloop rel="the-order"} DOES NOT EXISTS {/elseloop}
    {hook name="order-edit.bottom" order_id=$order_id}
    {* Update an Address *} {form name="thelia.order.update.address"} {* Capture the dialog body, to pass it to the generic dialog *} {capture "edit_order_address_dialog"} {form_hidden_fields} {form_field field='id'} {/form_field} {render_form_field field='company' extra_class="js-company"} {custom_render_form_field field='title'} {/custom_render_form_field}
    {render_form_field field="firstname" extra_class="js-firstname"}
    {render_form_field field='lastname' extra_class="js-lastname"}
    {render_form_field field='address1' extra_class="js-address1"} {render_form_field field='address2' extra_class="js-address2" show_label=false} {render_form_field field='address3' extra_class="js-address3" show_label=false}
    {render_form_field field='zipcode' extra_class="js-zipcode"}
    {render_form_field field='city' extra_class="js-city"}
    {custom_render_form_field field='country'} {$countryFieldId=$label_attr.for|default:null} {/custom_render_form_field}
    {custom_render_form_field field='state'} {/custom_render_form_field}
    {render_form_field field='phone' extra_class="js-phone"}
    {render_form_field field='cellphone' extra_class="js-cellphone"}
    {/capture} {include file = "includes/generic-create-dialog.html" dialog_id = "edit_order_address_dialog" dialog_title = {intl l="Edit order address"} dialog_body = {$smarty.capture.edit_order_address_dialog nofilter} dialog_ok_label = {intl l="Confirm changes"} dialog_cancel_label = {intl l="Cancel"} form_action = {url path="/admin/order/update/%id/address" id=$order_id} form_enctype = {form_enctype} form_error_message = $form_error_message form_id = 'updateOrderAddressForm' } {/form} {/block} {block name="javascript-initialization"} {javascripts file='assets/js/bootstrap-select/bootstrap-select.js'} {/javascripts} {javascripts file='assets/js/thelia-states.js'} {/javascripts} {/block} {block name="javascript-last-call"} {hook name="order.edit-js" location="order-edit-js" order_id={$order_id} } {/block}