You are here:  » Display Records and Page Count in Automation Tool


Display Records and Page Count in Automation Tool

Submitted by ItsDavid on Fri, 2016-09-09 05:27 in

Hi David hope all is well,

As you know i generally use price tapestry for downloading web service and API feeds so i was wondering if it is possible for me to be able to display the records and pages count in the automation tool "Current Jobs" page to the right of "OK" after running the import?

Basically i would like to display "OK |Records: 123 |Pages 1 of xx"

Thanks for any help you can provide with this.

Submitted by support on Fri, 2016-09-09 09:06

Hi David,

Sure you could show product count / number of pages on the Automation Tool page - first look for the following code at line 14:

  if (database_querySelect($sql,$rows))

...and REPLACE with:

  $sql = "SELECT filename,products FROM `".$config_databaseTablePrefix."feeds`";
  if (database_querySelect($sql,$rows))
  {
    foreach($rows as $row)
    {
      $products[$row["filename"]] = $row["products"];
    }
  }
  $sql = "SELECT * FROM `".$config_databaseTablePrefix."jobs` ORDER BY directory,filename";
  if (database_querySelect($sql,$rows))

Then look for the following code at line 32:

    print "</tr>";

...and REPLACE with:

    print "<th>".translate("Products (Pages)")."</th>";
    print "</tr>";

...and finally the following code at line 58:

      print "</tr>";

...and REPLACE with:

      $count = (isset($products[$job["filename"]])?$products[$job["filename"]]:0);
      print "<td>".($count?$count." (".ceil($count/$config_resultsPerPage).")":"&nbsp;")."</td>";
      print "</tr>";

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by ItsDavid on Sat, 2016-09-10 00:49

Hi David, I made the modifications as noted above and it has added

Status Products (Pages)

to the top of the table however it is not counting number of pages or records in the downloaded XML file.

Looking at the code i am thinking the code above is looking for a database of products and pages to count?

If that is the case it would explain the problem because i don't import anything into a database i just use it to download and create an XML file from a web service API.

So i would like to count the number of pages available for a specific query url and the records count within that file.

Is this possible?

Submitted by ItsDavid on Sat, 2016-09-10 00:59

I thought maybe this would help explain my question better.

In my downloaded XML file it would look like this

So is there a way to display this information next to the "OK" in the automation tool?

So without having to open the file i would see there are

"7511411 Total Products Available" - "500 Records Returned" - "Page Number 1"

So this information would have to be pulled from the XML file i have downloaded and not a database.

Hope this explains it better

Submitted by support on Sat, 2016-09-10 08:59

Hello David,

Ah, I understand - not easily i'm afraid if you are working with multiple formats but if they are all the same and the required meta data is in a header section at the top it would be more straight forward.

Please could you email me (zipped if possible if large) an example of one of the files fetched and I'll take a look for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by ItsDavid on Sun, 2016-09-11 00:41

Some of the files provide the information and some don't but i will send you an email.

Thank You