Post by Monarchy Catering » Wed Nov 08, 2017 12:10 am

Is it possible to display the current number of "Total Orders" inside an HTML Content Module please?

Thanks.

New member

Posts

Joined
Sat Oct 28, 2017 11:52 pm

Post by sachin6609 » Wed Nov 08, 2017 5:51 pm

Monarchy Catering wrote:
Wed Nov 08, 2017 12:10 am
Is it possible to display the current number of "Total Orders" inside an HTML Content Module please?

Thanks.
Hello

please share a screen shot on which page you want to Show Total Orders.??

Thanks

sachin

Active Member

Posts

Joined
Thu Jul 23, 2015 2:57 pm

Post by Monarchy Catering » Wed Nov 08, 2017 6:49 pm

sachin6609 wrote:
Wed Nov 08, 2017 5:51 pm
Monarchy Catering wrote:
Wed Nov 08, 2017 12:10 am
Is it possible to display the current number of "Total Orders" inside an HTML Content Module please?

Thanks.
Hello

please share a screen shot on which page you want to Show Total Orders.??

Thanks

sachin
Hello, and thanks for the reply.

It would be on the Home page, in any module or code format that would work.

Thank you.

New member

Posts

Joined
Sat Oct 28, 2017 11:52 pm

Post by straightlight » Wed Nov 08, 2017 10:47 pm

If you mean by using a parsed tag, it would require some coding into your admin/view/javascript/summernote/summernote.js file along with the font keys but instead of font keys, you'd return your total orders results with your used parsed tag key inside your HTML module. From the catalog-end, you'd need to convert this parsed tag key back into the total orders text.

With that being said, you'd need to re-capture the total orders from the catalog-end in order to obtain the total order results. In other words, it could be done but would not be the most simplistic approach to use. Rather to create a separate row in your catalog-end page that would simply display the total orders for that particular element you've selected would be much simplistic.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Monarchy Catering » Sat Nov 11, 2017 6:21 pm

straightlight wrote:
Wed Nov 08, 2017 10:47 pm
If you mean by using a parsed tag, it would require some coding into your admin/view/javascript/summernote/summernote.js file along with the font keys but instead of font keys, you'd return your total orders results with your used parsed tag key inside your HTML module. From the catalog-end, you'd need to convert this parsed tag key back into the total orders text.

With that being said, you'd need to re-capture the total orders from the catalog-end in order to obtain the total order results. In other words, it could be done but would not be the most simplistic approach to use. Rather to create a separate row in your catalog-end page that would simply display the total orders for that particular element you've selected would be much simplistic.
Yikes, I thought the OC technology would be more mature and the page generation has basic access to overall sales / catalog data :(

I must admit that I am a convert to OC being a Magento developer, much more intutitve and robust.

New member

Posts

Joined
Sat Oct 28, 2017 11:52 pm

Post by straightlight » Sat Nov 11, 2017 11:15 pm

The technology is there in Opencart. You just need to know how to combine those basic features all together.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Qphoria » Sun Nov 12, 2017 5:57 am

Monarchy Catering wrote:
Wed Nov 08, 2017 6:49 pm
Is it possible to display the current number of "Total Orders" inside an HTML Content Module please?

Thanks.
Are you asking for total orders that the customer has placed?
Or are you asking for total site orders ? Do you want this visible for all to see?

Either are quite easy to display.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Monarchy Catering » Sun Nov 12, 2017 3:08 pm

Qphoria wrote:
Sun Nov 12, 2017 5:57 am
Monarchy Catering wrote:
Wed Nov 08, 2017 6:49 pm
Is it possible to display the current number of "Total Orders" inside an HTML Content Module please?

Thanks.
Are you asking for total orders that the customer has placed?
Or are you asking for total site orders ? Do you want this visible for all to see?

Either are quite easy to display.
Hello,

I am looking to display "TOTAL SITE ORDERS", as we are moving from our old site which has been active for almost 10 years now.

I love the term "Easy" :)

Thanks.

New member

Posts

Joined
Sat Oct 28, 2017 11:52 pm

Post by Qphoria » Mon Nov 13, 2017 9:24 am

It's just odd that you'd want to show private information like that on the homepage but yea easy..

You have a few options.

1. You can create a module
This means you need to create all the supporting files for a module (at least 6 files, (admin side controller, language, view) (catalog side controller, language, view). This will then let it use the module system. But might be more than you need for displaying just some simple data.

2. Create a simple vQmod to alter the homepage or header and have the data shown there.
I'll explain this method as you like the "Easy" term. And I'll assume you want it shown in the header so that it shows on all pages. But if you only want it on certain pages, you can swap out the header controller for a different controller that you want to show it on. Controllers are basically the base page. So the "home" controller controls whats on the home page, the account controller controls whats on the account page.. and so on.

Controller:
a. EDIT: catalog/controller/common/header.php
b. Find:

Code: Select all

$data['title']
c. After, add:

Code: Select all

$data['order_count'] = $this->db->query("SELECT count(*) FROM `" . DB_PREFIX . "order`")->row['count(*)']; 
 

View:
In 2.3 you could edit the theme files directly. In 3.0, you use the admin theme editor. This will override the default.
a. Goto Admin->Design->Theme Editor
b. Load common/header.twig
c. Find:

Code: Select all

<body>
d. After, add:

Code: Select all

Total # of Orders: {{ order_count}}
That will show you the order count as shown in the screenshot attached. Obviously you'll want to style this better and likely move it to another location but this should give you a bit of understanding how to do it. It is really quite easy.... ignore the dramatic folks.

Ideally you'd create this as a vQmod (or ocmod) file so that you don't need to edit core files. But baby steps...

Attachments

total_orders_example.png

total_orders_example.png (14.41 KiB) Viewed 517 times


Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Monarchy Catering » Tue Nov 14, 2017 4:29 am

Total Sales is not really private as such and the number of sales will highlight have successful the website is and give the prospective customer some confidence in the website :)

I really want to show the totals sales as part of the introductory text regarding the business on the Home Page.

Thank you for taking the time. It actually seems extremely straightforward and I'll try my first OCMOD file.

Will let you know.

Thank you and best wishes.

New member

Posts

Joined
Sat Oct 28, 2017 11:52 pm
Who is online

Users browsing this forum: No registered users and 8 guests