Forums / Templates, Stylesheets, Page Layout / 2 products on a row in Whats new?

2 products on a row in Whats new?

Locked

Views: 1,958

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
13 Aug 2007, 7:32 PM
#1
jagge avatar

jagge

Zen Follower

Join Date:
Jul 2007
Posts:
110
Plugin Contributions:
0

2 products on a row in Whats new?

Hi!
I just installed thecontribution Whats new 2 but I would like the products to appear on the same row and not underneath each other.
Can someone please help me with this one?
Below is the code I think it would be in.

best regards,
Ola

<?php /** * Side Box Template * * @package templateSystem * @copyright Copyright 2003-2005 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: tpl_whats_new.php 2982 2006-02-07 07:56:41Z birdbrain $ * * rebuild by PeterB * [www.openhosting.sk](http://www.openhosting.sk) * [[email protected]](mailto:"[email protected]") * */ $content = ""; $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">'; if (($random_whats_new_sidebox_product->fields['products_id']) != ($random_whats_new_sidebox_product2->fields['products_id'])) { $content .= '<a href="' . zen_href_link(zen_get_info_page($random_whats_new_sidebox_product->fields['products_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) . '<br />' . $random_whats_new_sidebox_product->fields['products_name'] . '</a><br />' . $whats_new_price; /*...uprava pre druhy produkt...*/ $content .= '<br /><a href="' . zen_href_link(zen_get_info_page($random_whats_new_sidebox_product2->fields['products_id']), 'products_id=' . $random_whats_new_sidebox_product2->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $random_whats_new_sidebox_product2->fields['products_image'], $random_whats_new_sidebox_product2->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br />' . $random_whats_new_sidebox_product2->fields['products_name'] . '</a><br />' . $whats_new_price2; /*...konec upravy...*/ $content .= '</div>'; } else { $content .= '<a href="' . zen_href_link(zen_get_info_page($random_whats_new_sidebox_product->fields['products_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) . '<br />' . $random_whats_new_sidebox_product->fields['products_name'] . '</a><br />' . $whats_new_price; $content .= '</div>'; } ?>
13 Aug 2007, 9:18 PM
#2
jettrue avatar

jettrue

Totally Zenned

Join Date:
Jan 2005
Location:
USA, St. Louis
Posts:
3,651
Plugin Contributions:
5

Re: 2 products on a row in Whats new?

jagge:

Hi!
I just installed thecontribution Whats new 2 but I would like the products to appear on the same row and not underneath each other.
Can someone please help me with this one?
Below is the code I think it would be in.

best regards,
Ola

<?php /** * Side Box Template * * @package templateSystem * @copyright Copyright 2003-2005 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: tpl_whats_new.php 2982 2006-02-07 07:56:41Z birdbrain $ * * rebuild by PeterB * [www.openhosting.sk](http://www.openhosting.sk) * [[email protected]](mailto:"[email protected]") * */ $content = ""; $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">'; if (($random_whats_new_sidebox_product->fields['products_id']) != ($random_whats_new_sidebox_product2->fields['products_id'])) { $content .= '<a href="' . zen_href_link(zen_get_info_page($random_whats_new_sidebox_product->fields['products_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) . '<br />' . $random_whats_new_sidebox_product->fields['products_name'] . '</a><br />' . $whats_new_price; /*...uprava pre druhy produkt...*/ $content .= '<br /><a href="' . zen_href_link(zen_get_info_page($random_whats_new_sidebox_product2->fields['products_id']), 'products_id=' . $random_whats_new_sidebox_product2->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $random_whats_new_sidebox_product2->fields['products_image'], $random_whats_new_sidebox_product2->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br />' . $random_whats_new_sidebox_product2->fields['products_name'] . '</a><br />' . $whats_new_price2; /*...konec upravy...*/ $content .= '</div>'; } else { $content .= '<a href="' . zen_href_link(zen_get_info_page($random_whats_new_sidebox_product->fields['products_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) . '<br />' . $random_whats_new_sidebox_product->fields['products_name'] . '</a><br />' . $whats_new_price; $content .= '</div>'; } ?>

You shouldn't have to adjust anything there to get two side by side. In "configuration", "index listing", what do you have set for:
New Products Columns per Row

14 Aug 2007, 4:35 AM
#3
jagge avatar

jagge

Zen Follower

Join Date:
Jul 2007
Posts:
110
Plugin Contributions:
0

Re: 2 products on a row in Whats new?

Hi,
it was set to 3. I tried to set it to 2 but nothing happened?
This is the other file that followed the contribution.

/Ola

<?php
/**

/
// display limits
//$display_limit = zen_get_products_new_timelimit();
$display_limit = zen_get_new_date_range();
$random_whats_new_sidebox_product_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price
from " . TABLE_PRODUCTS . " p
where p.products_status = 1 " . $display_limit . "
limit " . MAX_RANDOM_SELECT_NEW;
$random_whats_new_sidebox_product = zen_random_select($random_whats_new_sidebox_product_query);
if ($random_whats_new_sidebox_product->RecordCount() > 0 ) {
$whats_new_price = zen_get_products_display_price($random_whats_new_sidebox_product->fields['products_id']);
$random_whats_new_sidebox_product->fields['products_name'] = zen_get_products_name($random_whats_new_sidebox_product->fields['products_id']);
$random_whats_new_sidebox_product->fields['specials_new_products_price'] = zen_get_products_special_price($random_whats_new_sidebox_product->fields['products_id']);
/
...uprava pre zobrazenie druheho produktu...
require($template->get_template_dir('tpl_whats_new.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_whats_new.php');
$title = BOX_HEADING_WHATS_NEW;
$title_link = FILENAME_PRODUCTS_NEW;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
... koniec upravy pre zobrazenie druheho produktu.../
}
/
...uprava pre zobrazenie druheho produktu.../
$display_limit2 = zen_get_new_date_range();
$random_whats_new_sidebox_product_query2 = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price
from " . TABLE_PRODUCTS . " p
where p.products_status = 1 " . $display_limit . "
limit " . MAX_RANDOM_SELECT_NEW;
$random_whats_new_sidebox_product2 = zen_random_select($random_whats_new_sidebox_product_query2);
if ($random_whats_new_sidebox_product2->RecordCount() > 0 ) {
$whats_new_price2 = zen_get_products_display_price($random_whats_new_sidebox_product2->fields['products_id']);
$random_whats_new_sidebox_product2->fields['products_name'] = zen_get_products_name($random_whats_new_sidebox_product2->fields['products_id']);
$random_whats_new_sidebox_product2->fields['specials_new_products_price'] = zen_get_products_special_price($random_whats_new_sidebox_product2->fields['products_id']);
require($template->get_template_dir('tpl_whats_new_2.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_whats_new_2.php');
$title = BOX_HEADING_WHATS_NEW;
$title_link = FILENAME_PRODUCTS_NEW;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}
/
...koniec upravy pre zobrazenie druheho produktu...*/
?>

14 Aug 2007, 11:13 AM
#4
jettrue avatar

jettrue

Totally Zenned

Join Date:
Jan 2005
Location:
USA, St. Louis
Posts:
3,651
Plugin Contributions:
5

Re: 2 products on a row in Whats new?

Oh, sorry I've been misunderstanding. I didn't realize these were sideboxes. You want them side by side in the sideboxes? Can I see a link? It probably can be adjusted in the css.

14 Aug 2007, 11:53 AM
#5
jagge avatar

jagge

Zen Follower

Join Date:
Jul 2007
Posts:
110
Plugin Contributions:
0

Re: 2 products on a row in Whats new?

Hi!
Sorry, forgot the link.

www.blingofsweden.se

/Ola

14 Aug 2007, 6:11 PM
#6
jettrue avatar

jettrue

Totally Zenned

Join Date:
Jan 2005
Location:
USA, St. Louis
Posts:
3,651
Plugin Contributions:
5

Re: 2 products on a row in Whats new?

Add this to your stylesheet:

.whatsNew2 {float:left; padding:.5em}

then update the first file you pasted to this:

<?php
/**
* Side Box Template
*
* @package templateSystem
* @copyright Copyright 2003-2005 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: tpl_whats_new.php 2982 2006-02-07 07:56:41Z birdbrain $
*
* rebuild by PeterB
* www.openhosting.sk
* peter DOT bohus AT openhosting DOT sk
*
*/

$content = "";
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">';
if (($random_whats_new_sidebox_product->fields['products_id']) != ($random_whats_new_sidebox_product2->fields['products_id'])) {
$content .= '<div class="whatsNew2"><a href="' . zen_href_link(zen_get_info_page($random_whats_new_ sidebox_product->fields['products_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) . '<br />' . $random_whats_new_sidebox_product->fields['products_name'] . '</a><br />' . $whats_new_price;
/*...uprava pre druhy produkt...*/
$content .= '</div><div class="whatsNew2"><a href="' . zen_href_link(zen_get_info_page($random_whats_new_ sidebox_product2->fields['products_id']), 'products_id=' . $random_whats_new_sidebox_product2->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $random_whats_new_sidebox_product2->fields['products_image'], $random_whats_new_sidebox_product2->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br />' . $random_whats_new_sidebox_product2->fields['products_name'] . '</a><br />' . $whats_new_price2;
/*...konec upravy...*/
$content .= '</div></div>';
} else {
$content .= '<a href="' . zen_href_link(zen_get_info_page($random_whats_new_ sidebox_product->fields['products_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) . '<br />' . $random_whats_new_sidebox_product->fields['products_name'] . '</a><br />' . $whats_new_price;
$content .= '</div>';
}

?>

I think that should do it!

14 Aug 2007, 8:32 PM
#7
jagge avatar

jagge

Zen Follower

Join Date:
Jul 2007
Posts:
110
Plugin Contributions:
0

Re: 2 products on a row in Whats new?

Hi!
Thanks for putting in time but that didn´t seem to fix it?
It didnt load the main page correctly after the fixes so I had to remove it again.

/Ola

14 Aug 2007, 9:34 PM
#8
jettrue avatar

jettrue

Totally Zenned

Join Date:
Jan 2005
Location:
USA, St. Louis
Posts:
3,651
Plugin Contributions:
5

Re: 2 products on a row in Whats new?

jagge:

Hi!
Thanks for putting in time but that didn´t seem to fix it?
It didnt load the main page correctly after the fixes so I had to remove it again.

/Ola

Can you put it back up, so I can see?