currency translation

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
khizar
Posts: 99
Joined: 19 Jan 2021, 09:51

currency translation

Post by khizar » 17 Feb 2021, 11:31

Hey aimeos,
i have integrated aimeos in laravel 8.i have made a print of order using blade template
Image

here is the code

Code: Select all

	<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=viewport-width initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie-edge">
       
    <!--  compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">

    <!-- jQuery library -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

    <!-- Popper JS -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>

    <!--  compiled JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> 
   
    
   
    <style>
      

        label {
            text-align: left !important;
        }



        .printtable:not(:first-child),
        .printtable thead tr:not(:first-child) th,
        .printtable tbody td {
            border-top: 1px solid black !important;
            border-bottom: 1px solid black !important;
            

        }

        .printtable thead tr:not(:first-child),
        .printtable tbody tr
        {
            border-right: 1px solid black !important;
            border-left: 1px solid black !important;
            

        }

        .printtable {
            border-collapse: collapse !important;

        }


        td {
            /* height: 15px !important; */

            padding: 3px 4px !important;
        }

        .custombtn {


            padding: 2px !important;
            position: relative !important;


        }

        #printbtn {

            font-size: 20px !important;
        }

        .borderb {
            border-bottom: 1px solid black;
        }

        .addres-span {
            white-space: pre-line !important;
        }
        *{
            box-sizing: border-box !important;
            font-family: Arial, Helvetica, sans-serif;
        }

        body{
            width:4in;
            color:black !important;
            /* height: 29.7cm;
            margin: 0mm 10mm 10mm 8mm; */
        }

        .currspan {
            content: "\FDFC";
        }

        @page{
            width:4in;
            color:black !important;
            /* height: 29.7cm;
            margin: 0mm 10mm 10mm 8mm; */
        }

        @media print {
            #printbtn {
                display: none;
            }

            body{
            width:4in;
            color:black !important;
            
            /* height: 29.7cm;
            margin: 0mm 10mm 10mm 8mm; */
            }
        }
    </style>

</head>



<body >
    @php 
        $currencies = array('SAR'=> "&#65020;");
       
    @endphp
   
    
    <div class="clearfix">&nbsp;</div>
    <div class="clearfix">&nbsp;</div>
    <div >
        <div style="width: 384px;">
            <div class="d-flex flex-row justify-content-center">
                <button class="btn btn-primary btn-block custombtn" id="printbtn" onclick="printReport(this);"><i class="fas fa-print" style="margin-right:5px;"></i>Print</button>
                                            
            </div>
            <div class="d-flex flex-row justify-content-center" dir="rtl">
                <div class="">
                    <table class="printtable" style="width: 375px;">
                        <thead>
                            <tr>
                                <td colspan="5">
                                    <div class="d-flex flex-row justify-content-start align-items-center mb-1">
                                        
                                        <div style="width: 100px;">
                                            <img src="{{asset('images/02.png')}}" alt="not found" style="width: 80px;">
                                        </div>
                                    
                                        <div class="d-flex flex-column" style="width:275px;">
                                            <span class="text-center" style="font-size: 24px; line-height: 25px;"><b>{{$sale->label}}</b></span>
                                        </div>
                                            

                                    </div>
                                    <div>
                                        <div class="d-flex flex-row justify-content-start">
                                            <span class="addres-span" style="font-size: 16px; ">{{$saleaddr->firstname}} {{$saleaddr->lastname}}
                                            {{$saleaddr->address1}}
                                            {{$saleaddr->address2}}
                                            {{$saleaddr->city}}
                                            {{$saleaddr->telephone}}
                                             </span>
                                        </div>


                                    </div>
                                    <div>
                                        <div class="d-flex flex-row justify-content-center">
                                            <span class="text-center" style="font-size: 20px; font-weight: bold;">صوتيه</span>

                                        </div>


                                    </div>
                                    <div>
                                        <div class="d-flex flex-row justify-content-start">
                                            <span style="font-size: 16px; "> تاريخ :{{date('d-m-Y',strtotime($sale->ctime))}}</span>

                                        </div>


                                    </div>
                                    <div>
                                        <div class="d-flex flex-row justify-content-start">
                                            <span style="font-size: 16px; ">طلب لا: {{$sale->id}}</span>

                                        </div>


                                    </div>
                                    <div>
                                        <div class="d-flex flex-row justify-content-start">
                                            <span style="font-size: 16px; ">العميل: {{$sale->name}}
                                                

                                        </div>


                                    </div>
                                    {{--<div>
                                        <div class="d-flex flex-row justify-content-start">
                                            <span style="font-size: 16px; ">CNIC No: </span>

                                        </div>


                                    </div>--}}

                                </td>

                            </tr>
                            <tr style="font-size: 13px;">
                                <th style="width:20px; text-align:center; border-right:0.5px solid grey;">S#</th>
                                <th style="width:100px; text-align:right; border-right:0.5px solid grey;">هو رمز حفظ في مخزن او كود لجميع منتجات</th>
                                <th style="width:40px; text-align:center; border-right:0.5px solid grey;">كمية</th>
                                <th style="width:60px; text-align:center; border-right:0.5px solid grey;">سعر الوحده</th>
                                <th style="width:60px; text-align:center; border-right:0.5px solid grey;">المجموع الفرعي</th>
                               
                                



                            </tr>

                        </thead>
                        <tbody>
                        @php $sno = 1; @endphp
                        @forelse($saleProducts as $sp)


                        




                        <tr style="font-size: 13px;">
                            <td style="text-align:center; width:20px; border-right:0.5px solid grey;">{{$sno}}</td>
                            <td style="text-align:right; width:100px; border-right:0.5px solid grey;">{{$sp->name}}</td>
                            <td style="text-align:center; width:40px; border-right:0.5px solid grey;">{{$sp->quantity}}</td>
                            <td style="text-align:right; width:60px; border-right:0.5px solid grey;">{{$sp->price}} <span class="currspan">{{html_entity_decode($currencies[$sale->currencyid])}}</span></td>
                            <td style="text-align:right; width:60px; border-right:0.5px solid grey;">{{number_format($sp->quantity * $sp->price)}} <span class="currspan">{{html_entity_decode($currencies[$sale->currencyid])}}</span></td>
                           

                            
                            

                        </tr>
                        @php $sno++; @endphp
                        @empty

                        <tr>
                            <td colspan="5" class="text-center"><b>RECORDS NOT FOUND</b></td>
                        </tr>
                        @endforelse


                    </tbody>
                    @php $costs = 0; @endphp
                    <tfoot>
                        <tr>
                           
                            <td colspan="3"> <b>مجموع</b></td>
                            <td colspan="2" style="text-align:left;">{{number_format($sale->price)}} <span class="currspan">{{html_entity_decode($currencies[$sale->currencyid])}}</span></td>
                           
                        </tr>
                        @foreach($services as $serv)
                        <tr>
                            <td colspan="3"> <b>{{$serv->name}}</b></td>
                            <td colspan="2" style="text-align:left;">{{number_format($serv->costs)}} <span class="currspan">{{html_entity_decode($currencies[$sale->currencyid])}}</span></td>
                            @php $costs += $serv->costs; @endphp

                        </tr>
                        @endforeach
                        <tr>
                            <td colspan="3"> <b>خصم</b></td>
                            <td colspan="2" style="text-align:left;">{{number_format($sale->rebate)}} <span class="currspan">{{html_entity_decode($currencies[$sale->currencyid])}}</span></td>
                           

                        </tr>
                        <tr>
                            <td colspan="3"> <b>ضريبة الطلب</b></td>
                            <td colspan="2" style="text-align:left;">{{number_format($sale->tax)}} <span class="currspan">{{html_entity_decode($currencies[$sale->currencyid])}}</span></td>
                            

                        </tr>
                        <tr>
                            <td colspan="3"> <b>إجمالي المدفوعات</b></td>
                            <td colspan="2" style="text-align:left;">{{number_format($sale->price + $costs - $sale->rebate + $sale->tax)}} <span class="currspan">{{html_entity_decode($currencies[$sale->currencyid])}}</span></td>
                            

                        </tr>

                    </tfoot>







                    </table>
                </div>
            </div>

            <!-- <div class="d-flex flex-row justify-content-center">
                <span class="addres-span text-center" style="font-size: 16px; ">NOTE
                    No Return/Exchange of Fancy Item's, Only some items's Exchange Possible within 7 day's along with original  Invoice and Packing.
                    To Claim warranty,Please Show Original Stamp Invoice.
                </span>
            </div> -->
        </div>
    </div>

        <script>
        function printReport(obj) {
            window.print();

        }
    </script>

</body>

</html>
now all is working fine but now i want to translate the amounts into arabic .the problem is i have made that print file
under my resources/views directory as a blade file so i am unable to access ( $this->number(100) ) function
Note: the function ($this->number(100)) is used in aimeos templates to translate the number
so please guide me how can i use that function in my blade template

i used also

Code: Select all

	$context = app('aimeos.context')->get();
but i dont know what to do next to access that function

User avatar
aimeos
Administrator
Posts: 7881
Joined: 01 Jan 1970, 00:00

Re: currency translation

Post by aimeos » 18 Feb 2021, 07:39

You can try to use:

Code: Select all

app('aimeos.context')->get()->getView()->number(100);
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply