New Zenner
- Join Date:
- Jan 2009
- Posts:
- 2
- Plugin Contributions:
- 0
New Products Sidebox: I want 2 columns!
Hi, I am trying to modify the tpl_whats_new.php file to generate two columns instead of one.
I changed the number of random products to show to '4' and I basicaly want two rows with two columns per row.
Here's my code (I'm using a table to lay it out the way I want):
$content = "";
$whats_new_box_counter = 0;
$tr_tag = 0; /** initialize variable that's gonna count what product number I'm up to
$content .= '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>'; /** start the table
while (!$random_whats_new_sidebox_product->EOF) {
$whats_new_price = zen_get_products_display_price($random_whats_new_sidebox_product->fields['products_id']);
$content .= '<td>'; /** start the cell
$content .= '<div class="sideBoxContent centeredContent">';
$content .= '<a href="' . zen_href_link(zen_get_info_page($random_whats_new_sidebox_product->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($random_whats_new_sidebox_product->fields['master_categories_id']) . '&products_id=' . $random_whats_new_sidebox_product->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $random_whats_new_sidebox_product->fields['products_image'], $random_whats_new_sidebox_product->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
$content .= '<br />' . $random_whats_new_sidebox_product->fields['products_name'] . '</a>';
$content .= '<div>' . $whats_new_price . '</div>';
$content .= '</div>';
$content .= '</td>'; /** close cell
if ($tr_tag == 1) { /** if the second product was just added to the content of $content, add the 'tr' tags to change row
$content .= '</tr><tr>';
}
if ($tr_tag == 3) { /** if the last product was added, close the table
$content .='</tr></table>';
}
$whats_new_box_counter++;
$tr_tag++; /** increment variable by 1
}
$random_whats_new_sidebox_product->MoveNextRandom();
}
And the end result the page stops loading. The header loads and it stops when it loads that box.
What's wrong with this code?