Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Please Help! TPL to TWIG convert a part of code.


Recommended Posts

I need to help. I have a opencart 2x module. I converted as online tpl to twig but its bad converted. My part of code is above. Who can help me?

 

<div class="table-responsive">
          <table class="table table-bordered table-hover">
            <thead>
              <tr>
                <td class="text-left"><?php echo $column_country; ?></td>
                <td class="text-right"><?php echo $column_orders; ?></td>
                <td class="text-right"><?php echo $column_total; ?></td>
              </tr>
            </thead>
            <tbody>
              <?php if ($customers) { ?>
              <?php if ($filter_country_id != "") { ?>
              <?php
                $back_url = "index.php?route=report/customer_country&token=".$token;
                if ($filter_date_start != "")
                    $back_url .= "&filter_date_start=".$filter_date_start;
                if ($filter_date_end != "")
                    $back_url .= "&filter_date_end=".$filter_date_end;
                if ($filter_order_status_id != "")
                    $back_url .= "&filter_order_status_id=".$filter_order_status_id;    
                    
                ?>
                
                    <tr>
                        <td class="text-left" colspan="3">
                            <a class="btn btn-info" href="<?php echo $back_url; ?>">
                                <i class="fa fa-arrow-left"></i> 
                                BACK
                            </a>
                        </td>
                    </tr>
                    <tr>
                        <td style="background-color:#f5f5f5; padding-top:15px; padding-left:15px;" class="text-left" colspan="3">
                            <h3><i class="fa fa-flag"> <?php echo $customers[0]['name']; ?> </i> </h3>
                        </td>
                        <?php }  ?>
                        
                        <?php foreach ($customers as $customer) { ?>
                        <tr>
                            <?php if ($filter_country_id != "") { ?>
                                <td class="text-left"><?php echo $customer['zone']; ?></td>
                            <?php } else { ?>
                                <?php
                                $country_url = "index.php?route=report/customer_country&token=".$token."&filter_country_id=".$customer['country_id'];
                                if ($filter_date_start != "")
                                    $country_url .= "&filter_date_start=".$filter_date_start;
                                if ($filter_date_end != "")
                                    $country_url .= "&filter_date_end=".$filter_date_end;
                                if ($filter_order_status_id != "")
                                    $country_url .= "&filter_order_status_id=".$filter_order_status_id;    
                                ?>
                                <td class="text-left">
                                    <a href="<?php echo $country_url; ?>"><?php echo $customer['name']; ?></a>
                                </td>
                                </td>
                        <?php } ?>
                                <td class="text-right"><?php echo $customer['count']; ?></td>
                                <td class="text-right"><?php echo $customer['total']; ?></td>
                        </tr>
              <?php } ?>
              
              <?php } else { ?>
              <tr>
                <td class="text-center" colspan="8"><?php echo $text_no_results; ?></td>
              </tr>
              <?php } ?>
            </tbody>
          </table>
        </div> 

Link to comment
Share on other sites


Hi! Twig temlate reguire self style oprganization. <?php if ($customers) { ?> from twig {% if customers %} and require ended tag {% endif %}. For printing values used (( value ))

Link to comment
Share on other sites

Hi, esculapra,

 

Just want to convert this part to twig

 

 if ($filter_date_start != "")
                    $back_url .= "&filter_date_start=".$filter_date_start;
                if ($filter_date_end != "")
                    $back_url .= "&filter_date_end=".$filter_date_end;
                if ($filter_order_status_id != "")
                    $back_url .= "&filter_order_status_id=".$filter_order_status_id;    
                    
                ?>

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
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.