Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Apr 2009
    Posts
    155
    Plugin Contributions
    1

    Default Query to Alternate Row Colors in Download Table

    I'd like to change my downloads table in 1.3.8a to display alternating row colors. I've been working with tpl_modules_downloads to try and accomplish that, but I'm stuck at the proper query for <tr class>. I found some threads asking the same thing about the ProductListing table, but I couldn't seem to successfully adapt the code to the downloads table.

    Thanks a bunch for your help! :)

  2. #2
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Query to Alternate Row Colors in Download Table

    Quote Originally Posted by ToniScraparoni View Post
    I'd like to change my downloads table in 1.3.8a to display alternating row colors. I've been working with tpl_modules_downloads to try and accomplish that, but I'm stuck at the proper query for <tr class>. I found some threads asking the same thing about the ProductListing table, but I couldn't seem to successfully adapt the code to the downloads table.

    Thanks a bunch for your help! :)
    As far as the product listing table goes the effect is created by css. The classes for alternate rows are included in the code so it is just a matter of writing two css rules.

    The classes are :

    Code:
    .productListing-odd
    .productListing-even
    Unfortunately, as far as tpl_modules_downloads goes there are not corresponding classes built into the existing code. With a bit of PHP you could easily add an incremented variable to the 'while' and use that to add a class to the <tr> based on whether the incremented variable was odd or even. Then stlye those new classes in the css.

    If that seems a bit confusing email me (click on my name to the left) and I'll get into it with you.

    Nik

  3. #3
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Query to Alternate Row Colors in Download Table

    I can't test this at the moment but what I am talking about is something like the edits is the following code:

    Code:
    <!-- list of products -->
    
    <?php
    
        $AAA=0//NICCOL
        while (!$downloads->EOF) {
        $AAA++;//NICCOL
        $AAF= floor($AAA/2);//NICCOL
        if ($AAF=($AAA/2){$row_class="download-even";}//NICCOL
        else{$row_class="download-odd";}//NICCOL
    
    // MySQL 3.22 does not have INTERVAL
          list($dt_year, $dt_month, $dt_day) = explode('-', $downloads->fields['date_purchased_day']);
          $download_timestamp = mktime(23, 59, 59, $dt_month, $dt_day + $downloads->fields['download_maxdays'], $dt_year);
          $download_expiry = date('Y-m-d H:i:s', $download_timestamp);
    
          $is_downloadable = ( (file_exists(DIR_FS_DOWNLOAD . $downloads->fields['orders_products_filename']) && (($downloads->fields['download_count'] > 0 && $download_timestamp > time()) || $downloads->fields['download_maxdays'] == 0)) ) ? true : false;
          $zv_filesize = filesize (DIR_FS_DOWNLOAD . $downloads->fields['orders_products_filename']);
          if ($zv_filesize >= 1024) {
            $zv_filesize = number_format($zv_filesize/1024/1024,2);
            $zv_filesize_units = TEXT_FILESIZE_MEGS;
          } else {
            $zv_filesize = number_format($zv_filesize);
            $zv_filesize_units = TEXT_FILESIZE_BYTES;
          }
    ?>
              <tr class="tableRow<?php echo ' '.$row_class; ?>">
    <!-- left box -->
    If you compare it to your existing file you should see which bits to add. That should create two new classes in the code. The classes will be:

    .download-even
    .download-odd

    But as I say I am not in a position to test this so it may have lots of typos in it. But the theory should work. Got to sleep now :-)

    Nik

  4. #4
    Join Date
    Apr 2009
    Posts
    155
    Plugin Contributions
    1

    Default Re: Query to Alternate Row Colors in Download Table

    Hi, Nik!

    Thanks for trying to help me. It doesn't work. LOL! I think there might be a parentheses missing, but it doesn't matter where I insert it ... adding this code widens the table so it covers the entire right column, with no changes to row background color. I had been trying to tie in with the classes rowOdd and rowEven, already in the stylesheet.

    Thanks a bunch! Hope you're having sweet Zen dreams and the fix will come to you by [your] morning. ;)

  5. #5
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Query to Alternate Row Colors in Download Table

    Sorry about that. I guess that is what comes of writing code late at night and not being ale to test it :-) I'll look at it later today when I will be able to test it. A URL would help.

  6. #6
    Join Date
    Apr 2009
    Posts
    155
    Plugin Contributions
    1

    Default Re: Query to Alternate Row Colors in Download Table

    Hi, Nik!

    Got your email, will reply. TY! :)

 

 

Similar Threads

  1. v153 Digital download product: shipping added on alternate attribute option
    By RixStix in forum Built-in Shipping and Payment Modules
    Replies: 8
    Last Post: 15 Feb 2015, 01:07 AM
  2. Download Folder on alternate server?
    By bowserhound in forum General Questions
    Replies: 2
    Last Post: 7 Jun 2010, 03:24 AM
  3. Product Grid Layout - Alternating row colors
    By samkarpluk in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 29 Sep 2007, 09:05 PM
  4. Odd & Even Row Colors, Duplicating a Category
    By splinter79 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 20 Oct 2006, 03:23 AM
  5. a couple ? background, extra white space, row colors
    By bwhitmire in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 13 Jul 2006, 03:04 AM

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