Jump to content

Resolved (bug report) box.basket.php - unclosed tag with empty cart


grafis

Recommended Posts

Notes from the field.... The following code appears to be bad in kurouto blue theme (needs confirmation, and may exist in all themes). Using a default CC 5.1.4 install W3C validator finds an unclosed tag on line 119. The culprit is 'box.basket.php' when your shopping cart is empty. The opening UL on line three is outside of the IF statement but the closing UL is not, if the users cart is empty the result is an open UL tag but no closing pair. I moved the UL to line six and all appears good.

Problem code


<div id="basket_summary">

<h3>{$LANG.checkout.your_basket}</h3>

<ul> <--- Problem!

{if isset($CONTENTS) && count($CONTENTS) > 0}

{foreach from=$CONTENTS item=item}

<li>

<span class="price">{$item.total}</span>

<a href="{$item.link}" title="{$item.name}">{$item.quantity} &times; {$item.name_abbrev}</a>

</li>

{/foreach}

</ul>



<p class="basket_items">

<span class="price">{$CART_ITEMS}</span>

{$LANG.basket.basket_item_count}

</p>

<p class="basket_total">

<span class="price">{$CART_TOTAL}</span>

<strong>{$LANG.basket.total}</strong>

</p>

<p class="view_basket animate_basket"><a href="{$BUTTON.link}" title="{$BUTTON.text}">{$BUTTON.text}</a></p>

{else}

<p style="text-align: center;">{$LANG.basket.basket_is_empty}</p>

{/if}[



</div>




Solution - moved the opening UL inside the IF



<div id="basket_summary">

<h3>{$LANG.checkout.your_basket}</h3>

{if isset($CONTENTS) && count($CONTENTS) > 0}

{foreach from=$CONTENTS item=item}

<ul> <--- Moved it!

<li>

<span class="price">{$item.total}</span>

<a href="{$item.link}" title="{$item.name}">{$item.quantity} &times; {$item.name_abbrev}</a>

</li>

{/foreach}

</ul>



<p class="basket_items">

<span class="price">{$CART_ITEMS}</span>

{$LANG.basket.basket_item_count}

</p>

<p class="basket_total">

<span class="price">{$CART_TOTAL}</span>

<strong>{$LANG.basket.total}</strong>

</p>

<p class="view_basket animate_basket"><a href="{$BUTTON.link}" title="{$BUTTON.text}">{$BUTTON.text}</a></p>

{else}

<p class="basket_empty">{$LANG.basket.basket_is_empty}</p>

{/if}

</div>

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...