Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

new products, displaying in two columns


Trusten

Recommended Posts

Posted

hello, can it be done?

 

i saw the code, looks something like

 

 

  <tr>

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



   <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new_array[$i]['id'], 'NONSSL') . '"><b><u>' . $products_new_array[$i]['name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . $products_new_array[$i]['date_added'] . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new_array[$i]['manufacturer'] . '<br><br>'; ?> </td>



   <td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new_array[$i]['id'], 'NONSSL') . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?> </td>

 </tr>

 

 

the begining of the code is clearly

 

<?php

 } else {

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

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

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

     } else {

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

     }

?>

 

least i thought so.

 

point is, if i put it in just <td> being there, it'd probably just keep scrolling cells.

 

which ain't good.

 

 

i just want to do this

 

 

blah lbhlbha | blah blah blah 2

blah blah b3 | blah blahblahb 4

 

etc, etc. etc. etc.

 

what can i do?

Posted

Which file are you trying to set to 2 columns?

 

The What's New? Or the New Products of the Month?

Posted

New code /includes/modules/products_new.php

 

?>

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

<?php

 $col_across=3;

 $psize = sizeof($products_new_array);

 if ($psize == '0') {

?>

 <tr>

   <td class="main"><?php echo TEXT_NO_NEW_PRODUCTS; ?></td>

 </tr>

<?php

 } else {

   for($i=0; $i<$psize; $i++) {

     echo '<tr>';

     $col=0;

       while ( $col < $col_across ) {

       $col++;

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

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

     } else {

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

     }

?>

<td>

<table>

 <tr>

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

   <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new_array[$i]['id'], 'NONSSL') . '"><b><u>' . $products_new_array[$i]['name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . $products_new_array[$i]['date_added'] . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new_array[$i]['manufacturer'] . '<br><br>' . TEXT_PRICE . ' ' . $products_price; ?></td>

   <td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new_array[$i]['id'], 'NONSSL') . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>

 </tr>

</table>

</td>

<?php

     if (((($i+1)/$col_across) != $psize)) {

     }



$i++;

}

echo '</tr>';



   }

 }

?>

</table>

 

Just clean it up to make it pretty :D

Posted

Just paste the whole thing in another file and use Beyond Compare to look at them side by side.

 

It is 3:00 am.

 

Otherwise, print them both out and get out your highlighter :shock:

Posted

lol.

 

i didn't mean step for the step the code. i just meant how you figured out how to do it. but yeah, wait till you're more refreshed.

 

 

i just want to be able to 'deduce' things for myself later.

 

but k.

 

tanks.

Posted

I typed really really fast wrong ... then saved the stuff that worked. :roll:

 

That's how I code.

 

I knew there was a section there that did one display of info in the code via the /module so I had to figure out how to add in an extra loop there.

 

When you have a <tr> stick in a <table> with <td>s to go across a screen.

 

You just have to peice the <table>, <tr> and <td> together and make a box.

 

Remember that jigsaw puzzle with the 15 numbers and one hole where you had to shuffle them until everything lined up right? I use to whiz through that in no time.

 

Advantage/disadvantage of being dyslexic ... I see things most people don't :shock:

Posted

Heck ... my counter is wrong on the products displayed.

 

I am ahead or behind myself. I will have to look at it later and see what's up.

 

Need a smoke ... some coffee and to get back to work to feed the cat 8)

Posted

well i couldn't really figure out how you did it, but it works great. you guys should use this code from now on and set it to 1, then when someone asks, you can just tell them 'set it to 2', hell, if the admin could control this, whoa, great.

 

orrr, if the screen is too small, you can maybe make a link that says 'single column, double', etc. etc. etc.

 

it's a thought.

 

but thank you very much, i appreciate it. well, in the mean time, i did figure out how to put product descriptions on.

 

man, this is so sick, some of this stuff is starting to make actual sense.

 

 

*cowers in fear*

Posted

This is the fixed code to work with the counters and end without blank records for /includes/modules/products_new.php

 

?>

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

<?php

 $col_across=3;

 $psize = sizeof($products_new_array);

 if ($psize == '0') {

?>

 <tr>

   <td class="main"><?php echo TEXT_NO_NEW_PRODUCTS; ?></td>

 </tr>

<?php

 } else {

   for($i=0; $i<$psize; $i++) {

     echo '<tr>';

     $col=0;

       while ( $col < $col_across and $i<$psize ) {

       $col++;

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

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

     } else {

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

     }

?>

<td>

<table>

 <tr>

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

   <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new_array[$i]['id'], 'NONSSL') . '"><b><u>' . $products_new_array[$i]['name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . $products_new_array[$i]['date_added'] . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new_array[$i]['manufacturer'] . '<br><br>' . TEXT_PRICE . ' ' . $products_price; ?></td>

   <td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new_array[$i]['id'], 'NONSSL') . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>

 </tr>

</table>

</td>

<?php

if ($col < $col_across) {

     $i++;

}

}

echo '</tr>';



   }

 }

?>

</table>

  • 6 months later...
Posted

Linda, I have been searching for this for over two weeks now.

 

Made the changes and it did exactly what I needed to do.

 

Once again, your expertise has helped overcome a problem.

 

Thanks.

 

Charlie

 

:D :D :D

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...