Page 1 of 1

Table not displaying correctly [solved]

Posted: Thu Oct 05, 2017 3:25 am
by labeshops
Okay, this is one of those things that I am probably looking right at the error and not seeing it and it's now driving me nuts. Hoping a fresh set of eyes notices it.

I have 2 sections, Availability, and Average Delivery that always show on my specifications table even if I have no others set. It is hard coded in the product template and then the other specs pull from the database is normal. Everything is showing except for my headings are foobared and I cannot figure out why.

See screen shot for how it is displaying right now, but:
"Availability & Delivery" should be where "Stone Properties" is and the "Stone Properties" heading should be above the "Amethyst" section. (stone properties & amethyst as well as everything below is is coming from the database as it should be from the for each attribute section in the code. For some reason, the theads are just not where they are supposed to be and it's been bugging the crap out of me!!

Code: Select all

	<div class="tab-pane" id="tab-specification">
          <table class="table table-bordered" style="width:100%;overflow-y:auto;>
                <thead>
                  <tr>
                    <td colspan="2"><strong>Availability & Delivery</strong></td>
                  </tr>
                </thead>
			  <tbody>				
			  <tr>
			  <td>Availability:</td>
			  <td>Inventory is updated regularly and will be shown above with any sizes/colors/items out of stock indicated. Not all manufacturers provide inventory data and even in stock items can be sold out without notice. Items not shown out of stock are normally available. We will notify you of any out of stock items as soon as possible or you can contact us in advance of placing your order to verify availability. </td>
			  </tr>
			  <tr>
			  <td>*Average Delivery:</td>
			  <td>The average delivery time for delivery within the United States via Standard or Free Shipping. Deliveries outside the US will on average take an additional 10-15 days based on destination country and customs both in the US and at the destination. International deliveries may have additional import duties, taxes, or fees imposed before delivery that we cannot charge or estimate - contact your local customs office for information. <br/><br/>
			  Note: This is the average, estimated time for delivery and is subject to availability, seasonal sales volume, and other potential, unforeseen delays. If you must have an item by a specific date, be sure to include that date in your cart comments when checking out.</td>
				</tr>
				</tbody>
        <?php foreach ($attribute_groups as $attribute_group) { ?>
        <thead>
          <tr>
            <td colspan="2"><strong><?php echo $attribute_group['name']; ?></strong></td>
          </tr>
        </thead>
        <tbody>
          <?php foreach ($attribute_group['attribute'] as $attribute) { ?>
          <tr>
            <td><?php echo $attribute['name']; ?></td>
            <td><?php echo $attribute['text']; ?></td>
          </tr>
          <?php } ?>
        </tbody>
        <?php } ?>
      </table>
    </div>

Re: Table not displaying correctly

Posted: Thu Oct 26, 2017 3:51 am
by simonpieman
Would you mind to post a link to the page itself please. its hard interpret by code alone.

Re: Table not displaying correctly

Posted: Fri Oct 27, 2017 11:31 pm
by labeshops
Any of my product pages - link to my stores is in my signature.

Re: Table not displaying correctly

Posted: Sat Oct 28, 2017 9:08 pm
by MrPhil
It appears that you are trying to put multiple <thead>'s into a <table>, and that is not valid HTML. There is supposed to be zero or one <thead> and zero or one <tfoot> per table. Some browsers may let you get away with multiple ones, but it's not guaranteed to work everywhere. Multiple <tbody> sections are apparently OK.

Re: Table not displaying correctly

Posted: Sat Oct 28, 2017 9:35 pm
by labeshops
Hmm I though the thead is what designated the header class.

And actually, the original code is working fine that includes the for each call for the thead in the database so it does repeat fine. You can see it on https://www.mysticconvergence.com/bed-o ... r-necklace

It's just not putting my added availability and delivery section in the right place (should be above stone properties and swarovski crystal) and formatting the heading correctly inside a table box.

Re: Table not displaying correctly

Posted: Sat Oct 28, 2017 9:56 pm
by labeshops
Well, yeah! I am much closer though the "Availability & Delivery" head is still outside the table for some dumb reason though it is within it in the code.

I took out all the theads and move tbody up to encompass the entire thing. Again look at the link above for current version. Any idea why that one headline is not enclosed in the table lines like it should be? Below is my current code.

Code: Select all

          <table class="table table-bordered" style="width:100%;overflow-y:auto;>
		      <tbody>	
                  <tr>
                    <td colspan="2"><strong>Availability & Delivery</strong></td>
                  </tr>				  
			  <tr>
			  <td>Availability:</td>
			  <td>Inventory is updated regularly and will be shown above with any sizes/colors/items out of stock indicated. Not all manufacturers provide inventory data and even in stock items can be sold out without notice. Items not shown out of stock are normally available. We will notify you of any out of stock items as soon as possible or you can contact us in advance of placing your order to verify availability. </td>
			  </tr>
			  <tr>
			  <td>*Average Delivery:</td>
			  <td>The average delivery time for delivery within the United States via Standard or Free Shipping. Deliveries outside the US will on average take an additional 10-15 days based on destination country and customs both in the US and at the destination. International deliveries may have additional import duties, taxes, or fees imposed before delivery that we cannot charge or estimate - contact your local customs office for information. <br/><br/>
			  Note: This is the average, estimated time for delivery and is subject to availability, seasonal sales volume, and other potential, unforeseen delays. If you must have an item by a specific date, be sure to include that date in your cart comments when checking out.</td>
				</tr>
        <?php foreach ($attribute_groups as $attribute_group) { ?>
          <tr>
            <td colspan="2"><strong><?php echo $attribute_group['name']; ?></strong></td>
          </tr>
          <?php foreach ($attribute_group['attribute'] as $attribute) { ?>
          <tr>
            <td><?php echo $attribute['name']; ?></td>
            <td><?php echo $attribute['text']; ?></td>
          </tr>
          <?php } ?>
        </tbody>
        <?php } ?>
      </table>

Re: Table not displaying correctly

Posted: Sun Oct 29, 2017 6:08 am
by MrPhil
Your style attribute in the <table> element is not closed. It has an opening " but no closing ". Effectively, the table does not start until the <tbody>. And why isn't that first row (Availability & Delivery) within <tbody>?

Re: Table not displaying correctly

Posted: Sun Oct 29, 2017 9:24 am
by labeshops
The <table class...> is closed by the final </table>

The first line is below the <tbody> so not sure what you mean???

Re: Table not displaying correctly

Posted: Mon Oct 30, 2017 1:55 am
by MrPhil

Code: Select all

<table class="table table-bordered" style="width:100%;overflow-y:auto;>
should be

Code: Select all

<table class="table table-bordered" style="width:100%;overflow-y:auto;">

Re: Table not displaying correctly

Posted: Mon Oct 30, 2017 6:44 am
by labeshops
Ah! Thank you! It's always the little things the foul me up! Displaying correctly now :)

Re: Table not displaying correctly [solved]

Posted: Tue Oct 31, 2017 10:15 pm
by MrPhil
Yep, always the stupid little things like that. :crazy: They need a facepalm emoji in the set. (x.x)|\