Page 1 of 3 123 LastLast
Results 1 to 10 of 23
  1. #1
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    634
    Plugin Contributions
    0

    Default script for thank you page

    A service for trusted reviews have asked me to add this code
    PHP Code:
    <script type="text/javascript" src="https://tracking.trovaprezzi.it/javascripts/tracking.min.js" async="true"></script>

      <script type="text/javascript">
          window._tt = window._tt || [];
          window._tt.push({ event: "setAccount", id: /* keymerchant */ });
          window._tt.push({ event: "setOrderId", order_id: /* idorder */ });
          window._tt.push({ event: "setEmail", email: /* emailcucstomer */ });
          window._tt.push({ event: "addItem", sku: /* sku */, product_name: /* product_name */ });
          window._tt.push({ event: "orderSubmit"});
      </script> 
    They asked me to put this code into thank you page.
    Where can I put this code into zencart?
    Many thanks to who help me.

  2. #2
    Join Date
    Apr 2014
    Location
    Polska
    Posts
    20
    Plugin Contributions
    0

    Default Re: script for thank you page

    Hi
    You can add it at the bottom of includes/templates/yourtemplate/templates/tpl_checkout_success.php file, just remember to replace these tags /* keymerchant */ ... with proper zencart variables.

  3. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,872
    Plugin Contributions
    96

    Default Re: script for thank you page

    Create the file /includes/modules/pages/checkout_success/jscript_tracking.php that contains:
    Code:
    <?php
    //-Add the tracking script only for the checkout_success page
    ?>
      <script type="text/javascript" src="https://tracking.trovaprezzi.it/javascripts/tracking.min.js" async="true"></script>
    
      <script type="text/javascript">
          window._tt = window._tt || [];
          window._tt.push({ event: "setAccount", id: /* keymerchant */ });
          window._tt.push({ event: "setOrderId", order_id: /* idorder */ });
          window._tt.push({ event: "setEmail", email: /* emailcucstomer */ });
          window._tt.push({ event: "addItem", sku: /* sku */, product_name: /* product_name */ });
          window._tt.push({ event: "orderSubmit"});
      </script>

  4. #4
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    634
    Plugin Contributions
    0

    Default Re: script for thank you page

    Ok, thanks. But how can retrieve the orderID, custoemr email and product_name (sku)?

  5. #5
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    634
    Plugin Contributions
    0

    Default Re: script for thank you page

    you can see an example here: https://tracking.trovaprezzi.it/guida.html

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,872
    Plugin Contributions
    96

    Default Re: script for thank you page

    That will need a bit more processing, similar to:
    Code:
    <?php
    //-Add the tracking script only for the checkout_success page
    $customer_email_info = $db->Execute ("SELECT customers_email_address FROM " . TABLE_CUSTOMERS . " WHERE customers_id = " . (int)$_SESSION['customers_id'] . " LIMIT 1");
    if (!$customer_email_info->EOF) {
      $customers_email_address = $customer_email_info->fields['customers_email_address'];
    ?>
      <script type="text/javascript" src="https://tracking.trovaprezzi.it/javascripts/tracking.min.js" async="true"></script>
    
      <script type="text/javascript">
          window._tt = window._tt || [];
          window._tt.push({ event: "setAccount", id: /* keymerchant */ });
          window._tt.push({ event: "setOrderId", <?php echo $order_id; ?>: /* idorder */ });
          window._tt.push({ event: "setEmail", "<?php echo $customers_email_address; ?>": /* emailcucstomer */ });
    <?php
      foreach ($orders->products as $current_product) {
    ?>
          window._tt.push({ event: "addItem", "<?php echo $current_product['model']; ?>": /* sku */, "<?php echo $current_product['name']; ?>": /* product_name */ });
    <?php
      }
    ?>
          window._tt.push({ event: "orderSubmit"});
      </script>
    <?php
    }
    Please note that the item-related output will most likely fail if you have a product that doesn't have a model number. You'll need to "hardcode" whatever your merchant account key is into the id spot; make sure to enclose it in quotes, e.g. "XYZZY-001".

  7. #7
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    634
    Plugin Contributions
    0

    Default Re: script for thank you page

    sorry, but the variables to substitute with zencart values are enclosed into /* */
    as /* idorder */ and /* emailcustomer */ .....

  8. #8
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,872
    Plugin Contributions
    96

    Default Re: script for thank you page

    How's this:
    Code:
    <?php
    //-Add the tracking script only for the checkout_success page
    $customer_email_info = $db->Execute ("SELECT customers_email_address FROM " . TABLE_CUSTOMERS . " WHERE customers_id = " . (int)$_SESSION['customers_id'] . " LIMIT 1");
    if (!$customer_email_info->EOF) {
      $customers_email_address = $customer_email_info->fields['customers_email_address'];
    ?>
      <script type="text/javascript" src="https://tracking.trovaprezzi.it/javascripts/tracking.min.js" async="true"></script>
    
      <script type="text/javascript">
          window._tt = window._tt || [];
          window._tt.push({ event: "setAccount", id: /* keymerchant */ });
          window._tt.push({ event: "setOrderId", order_id: <?php echo $order_id; ?> /* idorder */ });
          window._tt.push({ event: "setEmail", email: "<?php echo $customers_email_address; ?>" /* emailcucstomer */ });
    <?php
      foreach ($orders->products as $current_product) {
    ?>
          window._tt.push({ event: "addItem", sku: "<?php echo $current_product['model']; ?>" /* sku */, product_name: "<?php echo $current_product['name']; ?>" /* product_name */ });
    <?php
      }
    ?>
          window._tt.push({ event: "orderSubmit"});
      </script>
    <?php
    }

  9. #9
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    634
    Plugin Contributions
    0

    Default Re: script for thank you page

    Thank you so much for your help!
    I wait for the mechant-key from Trovaprezzi search engine, and then let you know if your script works well.

  10. #10
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    634
    Plugin Contributions
    0

    Default Re: script for thank you page

    PHP Code:
    <?php
    //-Add the tracking script only for the checkout_success page
    $customer_email_info $db->Execute ("SELECT customers_email_address FROM " TABLE_CUSTOMERS " WHERE customers_id = " . (int)$_SESSION['customers_id'] . " LIMIT 1");
    if (!
    $customer_email_info->EOF) {
      
    $customers_email_address $customer_email_info->fields['customers_email_address'];
    ?>
      <script type="text/javascript" src="https://tracking.trovaprezzi.it/javascripts/tracking.min.js" async="true"></script>

      <script type="text/javascript">
          window._tt = window._tt || [];
          window._tt.push({ event: "setAccount", id: "RMUnJ1SUw1" });
          window._tt.push({ event: "setOrderId", order_id: "<?php echo $order_id?>" });
          window._tt.push({ event: "setEmail", email: "<?php echo $customers_email_address?>"  });
    <?php
      
    foreach ($orders->products as $current_product) {
    ?>
          window._tt.push({ event: "addItem", sku: "<?php echo $current_product['model']; ?>" , product_name: "<?php echo $current_product['name']; ?>" });
    <?php
      
    }
    ?>
          window._tt.push({ event: "orderSubmit"});
      </script>
    <?php
    }
    but nothing happens

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. Replies: 10
    Last Post: 26 Mar 2016, 02:53 AM
  2. Admin Page - "Hello. Thank you for loading Zen Cart" - OH help!
    By iwalkonstars in forum Basic Configuration
    Replies: 9
    Last Post: 1 Jun 2014, 07:53 PM
  3. How do you add text to last Thank You page after purchase complete?
    By catangirl in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 24 Sep 2007, 10:25 PM
  4. Thank you page
    By DanAllkins in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 15 Sep 2007, 10:40 PM
  5. Where is HTML for order confirmation/thank you page?
    By chacha-vintage in forum General Questions
    Replies: 0
    Last Post: 22 Aug 2007, 10:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg