0

I need to create a table in page product.

Now my code work well but, in some products, there is white space in table.

My code:

<?php if($_additional = $this->getAdditionalData()): ?>
<h2><?php echo $this->__('Additional Information') ?></h2>
<table class="data-table" id="product-attribute-specs-table">
    <col width="25%" />
    <col />
    <tbody>
    <?php $_totale=count($_additional); $_contatore=0; ?>
    <?php foreach ($_additional as $_data): ?>
                <?php if (!strpos(($_data['code']),"filtro")) { ?>
        <?php if ($_data['value']!="No" ): ?>
            <?php if ($_contatore%2==0): ?>
            <tr>
            <?php endif; ?>

                    <th class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
                    <!--<td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?>-->
                    <td class="data">
                    <?php #echo ">>".$_data['code']."<<"; ?>
                    <?php echo $_data['value']; ?>
                </td>
            <?php if ($_contatore%2==1): ?>

            </tr>
            <?php endif; ?>
        <?php endif; ?>
        <?php $_contatore++; ?>
                <?php } ?>
    <?php endforeach; ?>
    </tbody>
</table>
<script type="text/javascript">decorateTable('product-attribute-specs-table')</script>

If use the "modulo" operation.

enter image description here

can you help me?

1
  • possibly if ($_contatore%2==0): needs to be the same after you close your td. also why are you using <th> tag next to <td> tag?
    – Robin
    Commented Jul 22, 2016 at 10:10

1 Answer 1

0

if i use

<td>

and replace

<th>

with

</tr>

(the code)

<?php if ($_data['value']!="No" ): ?>
            <?php if ($_contatore%2==0): ?>
            <tr>
            <?php endif; ?>

                    <td class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></td>
                    <!--<td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?>-->
                    <td class="data">
                    <?php #echo ">>".$_data['code']."<<"; ?>
                    <?php echo $_data['value']; ?>
                </td>
    </tr>
            <?php if ($_contatore%2==1): ?>

            </tr>

enter image description here

if i remove :

</tr>

enter image description here

there is a hole.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.