Page 1 of 1

Updating older low stock reporting report

Posted: Thu Jun 13, 2024 11:06 am
by 14Steve14
I am updating an older admin report that shows low product stocks. I cannot make any sense of the error. I am getting an error that stops the page loading which is

Code: Select all

[13-Jun-2024 11:00:36 UTC] PHP Parse error:  syntax error, unexpected single-quoted string "<i class="fas fa-check-circle ..." in /home/####/public_html/####/stats_low_stock.php on line 170
Here is the offending line of code

Code: Select all

        echo '<i class="fas fa-check-circle text-success"></i> <a href="' . Href::redirect($Linker->build('stats_low_stock.php', 'action=setflag&flag=0&pID=' . $products['products_id'] . '&cPath=' . ($cPath ?? null)) . '"><i class="fas fa-times-circle text-muted"></i></a>';
and here is the code block in its entirety.

Code: Select all

<tr onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" onClick="document.location.href='<?php echo($url_newproduct); ?>'">
		<td align="left"><?php echo $rows; ?>.</td>
		<td><?php echo $prodmodel; ?></td>
		<td><?php echo '<a href="' . $url_product . '" class="blacklink">' . $products['products_name'] . '</a>'; ?></td>
		<td><?php echo $productsQty; ?></td>
		<td>
		<?php		
		if ($products['products_status'] == '1') {
        echo '<i class="fas fa-check-circle text-success"></i> <a href="' . Href::redirect($Linker->build('stats_low_stock.php', 'action=setflag&flag=0&pID=' . $products['products_id'] . '&cPath=' . ($cPath ?? null)) . '"><i class="fas fa-times-circle text-muted"></i></a>';
      } else {
        echo '<a href="' . Href::redirect($Linker->build('stats_low_stock.php', 'action=setflag&flag=1&pID=' . $products['products_id'] . '&cPath=' . ($cPath ?? null) . '&page=' .$_GET['page'])) . '"><i class="fas fa-check-circle text-muted"></i></a>  <i class="fas fa-times-circle text-danger"></i>';

      }
?>


	</td></tr>
Is there anyone that can help decipher the error to get the page working.

Re: Updating older low stock reporting report

Posted: Thu Jun 13, 2024 11:48 am
by heatherbell
14Steve14 wrote: Thu Jun 13, 2024 11:06 am Here is the offending line of code

Code: Select all

        echo '<i class="fas fa-check-circle text-success"></i> <a href="' . Href::redirect($Linker->build('stats_low_stock.php', 'action=setflag&flag=0&pID=' . $products['products_id'] . '&cPath=' . ($cPath ?? null)) . '"><i class="fas fa-times-circle text-muted"></i></a>';
Don't know but count 3 opening brackets in that but only 2 closing so maybe try:

Code: Select all

        echo '<i class="fas fa-check-circle text-success"></i> <a href="' . Href::redirect($Linker->build('stats_low_stock.php', 'action=setflag&flag=0&pID=' . $products['products_id'] . '&cPath=' . ($cPath ?? null))) . '"><i class="fas fa-times-circle text-muted"></i></a>';

Re: Updating older low stock reporting report

Posted: Thu Jun 13, 2024 1:16 pm
by ecartz

Code: Select all

        echo '<i class="fas fa-check-circle text-success"></i> <a href="' . Href::redirect($Linker->build('stats_low_stock.php', ['action' => 'setflag', 'flag' => '0', 'pID' => $products['products_id'], 'cPath' => ($cPath ?? null)])) . '"><i class="fas fa-times-circle text-muted"></i></a>';

Re: Updating older low stock reporting report

Posted: Thu Jun 13, 2024 1:21 pm
by 14Steve14
heatherbell wrote: Thu Jun 13, 2024 11:48 am Don't know but count 3 opening brackets in that but only 2 closing so maybe try:

Code: Select all

        echo '<i class="fas fa-check-circle text-success"></i> <a href="' . Href::redirect($Linker->build('stats_low_stock.php', 'action=setflag&flag=0&pID=' . $products['products_id'] . '&cPath=' . ($cPath ?? null))) . '"><i class="fas fa-times-circle text-muted"></i></a>';
I have been looking at that for ages and I couldnt see that. Thanks. Now on to the next section that needs updating.

Re: Updating older low stock reporting report

Posted: Thu Jun 13, 2024 4:21 pm
by raiwa
The low stock attributes report included in QtPro should work also without QtPro installed.

Re: Updating older low stock reporting report

Posted: Sat Jun 15, 2024 11:22 am
by 14Steve14
raiwa wrote: Thu Jun 13, 2024 4:21 pm The low stock attributes report included in QtPro should work also without QtPro installed.
Thanks for the suggestion.

It may need a bit more work that just those files as I get lots of missing files errors and things like that. When I get time I will have a look at the code if I may and try to adapt your code to fit with just a report tool. Might be above my pay grade but could be worth tyring just to see.

Re: Updating older low stock reporting report

Posted: Sat Jun 15, 2024 12:35 pm
by Omar_one
Hello @14Steve14 the module Zipur Reporting Tool app.php/addons/paid_addon/zipur_reporting_tool/ created by @zipurman have Inventory Low Report with filtering
reports.JPG
and a lot more
Customer No Orders Report – allowing you to search and remove old customers
Customer to Products Detail Report
Customer to Product Report
Inventory Low Report
Payment Method to Sales Report
Quantity Detail Report
Quantity Report (Product Sales)
Sales by Country Report
Sales by Currency
Sales Report (Gross)
Sales Report (Net)
Customer Abandoned Basket
Products Viewed Report
You can also:
Print text reports
Export to CSV
Run Graphical Reports
Write your own reports

Re: Updating older low stock reporting report

Posted: Mon Jun 17, 2024 4:39 pm
by 14Steve14
@Omar_one

I have those modules but I am trying to learn how to update things myself.