Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23
  1. #11
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,520
    Plugin Contributions
    88

    Default Re: script for thank you page

    So, you created the separate file (/includes/modules/pages/checkout_success/jscript_tracking.php) with the contents above. Now, on the checkout_success page, when "nothing happens" ... what does that mean?

  2. #12
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,520
    Plugin Contributions
    88

    Default Re: script for thank you page

    OK, after re-reviewing the header processing for the checkout_success page, I was using the wrong variables, having incorrectly assumed that an order-class element had been created. Give the following a go:
    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
      $products_info = $db->Execute ("SELECT products_model, products_name FROM " . TABLE_ORDERS_PRODUCTS . " WHERE orders_id = $order_id");
      while (!$products_info->EOF) {
    ?>
          window._tt.push({ event: "addItem", sku: "<?php echo $products_info->fields['products_model']; ?>" /* sku */, product_name: "<?php echo $products_info->fields['products_name']; ?>" /* product_name */ });
    <?php
        $products_info->MoveNext ();
      }
    ?>
          window._tt.push({ event: "orderSubmit"});
      </script>
    <?php
    }

  3. #13
    Join Date
    Jul 2012
    Posts
    16,735
    Plugin Contributions
    17

    Default Re: script for thank you page

    Part of why lat9 has asked that question s that the script provided basically gathers data together and provides it back to the "company" to provide additional tracking information. There are results that should be able to be reviewed, but the "nothing happens" description does not clearly identify 1) action taken to validate operation or 2) results of that action.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

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

    Default Re: script for thank you page

    the example script equipped by Trovaprezzi need to track shop by customer and invites to add reviews on trovaprezzi website
    Here you can find a guide to installation: https://tracking.trovaprezzi.it/guida.html
    So, the script edited by lat9 don't start, so if I open the ceckout_success source page, there is no trace of the code.
    Last edited by 100asa; 12 Feb 2016 at 06:37 PM.

  5. #15
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,520
    Plugin Contributions
    88

    Default Re: script for thank you page

    Does your store's template already load a version of jQuery >= 1.4?

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

    Default Re: script for thank you page

    yes, sure!

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

    Default Re: script for thank you page

    No new suggestions?

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

    Default Re: script for thank you page

    Hi again
    I did checked the code at vanila zen 154 and seems there are some typos so fixed version below

    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['customer_id'] . " LIMIT 1");
    if (!
    $customer_email_info->EOF) {
      
    $customers_email_address $customer_email_info->fields['customers_email_address'];

      
    $outputCode '';
      
    $outputCode .=
      <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: "'
    .$orders_id.'"});
          window._tt.push({ event: "setEmail", email: "'
    .$customers_email_address.'"});';

      
    $products_info $db->Execute ("SELECT products_model, products_name FROM " TABLE_ORDERS_PRODUCTS " WHERE orders_id = $orders_id");
      while (!
    $products_info->EOF) {
      
    $outputCode .='
          window._tt.push({ event: "addItem", sku: "'
    .$products_info->fields['products_model'].'" , product_name: "'.$products_info->fields['products_name'].'" });';

        
    $products_info->MoveNext ();
      }
      
    $outputCode .='
      window._tt.push({ event: "orderSubmit"});
      </script>'
    ;
     echo 
    $outputCode;
    }
    ?>

    I have added it at the bottom of includes/templates/yourtemplate/templates/tpl_checkout_success.php file, before closing </div> tag (I know this is dirty hardcoded way but it works so why bother if it is only single customisation)

    Remember to replace this tag /* keymerchant */ with your code.

    After this it shows up in source at checkout success page.
    Let us know how it works.

    Regards
    Tomek

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

    Default Re: script for thank you page

    Thank you so much @store-support: now my includes/templates/mytemplate/templates/tpl_ceckout_success_default.php is this
    PHP Code:
    <?php
    /**
     * Page Template
     *
     * Loaded automatically by index.php?main_page=checkout_success.<br />
     * Displays confirmation details after order has been successfully processed.
     *
     * @package templateSystem
     * @copyright Copyright 2003-2010 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: tpl_checkout_success_default.php 16435 2010-05-28 09:34:32Z drbyte $
     */
    ?>
    <div class="centerColumn" id="checkoutSuccess">
        <header>
            <h1 id="checkoutSuccessHeading"><?php echo HEADING_TITLE?></h1>
        </header>
        <div class="alert alert-success alert-dismissable">
            <?php echo TEXT_THANKS_FOR_SHOPPING?>
            <div id="checkoutSuccessOrderNumber"><?php echo TEXT_YOUR_ORDER_NUMBER $zv_orders_id?></div>
        </div>
        <!--bof logoff-->
        <div class="alert alert-info alert-dismissable">
            <?php
                
    if (isset($_SESSION['customer_guest_id'])) {
                    echo 
    TEXT_CHECKOUT_LOGOFF_GUEST;
                } elseif (isset(
    $_SESSION['customer_id'])) {
                    echo 
    TEXT_CHECKOUT_LOGOFF_CUSTOMER;
                }
            
    ?>
            <div class="buttonRow forward">
                <a href="<?php echo zen_href_link(FILENAME_LOGOFF'''SSL'); ?>"><?php echo zen_image_button(BUTTON_IMAGE_LOG_OFF BUTTON_LOG_OFF_ALT); ?>
                </a>
            </div>
        </div>
        <div class="alert alert-info alert-dismissable">
            <?php echo TEXT_SEE_ORDERS .'<br/>'TEXT_CONTACT_STORE_OWNER;?>
        </div>
        <!--bof -gift certificate- send or spend box-->
        <?php
        
    // only show when there is a GV balance
          
    if ($customer_has_gv_balance ) {
        
    ?>
        <div id="sendSpendWrapper">
            <?php require($template->get_template_dir('tpl_modules_send_or_spend.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_send_or_spend.php'); ?>
        </div>
        <?php
          
    }
        
    ?>
        <!--eof -gift certificate- send or spend box-->
        <!--eof logoff-->
        <div class="content">
            <?php if (DEFINE_CHECKOUT_SUCCESS_STATUS >= and DEFINE_CHECKOUT_SUCCESS_STATUS <= 2) { ?>
                <div id="checkoutSuccessMainContent">
                    <?php
                    
    /**
                     * require the html_defined text for checkout success
                     */
                      
    require($define_page);
                    
    ?>
                </div>
            <?php ?>
            <!-- bof payment-method-alerts -->
            <?php
                
    if (isset($_SESSION['payment_method_messages']) && $_SESSION['payment_method_messages'] != '') {
            
    ?>
                <div>
                    <?php echo $_SESSION['payment_method_messages']; ?>
                </div>
            <?php
            
    }
            
    ?>
            <!-- eof payment-method-alerts -->
        </div>
            <?php
            
    /**
             * The following creates a list of checkboxes for the customer to select if they wish to be included in product-notification
             * announcements related to products they've just purchased.
             **/
                
    if ($flag_show_products_notification == true) {
            
    ?>
        <div class="content">
            <div id="csNotifications">
                <h4><?php echo TEXT_NOTIFY_PRODUCTS?></h4>
                <?php echo zen_draw_form('order'zen_href_link(FILENAME_CHECKOUT_SUCCESS'action=update''SSL')); ?>
                <?php foreach ($notificationsArray as $notifications) { ?>
                    <?php echo zen_draw_checkbox_field('notify[]'$notifications['products_id'], true'id="notify-' $notifications['counter'] . '"') ;?>
                    <label class="checkboxLabel" for="<?php echo 'notify-' $notifications['counter']; ?>">
                        <?php echo $notifications['products_name']; ?>
                    </label>
                    <br />
                <?php ?>
                <div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_UPDATEBUTTON_UPDATE_ALT); ?></div>
                </form>
            </div>
        </div>
                <?php
                    
    }
                
    ?>
        <!--eof -product notifications box-->
        <!--bof -product downloads module-->
        <?php
          
    if (DOWNLOAD_ENABLED == 'true') require($template->get_template_dir('tpl_modules_downloads.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_downloads.php');
        
    ?>
        <!--eof -product downloads module-->
    </div>

    <?php if (MODULE_BARCODE_ORDERS_SWITCH == 'true') { ?>
    <div id="checkoutSuccessOrdersBarcode">
      <fieldset>
        <legend><?php echo TABLE_HEADING_ORDERS_BARCODE?></legend>
        <?php echo TEXT_ORDERS_BARCODE?><br />
        <?php echo '<img src="' DIR_WS_CATALOG 'barcode/barcode.php?code=' $_SESSION['orders_barcode'] . '&scale=' . (int)MODULE_BARCODE_SCALE '"></img>'?>
      </fieldset> 

    <?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['customer_id'] . " LIMIT 1");
    if (!
    $customer_email_info->EOF) {
    $customers_email_address $customer_email_info->fields['customers_email_address'];

    $outputCode '';
    $outputCode .='
    <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: "xxxxx" });
    window._tt.push({ event: "setOrderId", order_id: "'
    .$orders_id.'"});
    window._tt.push({ event: "setEmail", email: "'
    .$customers_email_address.'"});';

    $products_info $db->Execute ("SELECT products_model, products_name FROM " TABLE_ORDERS_PRODUCTS " WHERE orders_id = $orders_id");
    while (!
    $products_info->EOF) {
    $outputCode .='
    window._tt.push({ event: "addItem", sku: "'
    .$products_info->fields['products_model'].'" , product_name: "'.$products_info->fields['products_name'].'" });';

    $products_info->MoveNext ();
    }
    $outputCode .='
    window._tt.push({ event: "orderSubmit"});
    </script>'
    ;
    echo 
    $outputCode;
    }
    ?>

    </div>
    <?php ?>
    but nothing appear, and on ceckout_success source page nothing found as "trovaprezzi"

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

    Default Re: script for thank you page

    Hi
    You need to add it into tpl_checkout_success_default.php (typo?) and closing <?php } ?> should be before </div>, then refresh success page and check source code at bottom.

    Also are You sure you are adding it into proper template?

 

 
Page 2 of 3 FirstFirst 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

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR