Forums / Templates, Stylesheets, Page Layout / Complicated Sidebox Question....where are the pros?

Complicated Sidebox Question....where are the pros?

Locked

Views: 469

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
3 Nov 2010, 6:17 PM
#1
joyjoy avatar

joyjoy

Totally Zenned

Join Date:
Sep 2010
Posts:
611
Plugin Contributions:
0

Complicated Sidebox Question....where are the pros?

Hi Zenners!

I have a bit of a complicated side box question...as stated. :smile: I have added the best sellers add on but I want the listings to be shown in the same layout as the featured products default sidebox. The coding is different and I'm not exactly sure where to make my adjustments and I don't want to end up messing things up. Any help would be greatly appreciated!

Featured PHP Code

  $content = "";
  $featured_box_counter = 0;
  while (!$random_featured_product->EOF) {
    $featured_box_counter++;
    $featured_box_price = zen_get_products_display_price($random_featured_product->fields['products_id']);
    $content .= '<div class="sideBoxContent centeredContent">';
    $content .=  '<a href="' . zen_href_link(zen_get_info_page($random_featured_product->fields["products_id"]), 'cPath=' . zen_get_generated_category_path_rev($random_featured_product->fields["master_categories_id"]) . '&products_id=' . $random_featured_product->fields["products_id"]) . '">' . zen_image(DIR_WS_IMAGES . $random_featured_product->fields['products_image'], $random_featured_product->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); 
    $content .= '<br />' . $random_featured_product->fields['products_name'] . '</a>';
    $content .= '<div>' . $featured_box_price . '</div>';
    $content .= '</div>';
    $random_featured_product->MoveNextRandom();
  }
?>

Best Sellers PHP

  $content = '';
  $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n";
  $content .= '<div class="wrapper"><table cellpadding=0 cellspacing=0 border=0>' .  "\n";
  for ($i=1; $i<=sizeof($bestsellers_list); $i++) {
    $imgLink =  DIR_WS_IMAGES . $bestsellers_list[$i]['image'];
	if ($i==2) {$content .= '<tr><td colspan=2><hr></td></tr>';}
    $content .= '<tr><td valign=top><a href="' . zen_href_link(zen_get_info_page($bestsellers_list[$i]['id']), 'products_id=' . $bestsellers_list[$i]['id']) . '">' . 	zen_image($imgLink, zen_trunc_string($bestsellers_list[$i]['name']), SMALL_IMAGE_WIDTH/2, SMALL_IMAGE_HEIGHT/2) . '</a></td><td valign=top><a href="' . zen_href_link(zen_get_info_page($bestsellers_list[$i]['id']), 'products_id=' . $bestsellers_list[$i]['id']) . '">' . zen_trunc_string($bestsellers_list[$i]['name'], BEST_SELLERS_TRUNCATE, BEST_SELLERS_TRUNCATE_MORE) . '</a><BR><div align=right>' . zen_get_products_display_price($bestsellers_list[$i]['id']) . '</div></td></tr>' . 	"\n";
  }

if (BEST_SELLERS_TRUNCATE == '1') {
      $content .= '<br />' . zen_draw_separator('pixel_silver.gif') . '<br />';
    }  
  $content .= '</table></div>' . "\n";
  $content .= '</div>';

?>
3 Nov 2010, 7:07 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Complicated Sidebox Question....where are the pros?

You probably want to remove the table code and put it into div code.```
$content = '';
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n";
$content .= '<div class="wrapper"><table cellpadding=0 cellspacing=0 border=0>' . "\n";
for ($i=1; $i<=sizeof($bestsellers_list); $i++) {
$imgLink = DIR_WS_IMAGES . $bestsellers_list[$i]['image'];
if ($i==2) {$content .= '<tr><td colspan=2><hr></td></tr>';}
$content .= '<tr><td valign=top><a href="' . zen_href_link(zen_get_info_page($bestsellers_list[$i]['id']), 'products_id=' . $bestsellers_list[$i]['id']) . '">' . zen_image($imgLink, zen_trunc_string($bestsellers_list[$i]['name']), SMALL_IMAGE_WIDTH/2, SMALL_IMAGE_HEIGHT/2) . '</a></td><td valign=top><a href="' . zen_href_link(zen_get_info_page($bestsellers_list[$i]['id']), 'products_id=' . $bestsellers_list[$i]['id']) . '">' . zen_trunc_string($bestsellers_list[$i]['name'], BEST_SELLERS_TRUNCATE, BEST_SELLERS_TRUNCATE_MORE) . '</a><BR><div align=right>' . zen_get_products_display_price($bestsellers_list[$i]['id']) . '</div></td></tr>' . "\n";
}

if (BEST_SELLERS_TRUNCATE == '1') {
$content .= '<br />' . zen_draw_separator('pixel_silver.gif') . '<br />';
}
$content .= '</table></div>' . "\n";
$content .= '</div>';

?>

then add div code like this

$content = '';
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n";

for ($i=1; $i<=sizeof($bestsellers_list); $i++) {
$imgLink = DIR_WS_IMAGES . $bestsellers_list[$i]['image'];

$content .= '<div class="bsItem"><a class="bsImage" href="' . zen_href_link(zen_get_info_page($bestsellers_list[$i]['id']), 'products_id=' . $bestsellers_list[$i]['id']) . '">' . zen_image($imgLink, zen_trunc_string($bestsellers_list[$i]['name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) .

'</a><a class="bsName" href="' . zen_href_link(zen_get_info_page($bestsellers_list[$i]['id']), 'products_id=' . $bestsellers_list[$i]['id']) . '">' . zen_trunc_string($bestsellers_list[$i]['name'], BEST_SELLERS_TRUNCATE, BEST_SELLERS_TRUNCATE_MORE) .
'</a><div class="bsPrice">' . zen_get_products_display_price($bestsellers_list[$i]['id']) . '</div></div>' . "\n";
}

if (BEST_SELLERS_TRUNCATE == '1') {
$content .= '<br />' . zen_draw_separator('pixel_silver.gif') . '<br />';
}

$content .= '</div>';

?>

3 Nov 2010, 7:41 PM
#3
joyjoy avatar

joyjoy

Totally Zenned

Join Date:
Sep 2010
Posts:
611
Plugin Contributions:
0

Re: Complicated Sidebox Question....where are the pros?

PERFECT! A few tweaks here and there and it's working like a charm. Thank you!

3 Nov 2010, 7:48 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Complicated Sidebox Question....where are the pros?

Glad it's working! If there were any typos in the code posted, please post a corrected version - it's hard to debug long or complex statements in forum posts.