Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22
  1. #11
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    8,646
    Plugin Contributions
    9

    Default Re: Most-Viewed Products - Reports

    Have at least two sites with identical files but, the report for one gives the date dropdown in (apparently) chinese.

    Haven't been able to find a differing file between the two yet, the different date pull-down.

  2. #12
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,444
    Plugin Contributions
    29

    Default Re: Most-Viewed Products - Reports

    When you said chinese, I didn't understand you actually meant chinese!
    Can you post an image?
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto, Product Listing Sorter...

  3. #13
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    8,646
    Plugin Contributions
    9

    Default Re: Most-Viewed Products - Reports

    Here ya go.

    Name:  Screenshot 2022-09-16 131453.jpg
Views: 35
Size:  29.7 KB

  4. #14
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    8,853
    Plugin Contributions
    118

    Default Re: Most-Viewed Products - Reports

    If I hadn't seen it, I wouldn't have believed it.

    But this is specific to your installation, not a bug in Zen Cart.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  5. #15
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    8,646
    Plugin Contributions
    9

    Default Re: Most-Viewed Products - Reports

    It's just that I have compared all our sites using this mod and all are using files that are exactly the same.

    Very open to suggestions as to where it may have come from or what files might be involved.


  6. #16
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,444
    Plugin Contributions
    29

    Default Re: Most-Viewed Products - Reports

    Are all those characters chinese (or other asian language) equivalents to what should be there?
    Or are they unrelated characters that are the character represented by whatever extended-ascii bit pattern is getting to the browser?

    If the files are identical, it must be an environment issue, (*nix/windows, mysql, php versions and their defaults).
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto, Product Listing Sorter...

  7. #17
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    8,646
    Plugin Contributions
    9

    Default Re: Most-Viewed Products - Reports

    All tested sites are on the same server with same PHP

  8. #18
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    8,853
    Plugin Contributions
    118

    Default Re: Most-Viewed Products - Reports

    This guy thinks it's localization gone wrong:

    https://forum.jquery.com/topic/datep...issue-7-5-2010
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  9. #19
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    8,646
    Plugin Contributions
    9

    Default Re: Most-Viewed Products - Reports

    This is the culprit
    1.5.7d No Chinese but date changes on second page
    Code:
    <?php/**
     * @copyright Copyright 2003-2020 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: DrByte 2020 May 17 Modified in v1.5.7 $
     */
    
    
    require 'includes/application_top.php';
    
    
    if (!function_exists('makeUnixTimestampFromDate')) {
        function makeUnixTimestampFromDate($input, $format)
        {
            if (strtolower($format) == 'mm/dd/yyyy') {
                // Use US date format (m/d/Y)
                return mktime(0, 0, 0, (int)substr($input, 0, 2), (int)substr($input, 3, 2), (int)substr($input, 6, 4));
            }
            if (strtolower($format) == 'dd/mm/yyyy') {
                // Use UK date format (d/m/Y)
                return mktime(0, 0, 0, (int)substr($input, 3, 2), (int)substr($input, 0, 2), (int)substr($input, 6, 4));
            }
            if (strtolower($format) == 'dd.mm.yyyy') {
                // Use CZ, SK date format (d/m/Y)
                return mktime(0, 0, 0, (int)substr($input, 3, 2), (int)substr($input, 0, 2), (int)substr($input, 6, 4));
            }
        }
    }
    
    
    $convertedFormat = str_replace(['mm', 'MM', 'dd', 'yyyy'], ['m', 'm', 'd', 'Y'], DATE_FORMAT_SPIFFYCAL);
    $startdate = makeUnixTimestampFromDate(date($convertedFormat, strtotime('-30 days')), DATE_FORMAT_SPIFFYCAL);
    $enddate = makeUnixTimestampFromDate(date($convertedFormat), DATE_FORMAT_SPIFFYCAL);
    if (!empty($_POST['start_date'])) $startdate = makeUnixTimestampFromDate(zen_db_input($_POST['start_date']), DATE_FORMAT_SPIFFYCAL);
    if (!empty($_POST['end_date'])) $enddate = makeUnixTimestampFromDate(zen_db_input($_POST['end_date']), DATE_FORMAT_SPIFFYCAL);
    
    
    
    
    $sql = "SELECT p.products_id, pd.products_name, sum(v.views) as total_views, l.name as language, p.products_type, pt.type_handler, pt.allow_add_to_cart
            FROM " . TABLE_PRODUCTS . " p
            LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON p.products_id = pd.products_id
            LEFT JOIN " . TABLE_LANGUAGES . " l ON l.languages_id = pd.language_id
            INNER JOIN " . TABLE_COUNT_PRODUCT_VIEWS . " v ON p.products_id = v.product_id AND v.language_id = l.languages_id
            LEFT JOIN " . TABLE_PRODUCT_TYPES . " pt ON p.products_type = pt.type_id
            WHERE date_viewed BETWEEN CAST(:startdate AS DATE) AND CAST(:enddate AS DATE)
            GROUP BY p.products_id, pd.products_name, language, p.products_type, pt.type_handler, pt.allow_add_to_cart
            ORDER BY total_views DESC";
    $sql = $db->bindVars($sql, ':startdate', date('Y-m-d', $startdate), 'string');
    $sql = $db->bindVars($sql, ':enddate', date('Y-m-d', $enddate), 'string');
    $products_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_REPORTS, $sql, $products_query_numrows);
    $products = $db->Execute($sql);
    
    
    ?>
        <!doctype html>
        <html <?php echo HTML_PARAMS; ?>>
        <head>
            <?php require DIR_WS_INCLUDES . 'admin_html_head.php'; ?>
            <link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">
            <script src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>
            <script>
                var StartDate = new ctlSpiffyCalendarBox("StartDate", "date_range", "start_date", "btnDate1", "<?php echo date($convertedFormat, $startdate); ?>", scBTNMODE_CUSTOMBLUE);
                var EndDate = new ctlSpiffyCalendarBox("EndDate", "date_range", "end_date", "btnDate2", "<?php echo date($convertedFormat, $enddate); ?>", scBTNMODE_CUSTOMBLUE);
            </script>
        </head>
        <body>
        <!-- header //-->
        <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
        <!-- header_eof //-->
        <div id="spiffycalendar" class="text"></div>
        <div class="container-fluid">
            <!-- body //-->
            <h1 class="pageHeading"><?php echo HEADING_TITLE; ?></h1>
    
    
    
    
            <div class="row">
                <?php echo zen_draw_form('date_range', FILENAME_STATS_PRODUCTS_VIEWED, '', 'post', 'onsubmit="return check_dates(start_date, StartDate.required, end_date, EndDate.required);" class="form-horizontal"'); ?>
    
    
                <div class="form-group">
                    <?php echo zen_draw_label(TEXT_REPORT_START_DATE, 'start_date', 'class="col-sm-3 control-label"'); ?>
                    <div class="col-sm-4 col-md-3">
                        <script>StartDate.writeControl();
                            StartDate.dateFormat = "<?php echo DATE_FORMAT_SPIFFYCAL; ?>";
                        </script>
                    </div>
                </div>
                <div class="form-group">
                    <?php echo zen_draw_label(TEXT_REPORT_END_DATE, 'end_date', 'class="col-sm-3 control-label"'); ?>
                    <div class="col-sm-4 col-md-3">
                        <script>EndDate.writeControl();
                            EndDate.dateFormat = "<?php echo DATE_FORMAT_SPIFFYCAL; ?>";
                        </script>
                    </div>
                </div>
    
    
                <div class="col-sm-7 col-md-6 text-right">
                    <button type="submit" class="btn btn-primary"><?php echo IMAGE_SUBMIT; ?></button>
                </div>
    
    
                <?php echo '</form>'; ?>
            </div>
    <br>
    
    
            <table class="table table-hover">
                <thead>
                <tr class="dataTableHeadingRow">
                    <th class="dataTableHeadingContent right"><?php echo TABLE_HEADING_NUMBER; ?></th>
                    <th class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></th>
                    <th class="dataTableHeadingContent text-center"><?php echo TABLE_HEADING_VIEWED; ?></th>
                </tr>
                </thead>
                <tbody>
                <?php
                foreach ($products as $product) {
                    $cPath = zen_get_product_path($product['products_id']);
                    $type_handler = $product['type_handler'] . '.php';
                    ?>
                    <tr class="dataTableRow"
                        onclick="document.location.href = '<?php echo zen_href_link($type_handler, '&product_type=' . $product['products_type'] . '&cPath=' . $cPath . '&pID=' . $product['products_id'] . '&action=new_product'); ?>'">
                        <td class="dataTableContent text-right"><?php echo $product['products_id']; ?></td>
                        <td class="dataTableContent">
                            <a href="<?php echo zen_href_link($type_handler, '&product_type=' . $product['products_type'] . '&cPath=' . $cPath . '&pID=' . $product['products_id'] . '&action=new_product'); ?>"><?php echo $product['products_name']; ?></a>
                            (<?php echo $product['language']; ?>)
                        </td>
                        <td class="dataTableContent text-center"><?php echo $product['total_views']; ?></td>
                    </tr>
                    <?php
                }
                ?>
                </tbody>
            </table>
            <table class="table">
                <tr>
                    <td><?php echo $products_split->display_count($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_REPORTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
                    <td class="text-right"><?php echo $products_split->display_links($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_REPORTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
                </tr>
            </table>
            <!-- body_text_eof //-->
            <!-- body_eof //-->
        </div>
        <!-- footer //-->
        <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
        <!-- footer_eof //-->
        </body>
        </html>
    <?php require(DIR_WS_INCLUDES . 'application_bottom.php');
    1.5.8 No date change but Chinese
    Code:
    <?php/**
     * @copyright Copyright 2003-2022 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: Scott C Wilson 2022 Jan 25 Modified in v1.5.8-alpha $
     */
    
    
    require 'includes/application_top.php';
    
    
    if (!function_exists('makeUnixTimestampFromDate')) {
        function makeUnixTimestampFromDate($input, $format)
        {
            if (strtolower($format) == 'mm/dd/yyyy') {
                // Use US date format (m/d/Y)
                return mktime(0, 0, 0, (int)substr($input, 0, 2), (int)substr($input, 3, 2), (int)substr($input, 6, 4));
            }
            if (strtolower($format) == 'dd/mm/yyyy') {
                // Use UK date format (d/m/Y)
                return mktime(0, 0, 0, (int)substr($input, 3, 2), (int)substr($input, 0, 2), (int)substr($input, 6, 4));
            }
            if (strtolower($format) == 'dd.mm.yyyy') {
                // Use CZ, SK date format (d/m/Y)
                return mktime(0, 0, 0, (int)substr($input, 3, 2), (int)substr($input, 0, 2), (int)substr($input, 6, 4));
            }
        }
    }
    
    
    $startdate  = zen_db_input($_REQUEST['start_date'] ?? date('Y') . '-01-01');
    $enddate = zen_db_input($_REQUEST['end_date'] ?? date('Y-m-d'));
    
    
    $sql = "SELECT p.products_id, pd.products_name, sum(v.views) as total_views, l.name as language, p.products_type, pt.type_handler, pt.allow_add_to_cart
            FROM " . TABLE_PRODUCTS . " p
            LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON p.products_id = pd.products_id
            LEFT JOIN " . TABLE_LANGUAGES . " l ON l.languages_id = pd.language_id
            INNER JOIN " . TABLE_COUNT_PRODUCT_VIEWS . " v ON p.products_id = v.product_id AND v.language_id = l.languages_id
            LEFT JOIN " . TABLE_PRODUCT_TYPES . " pt ON p.products_type = pt.type_id
            WHERE date_viewed BETWEEN CAST(:startdate AS DATE) AND CAST(:enddate AS DATE)
            GROUP BY p.products_id, pd.products_name, language, p.products_type, pt.type_handler, pt.allow_add_to_cart
            ORDER BY total_views DESC";
    $sql = $db->bindVars($sql, ':startdate', $startdate, 'string');
    $sql = $db->bindVars($sql, ':enddate', $enddate, 'string');
    
    
    $products_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_REPORTS, $sql, $products_query_numrows);
    $products = $db->Execute($sql);
    
    
    ?>
        <!doctype html>
        <html <?php echo HTML_PARAMS; ?>>
        <head>
            <?php require DIR_WS_INCLUDES . 'admin_html_head.php'; ?>
        </head>
        <body>
        <!-- header //-->
        <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
        <!-- header_eof //-->
        <div class="container-fluid">
            <!-- body //-->
            <h1 class="pageHeading"><?php echo HEADING_TITLE; ?></h1>
    
    
    
    
            <div class="row">
                <?php echo zen_draw_form('date_range', FILENAME_STATS_PRODUCTS_VIEWED, '', 'post', 'class="form-horizontal"'); ?>
    
    
                <div class="form-group">
                    <?php echo zen_draw_label(TEXT_REPORT_START_DATE, 'start_date', 'class="col-sm-3 control-label"'); ?>
                    <div class="col-sm-4 col-md-3">
                        <div class="date input-group" id="datepicker_start_date">
                    <span class="input-group-addon datepicker_icon">
                      <i class="fa fa-calendar fa-lg"></i>
                    </span>
                            <?php echo zen_draw_input_field('start_date', $startdate, 'class="form-control" id="start_date"'); ?>
                        </div>
                        <span class="help-block errorText">(<?php echo zen_datepicker_format_full(); ?>)</span>
                    </div>
                </div>
                <div class="form-group">
                    <?php echo zen_draw_label(TEXT_REPORT_END_DATE, 'end_date', 'class="col-sm-3 control-label"'); ?>
                    <div class="col-sm-4 col-md-3">
                        <div class="date input-group" id="datepicker_end_date">
                    <span class="input-group-addon datepicker_icon">
                      <i class="fa fa-calendar fa-lg"></i>
                    </span>
                            <?php echo zen_draw_input_field('end_date', $enddate, 'class="form-control" id="end_date"'); ?>
                        </div>
                        <span class="help-block errorText">(<?php echo zen_datepicker_format_full(); ?>)</span>
                    </div>
                </div>
    
    
    
    
                <div class="col-sm-7 col-md-6 text-right">
                    <button type="submit" class="btn btn-primary"><?php echo IMAGE_SUBMIT; ?></button>
                </div>
    
    
                <?php echo '</form>'; ?>
            </div>
    <br>
    
    
            <table class="table table-hover">
                <thead>
                <tr class="dataTableHeadingRow">
                    <th class="dataTableHeadingContent right"><?php echo TABLE_HEADING_PRODUCTS_ID; ?></th>
                    <th class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_NAME; ?></th>
                    <th class="dataTableHeadingContent text-center"><?php echo TABLE_HEADING_VIEWED; ?></th>
                </tr>
                </thead>
                <tbody>
                <?php
                foreach ($products as $product) {
                    $cPath = zen_get_product_path($product['products_id']);
                    $type_handler = $product['type_handler'] . '.php';
                    ?>
                    <tr class="dataTableRow"
                        onclick="document.location.href = '<?php echo zen_href_link(FILENAME_PRODUCT, '&product_type=' . $product['products_type'] . '&cPath=' . $cPath . '&pID=' . $product['products_id'] . '&action=new_product'); ?>'">
                        <td class="dataTableContent text-right"><?php echo $product['products_id']; ?></td>
                        <td class="dataTableContent">
                            <a href="<?php echo zen_href_link(FILENAME_PRODUCT, '&product_type=' . $product['products_type'] . '&cPath=' . $cPath . '&pID=' . $product['products_id'] . '&action=new_product'); ?>"><?php echo $product['products_name']; ?></a>
                            (<?php echo $product['language']; ?>)
                        </td>
                        <td class="dataTableContent text-center"><?php echo $product['total_views']; ?></td>
                    </tr>
                    <?php
                }
                ?>
                </tbody>
            </table>
            <table class="table">
                <tr>
                    <td><?php echo $products_split->display_count($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_REPORTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
                    <td class="text-right"><?php echo $products_split->display_links($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_REPORTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], 'start_date=' . $startdate . '&end_date=' . $enddate); ?></td>
                </tr>
            </table>
            <!-- body_text_eof //-->
            <!-- body_eof //-->
        </div>
        <!-- footer //-->
        <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
        <!-- footer_eof //-->
        <!-- script for datepicker -->
        <script>
            $(function () {
                $('input[name="start_date"]').datepicker();
                $('input[name="end_date"]').datepicker();
            })
        </script>
        </body>
        </html>
    <?php require(DIR_WS_INCLUDES . 'application_bottom.php');

  10. #20
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    8,853
    Plugin Contributions
    118

    Default Re: Most-Viewed Products - Reports

    1.5.7 uses spiffyCal.
    1.5.8 uses jQuery DatePicker.
    Did you look at the link I sent you about jQuery DatePicker?
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

 

 
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. v157 Reports / Products Viewed
    By johns4y in forum General Questions
    Replies: 1
    Last Post: 7 Apr 2021, 09:45 AM
  2. Most Viewed Pages...?
    By gaffettape in forum General Questions
    Replies: 0
    Last Post: 30 Jul 2010, 07:09 PM
  3. People who viewed this also viewed For Zen Cart?
    By CoolCarPartsOnline in forum General Questions
    Replies: 3
    Last Post: 26 May 2009, 02:04 AM
  4. most viewed
    By 100asa in forum Addon Sideboxes
    Replies: 5
    Last Post: 15 Sep 2008, 03:16 PM
  5. Reports Products viewed - What file to edit?
    By crosswraith in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 28 Oct 2007, 04:07 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