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 :)

prompt-service.ro: Centrale termice, Aer conditionat, Piese de schimb
lemnpefoc.ro: Lemne de foc
Vila Ancuta: Cazare Valea Doftanei
Valea Doftanei: Comuna Valea Doftanei


Newbie

Posts

Joined
Tue May 30, 2017 6:26 pm

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

Some help, please

prompt-service.ro: Centrale termice, Aer conditionat, Piese de schimb
lemnpefoc.ro: Lemne de foc
Vila Ancuta: Cazare Valea Doftanei
Valea Doftanei: Comuna Valea Doftanei


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

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


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.

prompt-service.ro: Centrale termice, Aer conditionat, Piese de schimb
lemnpefoc.ro: Lemne de foc
Vila Ancuta: Cazare Valea Doftanei
Valea Doftanei: Comuna Valea Doftanei


Newbie

Posts

Joined
Tue May 30, 2017 6:26 pm

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

Up!

prompt-service.ro: Centrale termice, Aer conditionat, Piese de schimb
lemnpefoc.ro: Lemne de foc
Vila Ancuta: Cazare Valea Doftanei
Valea Doftanei: Comuna Valea Doftanei


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
Administrator

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>

prompt-service.ro: Centrale termice, Aer conditionat, Piese de schimb
lemnpefoc.ro: Lemne de foc
Vila Ancuta: Cazare Valea Doftanei
Valea Doftanei: Comuna Valea Doftanei


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
Administrator

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.

prompt-service.ro: Centrale termice, Aer conditionat, Piese de schimb
lemnpefoc.ro: Lemne de foc
Vila Ancuta: Cazare Valea Doftanei
Valea Doftanei: Comuna Valea Doftanei


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
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am

Who is online

Users browsing this forum: No registered users and 110 guests