If this is your first visit, check our documentation. To post, register or login.
Forums / Community Contributed Add-Ons / All Other Contributions/Addons / codeTrio Sales Summary Graph v1.0 [Support Thread]

codeTrio Sales Summary Graph v1.0 [Support Thread]

Started by imranulh on 13 Dec 2012, 8:39 AM · Views: 4,047

Results 1 to 16 of 16
26 Dec 2012, 4:49 PM
#2
limitless avatar

limitless

Inactive

Join Date:
Jan 2012
Posts:
496
Plugin Contributions:
0

Post #2 by limitless

Installation was smooth, but seems like the calculations and dates are whacked.

Depending on which boxes are ticked, the 'sales numbers' are all over the place and even the default 'show 30 days' is actually a month off.

Attachment 11660

31 Dec 2012, 1:20 PM
#3
imranulh avatar

imranulh

New Zenner

Join Date:
Jun 2005
Location:
Dhaka, Bangladesh
Posts:
21
Plugin Contributions:
2

Post #3 by imranulh

Thank you for pointing it out Limitless.
Missed the date format, fixed it in v1.02

Imranul Hoque
Director @ codeTrio
www.imranulhoque.com

4 Feb 2013, 7:04 AM
#4
sharon_j avatar

sharon_j

New Zenner

Join Date:
Dec 2012
Location:
Tampa,FL
Posts:
25
Plugin Contributions:
0

Post #4 by sharon_j

Hello,

I am using ZC 1.51 and PHP 5.3

I am getting error logs generated in /myadmin/ct_sales_summary.php (not my real admin directory name).

PHP Warning: implode(): Invalid arguments passed in /public_html/myadmin/ct_sales_summary.php on line 72

$table_struct = "{cols:[{id:'date_purchased',label:'Date',type:'date'},
                           {id:'ot_total',label:'Sale',type:'number'}],
                     rows:[";
                     
   
      while(!$total_query->EOF){
     $year = date("Y", $total_query->fields['date_purchased']);
     $mon  = date("m", $total_query->fields['date_purchased']);
     $day  = date("d", $total_query->fields['date_purchased']);
     $date_display = (isset($monthly) && $monthly) ? date('F, Y', $total_query->fields['date_purchased']) : date('d F, Y', $total_query->fields['date_purchased']);
     $data_array[] = "{c:[{v:new Date($year,($mon-1),$day),f:'" . $date_display . "'},{v:" . $total_query->fields['total'] . ",f:'" . $currencies->format($total_query->fields['total']) . " (" . $total_query->fields['order_count'] . " orders)'}]}";
     $total_query->MoveNext();
   }
   
   $table_struct .= implode(',', $data_array);      (this is line 72 in my file)
   
   $table_struct .= "     ]
                     }";

From what I've read, if it is correct, this is because $data_array is not an array and needs to be defined as such. This may be the case, however I do not know how or exactly where in the code to do this.

Thank you so much,

Sharon

7 Feb 2013, 5:49 AM
#5
imranulh avatar

imranulh

New Zenner

Join Date:
Jun 2005
Location:
Dhaka, Bangladesh
Posts:
21
Plugin Contributions:
2

Post #5 by imranulh

Hi Sharon,

I have updated the add-on and submitted version 1.03.

It should fix the warning you got. I think you did not have any order in the selected time frame.

Thanks

Imranul Hoque
Director @ codeTrio
www.imranulhoque.com

23 Jan 2015, 4:25 PM
#6
louis avatar

louis

Zen Follower

Join Date:
Jul 2006
Location:
Johannesburg
Posts:
408
Plugin Contributions:
0

Post #6 by louis

Hi,

I just installed this plugin on ZC 1.5.3 and everything seemed to work well. Then I decided to select a status for filtering and the following errors were logged:

PHP Warning: mysql_real_escape_string(): Access denied for user 'xxxxxx' (using password: NO) in /home/xxxxxx/public_html/xxxxxx/xxxxxx/ct_sales_summary.php on line 43
PHP Warning: mysql_real_escape_string(): A link to the server could not be established in /home/xxxxxx/public_html/xxxxxx/xxxxxx/ct_sales_summary.php on line 43

Everything else does work and I can change the date range without any issue. The graph is displaying data and when you hover your cursor it provides you with the total amount and total orders for the day.

It is just the status filter that causes an error. Any ideas?

23 Jan 2015, 6:43 PM
#7
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Heerenveen, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Post #7 by design75

Louis:

Hi,

I just installed this plugin on ZC 1.5.3 and everything seemed to work well. Then I decided to select a status for filtering and the following errors were logged:

Everything else does work and I can change the date range without any issue. The graph is displaying data and when you hover your cursor it provides you with the total amount and total orders for the day.

It is just the status filter that causes an error. Any ideas?

You should change line 43 of YOUR_ADMIN/ct_sales_summary.php
from:

   $status_query = empty($ordst) ? '' : ' and o.orders_status in (' . mysql_real_escape_string($ordst) . ')';

to:

   $status_query = empty($ordst) ? '' : ' and o.orders_status in (' . zen_db_prepare_input($ordst) . ')';
23 Jan 2015, 6:45 PM
#8
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #8 by lat9

Zen Cart v1.5.3 uses the mysqli_ interface instead of the (deprecated in PHP 5.5.x) mysql_ functions.

The plugin that you installed is making direct mysql_* function calls instead of using the Zen Cart $db object (which makes the mysql -> mysqli transition "transparent" to the calling code).

29 Jan 2015, 8:08 AM
#9
louis avatar

louis

Zen Follower

Join Date:
Jul 2006
Location:
Johannesburg
Posts:
408
Plugin Contributions:
0

Post #9 by louis

Hi guys,

Thank you very much for your assistance. The graph is now fully functional in ZC 1.5.3

Thank you also for the explanation. It assisted me in resolving an issue I had with another unrelated plugin.

20 May 2015, 12:10 AM
#10
jackie_taferner avatar

jackie_taferner

Totally Zenned

Join Date:
Jun 2009
Location:
Orange County, California
Posts:
547
Plugin Contributions:
3

Post #10 by jackie_taferner

Thanks for this plugin, it is very useful! It's working great for Super Admin, but I'm unable to get it working for an Editor profile. I've tried enabling all of the checkboxes for that account, and it still doesn't work. The graph only appears when I switch that user the SuperAdmin. Any ideas? Thanks for your help!

Jackie Taferner - JT Website Design
Custom Website Design and Ecommerce
Support the community. Don't Private Message, post your questions in the forum.

23 Jul 2020, 9:35 AM
#11
reesy avatar

reesy

Totally Zenned

Join Date:
Mar 2005
Posts:
535
Plugin Contributions:
3

Post #11 by reesy

Anyone still using this?
It seems that the display of the graph needs updating and it's causing errors.

23 Jul 2020, 4:26 PM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #12 by drbyte

Reesy:

Anyone still using this?
It seems that the display of the graph needs updating and it's causing errors.
Google retired the jsapi that it was leveraging to display graphs.

If you're using 1.03 of the module, then in the graphs file:

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
//<=!=[=C=D=A=T=A=[
    google.load("jquery", "1");
//]=]=>
</script>
```must be replaced with ```
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://www.gstatic.com/charts/loader.js"></script>

and

 google.load('visualization', '1');
 google.setOnLoadCallback(drawVisualization);
```must be replaced with```
 google.charts.load('current', {packages: ['corechart']});
 google.charts.setOnLoadCallback(drawVisualization);

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

23 Jul 2020, 4:32 PM
#13
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #13 by drbyte

I wrapped the query fixes and the charting api fixes into a new 1.04 release, which has been submitted to the plugins area.
Unfortunately I don't have a codetrio account with which to test the changes, so apologies if it contains other errors!

For Zen Cart versions other than 1.5.1-to-1.5.4 for installing this to new sites you'll have to manually apply the "index.php" changes to the index_dashboard.php file.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

24 Jul 2020, 2:59 AM
#14
reesy avatar

reesy

Totally Zenned

Join Date:
Mar 2005
Posts:
535
Plugin Contributions:
3

Post #14 by reesy

Thanks for your help DrByte :smile:
No Code Trio account is needed for this, they are just the developers of it I believe.
2 errors still being thrown up

Uncaught ReferenceError: $ is not defined

and an onclick error

Uncaught ReferenceError: $ is not defined
    at setGraphSource (index.php:405)
    at HTMLInputElement.onclick (index.php:337)

:(

24 Jul 2020, 7:24 PM
#15
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #15 by drbyte

Hmm.
I forgot that older Zen Cart versions don't automatically load jQuery. I updated my earlier post to include that.

I also found that sometimes the HTML div id of "graph" that this uses may clash with other graphs already on the page. So I've changed it to "ctgraph" in the two places it is needed.
I also found some function calls to an old PHP function "split" that I've updated to "preg_split".

These changes are now in 1.05 which is now in the plugins area.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

25 Jul 2020, 3:00 AM
#16
reesy avatar

reesy

Totally Zenned

Join Date:
Mar 2005
Posts:
535
Plugin Contributions:
3

Post #16 by reesy

Thats fixed it, thank you! :smile: