For anyone who wants this to work for 4.0.18, here's the code to use:
Code:
{if $product_links ne ""}
{capture name=dialog}
{assign var="tmp" value="0"}
{section name=cat_num loop=$product_links}
{if $product_links[cat_num].productid}{assign var="tmp" value="1"}{/if}
{/section}
{section name=cat_num loop=$product_links}
{ if %cat_num.first% }
<table border="0" cellspacing="5" width="100%">
{/if}
{if $smarty.section.cat_num.index is div by 3}
</tr><tr valign="top">
{/if}
<TD width="33%" align="center">
<A href="product.php?productid={ $product_links[cat_num].productid }"{if $config.Modules.upselling_new_window eq 'Y'} target="_blank"{/if}>
{include file="product_thumbnail.tpl" productid=$product_links[cat_num].productid image_x=$config.Appearance.thumbnail_width product=$product_links[cat_num].product tmbn_url=$product_links[cat_num].tmbn_url}<br>
{ $product_links[cat_num].product}
</A>
</TD>
{ if %cat_num.last% }
</tr></table><br>
{/if}
{/section}
{/capture}
{include file="dialog.tpl" title="You may also like..." content=$smarty.capture.dialog extra="width=100%"}
{/if}
It is set for 3 columns, but you can change that by changing the number 3 to whatever you want, and also change the percentage for the width of the table cell (currently set to 33%).