Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

help with the featured products box


xmlrookie

Recommended Posts

hello people, anyone knows how to make this thing align in column style? thanks

 

<?php

if (sizeof($featured_products_array) <> '0') {

for($i=0; $i<sizeof($featured_products_array); $i++) {

if ($featured_products_array[$i]['specials_price']) {

$products_price = '<s>' . $currencies->display_price($featured_products_array[$i]['price'], tep_get_tax_rate($featured_products_array[$i]['tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($featured_products_array[$i]['specials_price'], tep_get_tax_rate($featured_products_array[$i]['tax_class_id'])) . '</span>';

} else {

$products_price = $currencies->display_price($featured_products_array[$i]['price'], tep_get_tax_rate($featured_products_array[$i]['tax_class_id']));

}

?>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td colspan="3"></td>

</tr>

<tr>

<td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" rowspan="4" align="right" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products_array[$i]['id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $featured_products_array[$i]['image'], $featured_products_array[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td>

<td width="80%" valign="top" class="main"><div align="justify"><?php echo '<b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products_array[$i]['id'], 'NONSSL') . '"><u>' . $featured_products_array[$i]['name'] . '</u></a>:</b>'; ?>

</div></td>

</tr>

<tr>

<td valign="top" class="main">

<?php

if ($featured_products_array[$i]['shortdescription'] == ''){

$bah = explode(" ", $featured_products_array[$i]['description']);

for($desc=0 ; $desc<25 ; $desc++)

{

echo "$bah[$desc] ";

}

echo '...';

} else {

echo $featured_products_array[$i]['shortdescription'];

}

?>

<br> <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products_array[$i]['id'], 'NONSSL') . '">'; ?><font face="Wingdings 3">a</font>

More Info</a> <b><font size="1"></font></b> </td>

</tr>

<tr>

<td valign="top" class="main"></td>

</tr>

<tr>

<td align="left" valign="top" class="main"><?php echo tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', '', '1', '5') . '<br>' . TEXT_PRICE . ' ' . $products_price; ?><b></b>  <?php echo '<a href="' . tep_href_link('default.php', tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products_array[$i]['id'], 'NONSSL') . '">'; ?>Buy

Now</a> <b></b></td>

</tr>

<tr>

<td colspan="2" align="right" valign="top" class="main"><hr width="100%" size="1" noshade color="#5e7ebf"></td>

</tr>

<?php

if (($i+1) != sizeof($featured_products_array)) {

?>

<?php

}

}

}

?>

</table>

Link to comment
Share on other sites

From the code I gave you, which you have created this from, you could have implemented featured products 1.3 and then set columns to 3 in that contribution.

 

This would then ahve given you the result you want.

 

CC.

 

P.S. - No one but me will know what you are talking about from that description of your question, it is too vague.

Link to comment
Share on other sites

CC, this is from cieto featured products v1.5..

 

I can tell from my bit about if shortdescription == nothing...

 

 

xmlrookie, give me a few minutes and I will post the code for columns.

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

Hi Joshua

 

I know it is cieto's mod.

 

I gave the code to rookie that I use for my own description mod, which is partly based on featured products 1.3.

Thats the reason I gave my post.

 

Hope you can help him.

I have never used cieto's mod before, so I wont hazard a guess.

 

CC.

Link to comment
Share on other sites

yeah after re-reading I see thats what you said... 1st time I read it I thought you said what he posted looked like v1.3... my bad...

 

xmlrookie,

 

here is code for columns:

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<?php 

 if (sizeof($featured_products_array) <> '0') {

  $col = 0;

   for($i=0; $i<sizeof($featured_products_array); $i++) {

     if ($featured_products_array[$i]['specials_price']) {

       $products_price = '<s>' .  $currencies->display_price($featured_products_array[$i]['price'], tep_get_tax_rate($featured_products_array[$i]['tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($featured_products_array[$i]['specials_price'], tep_get_tax_rate($featured_products_array[$i]['tax_class_id'])) . '</span>'; 

     } else {

       $products_price = $currencies->display_price($featured_products_array[$i]['price'], tep_get_tax_rate($featured_products_array[$i]['tax_class_id']));

     }

  $col++;

?> 

<td width="50%" valign="top" align="center">

<table border="0" width="100%" cellspacing="0" cellpadding="2"> 

<tr> 

<td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" rowspan="4" align="right" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products_array[$i]['id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $featured_products_array[$i]['image'], $featured_products_array[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td> 

<td width="80%" valign="top" class="main"><div align="left"><?php echo '<b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products_array[$i]['id'], 'NONSSL') . '"><u>' . $featured_products_array[$i]['name'] . '</u></a>:</b>'; ?> 

</div></td> 

</tr> 

<tr> 

<td valign="top" class="main"> 

<?php

 if ($featured_products_array[$i]['shortdescription'] != '') { 

     echo $featured_products_array[$i]['shortdescription'];

 } else { 

$bah = explode(" ", $featured_products_array[$i]['description']);

for($desc=0; $desc<25; $desc++)

 {

 echo "$bah[$desc] ";

 }

 echo '. . .';

 }

?>

<br> <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products_array[$i]['id'], 'NONSSL') . '">'; ?><font face="Wingdings 3">a</font> 

More Info</a> <b><font size="1"></font></b> </td> 

</tr> 

<tr> 

<td valign="top" class="main"></td> 

</tr> 

<tr> 

<td align="left" valign="top" class="main"><?php echo tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', '', '1', '5') . '<br>' . TEXT_PRICE . ' ' . $products_price; ?><b></b>  <?php echo '<a href="' . tep_href_link('default.php', tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products_array[$i]['id'], 'NONSSL') . '">'; ?>Buy 

Now</a> <b></b></td> 

</tr>

</table>

</td>

<?php

     if ((($col / 2) == floor($col / 2))) {

?>

</tr>

<tr> 

<td colspan="2" align="right" valign="top" class="main"><hr width="100%" size="1" noshade color="#5e7ebf"></td> 

</tr>

<tr>

 <?php

 } 

if (($i+1) != sizeof($featured_products_array)) { 

?> 

 <?php

     }

   }

 }

?>

</table>

 

the columns are set at 2 right now... towards in the bottom the line:

      if ((($col / 2) == floor($col / 2))) {

the 2's are how many columns... change them to 3 and you get 3 columns, 4 you get 4 columns, etcc... at any time you can set at 1 and go back to the standard "cieto" layout as well...

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...