SRZps Posted January 14, 2018 Share Posted January 14, 2018 (edited) Hi, I need help to make changes to the Customer view in Backoffice (Prestashop 1.5.4.1).. For older customers with dozens of orders and carts, it has become extremely slow and sometimes just fails to open the customer view. The problem seems to be that Prestashop is trying to get and show me ALL the orders and carts the customer ever made, this causes extreme slow response. I don't need to see all that information, so I want to limit the quantity of orders/carts to show only 10 in this view. This is probably done in this file: /home/xxxxx/public_html/xxxxx/themes/default/template/controllers/customers/helpers/view/view.tpl Probably this part of the code (concerning orders shown in Customer view): <div style="width:50%;float:left;"> <h2>{l s='Orders'} ({count($orders)})</h2> {if $orders AND count($orders)} {assign var=count_ok value=count($orders_ok)} {if $count_ok} <div> <h3 style="color:green;font-weight:700;clear:both;"> {l s='Valid orders:'} {$count_ok} {l s='for'} {$total_ok} </h3> <table cellspacing="0" cellpadding="0" class="table" style="width:100%; text-align:left;"> <colgroup> <col width="10px"> <col width="100px"> <col width="100px"> <col width=""> <col width="50px"> <col width="80px"> <col width="70px"> </colgroup> <tr> <th height="39px" class="center">{l s='ID'}</th> <th class="left">{l s='Date'}</th> <th class="left">{l s='Payment: '}</th> <th class="left">{l s='State'}</th> <th class="right">{l s='Products'}</th> <th class="right">{l s='Total spent'}</th> <th class="center">{l s='Actions'}</th> </tr> {foreach $orders_ok AS $key => $order} <tr {if $key %2}class="alt_row"{/if} style="cursor: pointer" onclick="document.location = '?tab=AdminOrders&id_order={$order['id_order']}&vieworder&token={getAdminToken tab='AdminOrders'}'"> <td class="left">{$order['id_order']}</td> <td class="left">{$order['date_add']}</td> <td class="left">{$order['payment']}</td> <td class="left">{$order['order_state']}</td> <td align="right">{$order['nb_products']}</td> <td align="right">{$order['total_paid_real']}</td> <td align="center"><a href="?tab=AdminOrders&id_order={$order['id_order']}&vieworder&token={getAdminToken tab='AdminOrders'}"><img src="../img/admin/details.gif" /></a></td> </tr> {/foreach} </table> </div> {/if} {assign var=count_ko value=count($orders_ko)} {if $count_ko} <div> <table cellspacing="0" cellpadding="0" class="table" style="width:100%;"> <colgroup> <col width="10px"> <col width="100px"> <col width=""> <col width=""> <col width="100px"> <col width="100px"> <col width="52px"> </colgroup> <tr> <th height="39px" class="left">{l s='ID'}</th> <th class="left">{l s='Date'}</th> <th class="left">{l s='Payment: '}</th> <th class="left">{l s='State'}</th> <th class="right">{l s='Products'}</th> <th class="right">{l s='Total spent'}</th> <th class="center">{l s='Actions'}</th> </tr> {foreach $orders_ko AS $key => $order} <tr {if $key %2}class="alt_row"{/if} style="cursor: pointer" onclick="document.location = '?tab=AdminOrders&id_order={$order['id_order']}&vieworder&token={getAdminToken tab='AdminOrders'}'"> <td class="left">{$order['id_order']}</td> <td class="left">{$order['date_add']}</td> <td class="left">{$order['payment']}</td> <td class="left">{$order['order_state']}</td> <td align="right">{$order['nb_products']}</td> <td align="right">{$order['total_paid_real']}</td> <td align="center"><a href="?tab=AdminOrders&id_order={$order['id_order']}&vieworder&token={getAdminToken tab='AdminOrders'}"><img src="../img/admin/details.gif" /></a></td> </tr> {/foreach} </table> <h3 style="color:red;font-weight:normal;">{l s='Invalid orders:'} {$count_ko}</h3> </div> {/if} {else} {l s='%1$s %2$s has not placed any orders yet' sprintf=[$customer->firstname, $customer->lastname]} {/if} </div> What do I need to change to make it show only the last 10 orders, and not ALL orders? Thanks! SRZ Edited January 14, 2018 by SRZps (see edit history) Link to comment Share on other sites More sharing options...
musicmaster Posted January 15, 2018 Share Posted January 15, 2018 If you switch on _PS_DEBUG_PROFILING_ in config/defines.inc.php you will see at the bottom of your page all the sql queries that are done and how much time they take. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now