Post by teodorl » Sun Nov 18, 2018 5:47 am

Hello guys!

I want to count my orders by status (/admin->sales). I've manage to create some buttons with orders status and I want to insert a counter Pending (x), Canceled (y), Finish (z),...
I've tried to do this using $history_total attribute from pagination but I didn't manage to solve it.
Can you please help me with a solution?

*php newbie :)

Newbie

Posts

Joined
Tue May 30, 2017 6:26 pm

Post by teodorl » Tue Dec 04, 2018 7:00 pm

Some help, please

Newbie

Posts

Joined
Tue May 30, 2017 6:26 pm

Post by IP_CAM » Wed Dec 05, 2018 1:36 am

Well, some of them exist already for 1.5.6.x Versions! ;)
And they all work well upto OC v.1.5.6.5_rc as well. But not all
of them look exactly like shown on the images below, because
I usually change a few details in my 'final' versions... :D
But for anything else, you'll have to get professional Support.
Ernie
---
Orders Statuses Report
https://www.opencart.com/index.php?rout ... n_id=13495
---
Multiple select option for Order status in Sales Report
https://www.opencart.com/index.php?rout ... n_id=17321
---
Custom Sales Reports
https://www.opencart.com/index.php?rout ... n_id=10022
---
Order List
https://www.opencart.com/index.php?rout ... on_id=3597
---
Image

Attachments

order_status_reports_opencart_1_5_x.jpg

order_status_reports_opencart_1_5_x.jpg (178.93 KiB) Viewed 766 times


For Sale: Turnkey Top URLs with Opencart installed!
Latest Opencart LIGHT + V-Pro Test Site: http://www.hitline.info
For more Information, please contact me at: jti@jacob.ch
Free OC Extensions from the largest Github OC Archive on Earth,
635 + free Repositories - from OC v.1.5.x up
on my Github Opencart Site: https://github.com/IP-CAM
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by teodorl » Wed Dec 05, 2018 4:23 pm

Hello! Thanks for your answer, nice work but I don't need this. All I want is to show how many orders do I have in the Sales area. I have something like this:
Image

Every button is one order status and if you click it will show you the orders with that status.

Newbie

Posts

Joined
Tue May 30, 2017 6:26 pm

Post by teodorl » Thu Dec 20, 2018 4:57 pm

Up!

Newbie

Posts

Joined
Tue May 30, 2017 6:26 pm

Post by Johnathan » Fri Dec 21, 2018 1:42 am

You don't need a report or custom extension for this. Just filter on a particular order status in Sales > Orders, then look at the bottom pagination to see the total number of orders with that status. If you want to add some links to those pages yourself, you can do that with normal <a> tags in HTML.

Image
Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by teodorl » Fri Dec 21, 2018 4:17 pm

I've managed to do the links for every button but I didn't manage to put the counter for every link before you click it. I want to put a counter for every button (status order) so that I don't have to click the button to find out how many orders with that status are.

Code: Select all

<div class="tab">
		  <button onclick ="filter_status(this);" class="tablinks" value="0">Toate comenzile</button>
		  <button onclick ="filter_status(this);" class="tablinks" value="30">Comenzi Lipsa</button>
	   <?php foreach ($order_statuses as $order_status) { ?>
			<button onclick ="filter_status(this);" class="tablinks" id="q_<?php echo $order_status['order_status_id']; ?>" value="<?php echo $order_status['order_status_id']; ?>"><?php
					if($order_status['name'] == 'Finalizata') {echo '<span class="instoc"> </span>'; }
					if($order_status['name'] == 'In procesare') {echo '<span class="inprocesare"> </span>'; }
					if($order_status['name'] == 'Anulata') {echo '<span class="anulata"> </span>'; }
					if($order_status['name'] == 'Nepreluata') {echo '<span class="nepreluata"> </span>'; }
					if($order_status['name'] == 'Ridicare de la sediu') {echo '<span class="ridsediu"> </span>'; }
					if($order_status['name'] == 'Asteptare plata OP') {echo '<span class="plataop"> </span>'; }
					if($order_status['name'] == 'Plata card esuata') {echo '<span class="expirata"> </span>'; }
					if($order_status['name'] == 'Stornata') {echo '<span class="stornata"> </span>'; }
					if($order_status['name'] == 'Pregatita de Livrare') {echo '<img src="/image/data/prompt-service-clima-favicon.png" style="height:14px;display:inline-block;margin: 0 5px 0 0;" />'; }
					if($order_status['name'] == 'Pregatita de Trimis') {echo '<img src="/image/data/FANCourier.png" style="height:14px;display:inline-block;margin: 0 5px 0 0;" />'; }
					if($order_status['name'] == 'Platita online') {echo '<img src="/image/data/favicon-euplatesc.png" style="height:14px;display:inline-block;margin: 0 5px 0 0;" />'; }
					if($order_status['name'] == 'Plata card nefinalizata') {echo '<span class="cnefinal"> </span>'; }
				?><?php echo $order_status['name'].' ('.count(HERE I DON'T KNOW WHAT IS THE CODE).')'; ?></button>
	   <?php } ?>
				  
	  </div>

Newbie

Posts

Joined
Tue May 30, 2017 6:26 pm

Post by Johnathan » Fri Dec 21, 2018 11:33 pm

That's much more complicated. You'll need to do some database queries in the controller file, set those values in a variable or array, then pass that forward to the template file. It's beyond what I can suggest code for, but if you know how the OpenCart MVC system works, you should be able to figure it out.

Image
Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by teodorl » Thu Jan 03, 2019 10:45 pm

I'll appreciate any help from you with the code.

Newbie

Posts

Joined
Tue May 30, 2017 6:26 pm

Post by Johnathan » Thu Jan 03, 2019 11:42 pm

Controller files are located in /admin/controller/. You'd find the relevant file (usually it's based on the "route" of the page, so you can try finding it that way) and then you'd do a database query like this:

$my_query = $this->db->query("YOUR MYSQL HERE");

Then, you'd use whatever data you got from that query and put it in a variable like this:

$this->data['my_var'] = 'Some Data';

Once you've done that, you can use the variable in your template file, like this:

<?php echo $my_var; ?>

Hope that helps

Image
Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am

Who is online

Users browsing this forum: No registered users and 41 guests