Forums / Templates, Stylesheets, Page Layout / New Products Sidebox: I want 2 columns!

New Products Sidebox: I want 2 columns!

Locked

Views: 1,037

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
7 Jan 2009, 6:10 AM
#1
rex357 avatar

rex357

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?

10 Jan 2009, 8:26 PM
#2
rex357 avatar

rex357

New Zenner

Join Date:
Jan 2009
Posts:
2
Plugin Contributions:
0

Re: New Products Sidebox: I want 2 columns!

bump up to the top

12 Jan 2009, 1:38 PM
#3
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town &amp; London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: New Products Sidebox: I want 2 columns!

For someone to test and possibly correct this code is going to take some time, skill, intimate zc code knowledge and effort.

You may want to seek advice in the "commercial help wanted" forum section.

12 Jan 2009, 2:42 PM
#4
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: New Products Sidebox: I want 2 columns!

Normally I would agree with fairestcape - it's unlikely that somebody will want to try to load your code, test and debug it. Especially when they see the table you're inserting in there.

However, you might be in luck in that there is a very obvious error in your code that would explain the symptoms that you see. Specifically you're using the wrong sort of comments. Your are block commenting your code (/* ... */) so that most of it will be ignored, when you appear to intend to use line comments (// ...).

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)