Showing Zen Cart Customer Updates needed by Salesforce

If you’ve installed my Zen Cart to Salesforce Customer Import tool, and done a few exports of customers from your admin, you’d probably like an easy way to see how many updates (if any) are outstanding when you login to your Zen Admin.

I have made a small modification to the admin dashboard (in Zen Cart 1.5.5) to do this, which is described below.  Steps:

a) Add the define BOX_ENTRY_UPDATES_TO_SALESFORCE to admin/includes/languages/english/index.php.

define('BOX_ENTRY_UPDATES_TO_SALESFORCE','New/Updated records for Salesforce');

b) Add the logic to calculate and display the number of new/updated records to admin/index_dashboard.php.

Calculate it below the salemaker query on line 31:

$last_export = $db->Execute("SELECT * FROM " . TABLE_SFDC_CONFIG);
$last_customers_export = $last_export->fields['last_customers_export'];
$salesforce_customers_query = "SELECT count(*) AS count FROM " . 
   TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " a, " . 
   TABLE_CUSTOMERS_INFO . " ci WHERE a.customers_id = c.customers_id 
   AND a.address_book_id = c.customers_default_address_id AND 
   ci.customers_info_id = c.customers_id AND 
   (ci.customers_info_date_account_created > '" . 
   $last_customers_export . "' OR 
   ci.customers_info_date_account_last_modified > '" . 
   $last_customers_export . "')";
$salesforce = $db->Execute($salesforce_customers_query);

Now display it below the customers count display on line 72:

 
echo '<div class="row"><span class="left">
   <a href="' . zen_href_link(FILENAME_SFDC_EXPORT_CUSTOMERS) . '">' . 
   BOX_ENTRY_UPDATES_TO_SALESFORCE . '</a></span>
   <span class="rigth"> ' . $salesforce->fields['count'] . '</span></div>';

The typo in the class name right is required in Zen Cart 1.5.5; it has been fixed in Zen Cart 1.5.6.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.