+ Reply to Thread
Results 1 to 12 of 12

Thread: Space between table rows

  1. #1
    Client
    Join Date
    Aug 2010
    Posts
    49
    Squirrelcart version
    v3.2.1

    Space between table rows

    Hello!

    I'm selling MP3s on my site, and for the page that lists the tracks (and individual MP3s for each song), I've made a nice little table that automatically zebra stripes even and odd rows (using jquery).

    However, there is a div creating a gap in between the <tr> (rows) of the table called box_row. It's not showing up in the product_details.tpl.php file, and lists itself as being in the quick total template.

    I'm not using the quicktotal on this product page, so I'm wondering if I could turn it off for this page, or if there is a control-pnel (more sophisticated) solution for solving this?

    If not, does anyone know which templates to modify (I'm guessing the quick_total.tpl.php.

    Thanks!

    T

  2. #2
    Squirrelcart Staff Jamie's Avatar
    Join Date
    May 2002
    Posts
    6,719
    Squirrelcart version
    v3.3.7
    That <div /> is supposed to surround each row of products as seen here:
    example.png

    You altered your HTML to output tables instead. I'm not sure why the div is empty, but it has something to do with the code you changed. You should probably start by validating your HTML for that URL here:
    http://validator.w3.org/

    and validating the CSS for the same page here:
    http://jigsaw.w3.org/css-validator/v...ning=1&lang=en

    Our code by default validates with no errors in both validators.

  3. #3
    Client
    Join Date
    Aug 2010
    Posts
    49
    Squirrelcart version
    v3.2.1

    Advice for changes

    Good advice!

    Looks like there's a wealth of problems I've created in the template. I could go back through and change these individual problem, but first I want to make sure what I'm restoring is a good solution.

    Perhaps an easy route to take this first step is to ask your advice at a high level to reach my goal:

    What I'm trying to do is create a nice, zebrea striped list of mp3 files with a table header such as the one seen here:

    http://www.amazon.com/gp/product/B00...pf_rd_i=507846

    Can squirrelcart's system support that kind of layout, or should I continue to rebuild the template the way I have? I know that tables are a bad way to go about things (though at my work they're allowed for lists of data).

    Thanks!

    T

  4. #4
    Client
    Join Date
    Aug 2010
    Posts
    49
    Squirrelcart version
    v3.2.1

    scratch that

    Those templates are really buggered up. I'm going to revert back to the originals.

    That said, how would you advise that I go about building a list of products with attributes (title, description, price, etc.) displayed horizontally?

    Thanks!

    T

  5. #5
    Squirrelcart Staff Jamie's Avatar
    Join Date
    May 2002
    Posts
    6,719
    Squirrelcart version
    v3.3.7
    Using table tags is fine if the data you are displaying is data that fits into that format (columns and rows) which it does. Converting the layout for products shown when you click a category to use a table and rows will be tricky because we don't already do that by default.

    Before adding a single table specific tag (<table />, <tr />, <td />)....

    If you revert to the default templates, I would then set "Products per Row" on your Visual Settings page int he control panel to 1. That should show each product in it's own row. It won't look like a row yet, but they won't be side by side.

    Then, remove everything you don't want to display from product_detail.tpl.php which should shorten up the layout considerably.

    I wouldn't try adding any table code until you have something like this:
    example.png

    When you have it like that, add <td /> tags in product_detail.tpl.php to separate your columns.

    Then, take a look in category.tpl.php. The products are looped through and displayed via this code:
    PHP Code:
        <!--  products -->
        <?php if ($Product_Rows): ?>
            <div class="cat_products">
                <?php foreach($Product_Rows as $Product_Row): ?>
                    <div class="box_row <?php print $Product_Row['instance']?>">
                        <?php foreach($Product_Row['products'] as $Product): ?>
                            <div class="box_outer <?php print $Product['instance'].' '.$Product['box_width_class'?>">
                                <div class="box_inner" style="<?php if ($Product['height_difference']) print "margin-top: $Product[height_difference]px" ?>">
                                    <?php print $Product['HTML'?>
                                </div>
                            </div>
                        <?php endforeach; ?>
                    </div>
                <?php endforeach; ?>
                <?php print $Page_Navigation ?>
            </div>
        <?php endif;?>
    If you change that to something like this, it should output a table:
    PHP Code:
        <!--  products -->
        <?php if ($Product_Rows): ?>
            <table>
                <?php foreach($Product_Rows as $Product_Row): ?>
                    <tr class="<?php print $Product_Row['instance']?>">
                        <?php foreach($Product_Row['products'] as $Product): ?>
                            <?php print $Product['HTML'?>
                        <?php endforeach; ?>
                    </tr>
                <?php endforeach; ?>
            </table>
            <?php print $Page_Navigation ?>
        <?php endif;?>

  6. #6
    Client
    Join Date
    Aug 2010
    Posts
    49
    Squirrelcart version
    v3.2.1

    Awesome!

    ok, that looks like a good solution, thanks Jamie.

    Can you tell me which template has the <head /> in it for the catalog page, so I can put some JQuery in there?

    Thanks!

    T

  7. #7
    Squirrelcart Staff Jamie's Avatar
    Join Date
    May 2002
    Posts
    6,719
    Squirrelcart version
    v3.3.7
    You can locate the names of template files by searching the source code of the page in your browser for the area you want to alter. Then, look above it for a template comment:
    <!-- Template: template_name.tpl.php -->

    The template that contains the <head /> tag is the only one in which that comment occurs AFTER the top of the template because otherwise it would cause the HTML to be invalid:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    ....
    </head>
    
    <body onload="scOnLoad()">
    <!-- Template: store_main.tpl.php -->
    
    <div id="sc" class="cols3">

    So, the template is store_main.tpl.php.

  8. #8
    Client
    Join Date
    Aug 2010
    Posts
    49
    Squirrelcart version
    v3.2.1

    Woo hoo!

    It's working! Looks great too. Thanks!

    Now that I've got that looking good, I need to get the product details to display horizontally. I've tried to insert "display:inline;" into prod_main, prod_detail and sc_form in the CSS, but it's not working.

    Any advice how I should approach this?

    Thanks!

  9. #9
    Squirrelcart Staff Jamie's Avatar
    Join Date
    May 2002
    Posts
    6,719
    Squirrelcart version
    v3.3.7
    I'm not sure what you are referring to. If you could provide an example or screenshots I may be able to help.

  10. #10
    Client
    Join Date
    Aug 2010
    Posts
    49
    Squirrelcart version
    v3.2.1

    Sure!

    Here's a screenshot. What I've got is this JQuery that changes row color of the table based on even and odd row. What you see here are elements within each row that are verticle. You have the song title on top then the mp3 player, then the price, then the buy now logo.

    I'd like for those elements to go horizontally across each row (white background and baby blue background).

    Does that make sense?

    Thanks!

    http://www.dymaxion.fm/images/example1.PNG

  11. #11
    Squirrelcart Staff Jamie's Avatar
    Join Date
    May 2002
    Posts
    6,719
    Squirrelcart version
    v3.3.7
    You have the content for each row in a single table cell. You need to split it up into columns using multiple <td/> tags.

  12. #12
    Client
    Join Date
    Aug 2010
    Posts
    49
    Squirrelcart version
    v3.2.1

    Dead on!

    That got it. Thanks, Jamie, it's looking good!

    T

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

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