Jump to content

Total amount in Orders Back office


mdusamaansari

Recommended Posts

Hi 

 

I need total amount of orders in bottom of the orders page in back office. I attached a screen shot for example. Its a feature of old version 1.2.4.0. I need it to be developed on version 1.5.6.0.

 

Kindly help me having this feature enables on my prestashop store.

 

 

Thanks in advance,

 

mdusamaansari

 

post-737659-0-41735400-1388123831_thumb.jpg

 

  • Like 1
Link to comment
Share on other sites

Hi 

 

I need total amount of orders in bottom of the orders page in back office. I attached a screen shot for example. Its a feature of old version 1.2.4.0. I need it to be developed on version 1.5.6.0.

 

Kindly help me having this feature enables on my prestashop store.

 

 

Thanks in advance,

 

mdusamaansari

 

attachicon.giforders.jpg

Hello Usmaan,

 

Attaching 2 file here replace these files..

Here are path for that..

/classes/controller --> AdminController.php
/classes/order --> Order.php
 
open list_footer.tpl file from path /YOUR_ADMIN/themes/default/template/helpers/list
and replace all code with code pasted below
{*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}

			</table>
			{if $bulk_actions}
				<p>
					{foreach $bulk_actions as $key => $params}
						<input type="submit" class="button" name="submitBulk{$key}{$table}" value="{$params.text}" {if isset($params.confirm)}onclick="return confirm('{$params.confirm}');"{/if} />
					{/foreach}
				</p>
			{/if}
		</td>
	</tr>
</table>
{if !$simple_header}
	<input type="hidden" name="token" value="{$token}" />
	</form>
{/if}
{hook h='displayAdminListAfter'}
{if isset($name_controller)}
	{capture name=hookName assign=hookName}display{$name_controller|ucfirst}ListAfter{/capture}
	{hook h=$hookName}
{elseif isset($smarty.get.controller)}
	{capture name=hookName assign=hookName}display{$smarty.get.controller|ucfirst|htmlentities}ListAfter{/capture}
	{hook h=$hookName}
{/if}


{block name="after"}{/block}
{if $smarty.get.controller|ucfirst|htmlentities == 'AdminOrders'}
	<div style="float: right;padding: 10px 10px 0px;background: #CBCCBC;">
		<h1>{l s='Total: '} {convertPrice price=$order_total}</h1>
	</div>
{/if}

Follow all this steps and Enjoy!!

AdminController.php

Order.php

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

 

Hello Usmaan,

 

Attaching 2 file here replace these files..

Here are path for that..

/classes/controller --> AdminController.php
/classes/order --> Order.php
 
open list_footer.tpl file from path /YOUR_ADMIN/themes/default/template/helpers/list
and replace all code with code pasted below
{*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}

			</table>
			{if $bulk_actions}
				<p>
					{foreach $bulk_actions as $key => $params}
						<input type="submit" class="button" name="submitBulk{$key}{$table}" value="{$params.text}" {if isset($params.confirm)}onclick="return confirm('{$params.confirm}');"{/if} />
					{/foreach}
				</p>
			{/if}
		</td>
	</tr>
</table>
{if !$simple_header}
	<input type="hidden" name="token" value="{$token}" />
	</form>
{/if}
{hook h='displayAdminListAfter'}
{if isset($name_controller)}
	{capture name=hookName assign=hookName}display{$name_controller|ucfirst}ListAfter{/capture}
	{hook h=$hookName}
{elseif isset($smarty.get.controller)}
	{capture name=hookName assign=hookName}display{$smarty.get.controller|ucfirst|htmlentities}ListAfter{/capture}
	{hook h=$hookName}
{/if}


{block name="after"}{/block}
{if $smarty.get.controller|ucfirst|htmlentities == 'AdminOrders'}
	<div style="float: right;padding: 10px 10px 0px;background: #CBCCBC;">
		<h1>{l s='Total: '} {convertPrice price=$order_total}</h1>
	</div>
{/if}

Follow all this steps and Enjoy!!

 

How to make an added only what displays?

Link to comment
Share on other sites

Hi Divyesh,

 

He is asking for the added total of the orders that are displayed in that page.

So if the page has 10 orders, so the total should display only the added values of the 10 orders only not including the orders in the next page and other pages beyond. It should take in account of the page count and pagination.

Link to comment
Share on other sites

Ok, Got the point, will try at my side and update soon.

 

Hi Divyesh,

 

He is asking for the added total of the orders that are displayed in that page.

So if the page has 10 orders, so the total should display only the added values of the 10 orders only not including the orders in the next page and other pages beyond. It should take in account of the page count and pagination.

Exactly!

I'm sorry for my english.

Link to comment
Share on other sites

  • 3 weeks later...

Sounds like  a javascript solution would fit better here than a server-side one, implemented in a seperate  module preferably.

 

After filtered AdminOrders listing is loaded, call a jquery function  which performs as follows:

<Pseudocode>

-Iterates  over all orders totals fields currently visible on page. 

-Adds  up prices in a field at the bottom.

</Pseudocode>

 

Sorry i can't post any actual code here as it has takes some work .

Link to comment
Share on other sites

Sounds like  a javascript solution would fit better here than a server-side one, implemented in a seperate  module preferably.

 

After filtered AdminOrders listing is loaded, call a jquery function  which performs as follows:

<Pseudocode>

-Iterates  over all orders totals fields currently visible on page. 

-Adds  up prices in a field at the bottom.

</Pseudocode>

 

Sorry i can't post any actual code here as it has takes some work .

Maybe someone else can help?

Link to comment
Share on other sites

  • 2 weeks later...

Hi;

 

First of all make  a back up of these files:

 

/classes/controller/AdminController.php
/classes/order/Order.php
/YOUR_ADMIN/themes/default/template/helpers/list/list_footer.tpl
 
After that replace each one of them with the file I post. I had to change the name (and extension) to the fpl file, 'cause I cant upload a tpl file in this forum, just have to rename the file to list_footer.tpl
 
That's it.

AdminController.php

Order.php

list_footer.tpl.txt

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

 

Hi;

 

First of all make  a back up of these files:

 

/classes/controller/AdminController.php
/classes/order/Order.php
/YOUR_ADMIN/themes/default/template/helpers/list/list_footer.tpl
 
After that replace each one of them with the file I post. I had to change the name (and extension) to the fpl file, 'cause I cant upload a tpl file in this forum, just have to rename the file to list_footer.tpl
 
That's it.

 

 

 

Thank you very much. It works!!!

Link to comment
Share on other sites

  • 3 months later...
  • 5 months later...
  • 9 months later...

Hello i was searching a long time a solution for this.... 

Finally, I did a very simple script in Javascript for show the total amount on order back office.This only sum all green prices (badge class) of the active pagination... (you must put 1000 orders by page for sum the maximum of your orders...

 

In pages with more of 1000 orders dont work...

 

Im know is a very poor solution... but for me work for the moment... and I think that possibly to other people with same problem.

 

Tested on 1.6.1.1... not elegant solution... but solution... If someone want contrib to make this litle script better... hehehe.

 

Give your feedback...

Thanks

 

Can you put the code on footer.tpl or any.

CODE:

<script language="javascript">
 
if (document.getElementsByClassName("badge").length != 0) {
var res = document.getElementsByClassName("badge");
var total = 0.00;
 
for (var i=1; i< res.length; i++) { 
clean = res.innerText;
clean = parseFloat(clean.replace(",","."));
texto = total + " / " + clean;
total = total + clean;
 
var midiv = document.createElement("div");
midiv.setAttribute("class","totalventa");
midiv.innerHTML = "<strong>TOTAL:</strong> <big><strong>"+parseFloat(total)+"</strong></big> €<br><small>No incluye pedidos cancelados o con error en el pago. Recordad mostrar todos los pedidos por página.<small>";
document.body.appendChild(midiv);
var sheet = window.document.styleSheets[0];
sheet.insertRule('div.totalventa { position:fixed; top:10px; z-index:999999; padding:10px; background-color:#d4ffce;border-color:grey; border:1px; margin:50px 400px;}', sheet.cssRules.length);
sheet.insertRule('div.totalventa:active { display:none;}', sheet.cssRules.length);
 
if (!document.getElementById("page-header-desc-order-new_order")) { 
sheet.insertRule('div.totalventa { display:none;}', sheet.cssRules.length);
}
 
//alert(parseFloat(total)+" €\n\nNo incluye pedidos cancelados o con error en el pago. Recordad mostrar todos los pedidos por página.\n----------------------\n\n")
}
</script>

 

 

post-1105927-0-39351500-1443743543_thumb.jpg

Link to comment
Share on other sites

  • 1 month later...

 

Hello i was searching a long time a solution for this.... 

Finally, I did a very simple script in Javascript for show the total amount on order back office.This only sum all green prices (badge class) of the active pagination... (you must put 1000 orders by page for sum the maximum of your orders...

 

In pages with more of 1000 orders dont work...

 

Im know is a very poor solution... but for me work for the moment... and I think that possibly to other people with same problem.

 

Tested on 1.6.1.1... not elegant solution... but solution... If someone want contrib to make this litle script better... hehehe.

 

Give your feedback...

Thanks

 

Can you put the code on footer.tpl or any.

CODE:

<script language="javascript">
 
if (document.getElementsByClassName("badge").length != 0) {
var res = document.getElementsByClassName("badge");
var total = 0.00;
 
for (var i=1; i< res.length; i++) { 
clean = res.innerText;
clean = parseFloat(clean.replace(",","."));
texto = total + " / " + clean;
total = total + clean;
 
var midiv = document.createElement("div");
midiv.setAttribute("class","totalventa");
midiv.innerHTML = "<strong>TOTAL:</strong> <big><strong>"+parseFloat(total)+"</strong></big> €<br><small>No incluye pedidos cancelados o con error en el pago. Recordad mostrar todos los pedidos por página.<small>";
document.body.appendChild(midiv);
var sheet = window.document.styleSheets[0];
sheet.insertRule('div.totalventa { position:fixed; top:10px; z-index:999999; padding:10px; background-color:#d4ffce;border-color:grey; border:1px; margin:50px 400px;}', sheet.cssRules.length);
sheet.insertRule('div.totalventa:active { display:none;}', sheet.cssRules.length);
 
if (!document.getElementById("page-header-desc-order-new_order")) { 
sheet.insertRule('div.totalventa { display:none;}', sheet.cssRules.length);
}
 
//alert(parseFloat(total)+" €\n\nNo incluye pedidos cancelados o con error en el pago. Recordad mostrar todos los pedidos por página.\n----------------------\n\n")
}
</script>

 

Hola!

He insertado tu código en el footer.tpl del admin/themes/default/template/ pero nada cambia, no puedo ver el total. ¿dónde exactamente se debe insertar el texto, dentro del body, fuera?

mi versión es la 1.6.1.2

Gracias!

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

Hola!

He insertado tu código en el footer.tpl del admin/themes/default/template/ pero nada cambia, no puedo ver el total. ¿dónde exactamente se debe insertar el texto, dentro del body, fuera?

mi versión es la 1.6.1.2

Gracias!

 Hola fito. Yo tengo el script insertado justo antes del cierre </body>

 

TVcG1.jpg

Link to comment
Share on other sites

  • 4 weeks later...
  • 9 months later...
  • 1 year later...

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...