Show Order Count on Order Screen

  • Posts: 713
  • Thank you received: 37
  • Hikashop Business
2 years 9 months ago #339147

-- HikaShop version -- : 4.4.5
-- Joomla version -- : 3

Is there a way to add to the orders page a listing of how many purchases a customer has done? I ask because currently, I have to manually go look to see if the purchase is by a new customer or not, as it is...it's a major pain in the butt and takes a lot of time.

Just an extra column, showing an order number total, would be perfectly fine with me.

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
2 years 9 months ago #339148

Hello,

In which order listing do you want to display it, on the back-end or the front-end ? Can you show us a screenshot of where you want to display it ? Thank you.

Kind regards,
Mohamed.

Please Log in or Create an account to join the conversation.

  • Posts: 713
  • Thank you received: 37
  • Hikashop Business
2 years 9 months ago #339159

Mohamed Thelji wrote: Hello,

In which order listing do you want to display it, on the back-end or the front-end ? Can you show us a screenshot of where you want to display it ? Thank you.

Kind regards,
Mohamed.


I apologize...I would want this on the back end, like the picture below. If possible, in the red highlighted area would be perfect!

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 9 months ago #339161

Hi,

Edit the file order / listing for your backend template via the menu Display>Views.
There, after the line:

if(hikashop_isAllowed($config->get('acl_user_manage','all'))) echo $row->user_email.' <a href="'.$url.$target.'"><i class="fa fa-chevron-right"></i></a>';
add the code:
$db = JFactory::getDBO();
$db->setQuery('SELECT count(order_id) as number_of_orders FROM #__hikashop_order WHERE order_user_id = '.$row->user_id.' AND order_status IN (\'confirmed\',\shipped\')');
echo ' ('.$db->loadResult().')';

Please Log in or Create an account to join the conversation.

  • Posts: 713
  • Thank you received: 37
  • Hikashop Business
2 years 9 months ago #339198

nicolas wrote: Hi,

Edit the file order / listing for your backend template via the menu Display>Views.
There, after the line:

if(hikashop_isAllowed($config->get('acl_user_manage','all'))) echo $row->user_email.' <a href="'.$url.$target.'"><i class="fa fa-chevron-right"></i></a>';
add the code:
$db = JFactory::getDBO();
$db->setQuery('SELECT count(order_id) as number_of_orders FROM #__hikashop_order WHERE order_user_id = '.$row->user_id.' AND order_status IN (\'confirmed\',\shipped\')');
echo ' ('.$db->loadResult().')';


Ok...I did that...and the whole display for my orders went blank. Attached is a Notepad File of the change I made. Did I not do it right?

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 9 months ago #339203

Hi,

Try with that code instead:

$db = JFactory::getDBO();
$db->setQuery('SELECT count(order_id) as number_of_orders FROM #__hikashop_order WHERE order_user_id = '.$row->user_id.' AND order_status IN (\'confirmed\',\'shipped\')');
echo ' ('.$db->loadResult().')';

Note that I didn't test the code. If you get an error or blank page, please activate the "error reporting" and "debug system" settings of the Joomla configuration and try again and you'll should get more information about the issue. Please provide the full error message so that I can correct the code.

Please Log in or Create an account to join the conversation.

  • Posts: 713
  • Thank you received: 37
  • Hikashop Business
2 years 9 months ago #339243

nicolas wrote: Hi,

Try with that code instead:

$db = JFactory::getDBO();
$db->setQuery('SELECT count(order_id) as number_of_orders FROM #__hikashop_order WHERE order_user_id = '.$row->user_id.' AND order_status IN (\'confirmed\',\'shipped\')');
echo ' ('.$db->loadResult().')';

Note that I didn't test the code. If you get an error or blank page, please activate the "error reporting" and "debug system" settings of the Joomla configuration and try again and you'll should get more information about the issue. Please provide the full error message so that I can correct the code.


This too did not work...I turned on Error Reporting and Debug...but I simply don't understand what you are needing here. I'm sending log in details so you can see the test site backend yourself. I'll leave this above code in the listing you mentioned and also leave debug & error reporting on so you can see what's going on.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 9 months ago #339248

Hi,

If you check your modified order listing, you can see that the area of the listing is empty, without any error, even with the debug activated.
And if you check the modifications of order / listing, you can see that the view file is completely empty (without any HTML/PHP code). and that's why the listing is not displaying anymore.

This has nothing to do with the modification I proposed. This comes from a security extension which filters out the HTML/PHP of the view file in the HTTP request when you click on the "save" button of the view file.

Looking a bit at the extensions of your website, I found it comes from the JHackGuard Plugin. I've disabled it temporarily via the Joomla plugins manager while doing the change in the view file as explained and it works fine:
i.imgur.com/GOBLLqn.png

Last edit: 2 years 9 months ago by nicolas.

Please Log in or Create an account to join the conversation.

  • Posts: 713
  • Thank you received: 37
  • Hikashop Business
2 years 9 months ago #339258

Interesting...ok, thank you for looking into that.

So in keeping Jhackguard...how do I go about getting this to work? While it was a long time ago...my previous site manager said to never uninstall that.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 9 months ago #339260

Hi,

As I said, just disable the Jhackguard plugin when you need to do a view override.

Please Log in or Create an account to join the conversation.

  • Posts: 713
  • Thank you received: 37
  • Hikashop Business
2 years 9 months ago #339272

nicolas wrote: Hi,

As I said, just disable the Jhackguard plugin when you need to do a view override.


No problem Nicolas, thank you. I just spoke with Siteground (the maker of that plugin) and they no longer support it anyways. In your professional opinion...do you know of another plugin like it that would be good to use?

Thank you very much

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 9 months ago #339284

Hi,

I know that RS firewall is used a lot on Joomla websites and I think both do roughly the same thing.
And it seems to be well maintained.

Please Log in or Create an account to join the conversation.

  • Posts: 713
  • Thank you received: 37
  • Hikashop Business
2 years 9 months ago #339315

nicolas wrote: Hi,

I know that RS firewall is used a lot on Joomla websites and I think both do roughly the same thing.
And it seems to be well maintained.


Fantastic, thank you very much for the referral. I was actually looking at that, but having someone in your position recommend it tends to put a different light on the plugin.

The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.092 seconds
Powered by Kunena Forum