Forums / Templates, Stylesheets, Page Layout / modifying the whats new sidebox centering image

modifying the whats new sidebox centering image

Locked

Views: 648

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
30 Jul 2009, 3:58 PM
#1
richard_tung avatar

richard_tung

New Zenner

Join Date:
May 2009
Location:
Toronto, Canada
Posts:
70
Plugin Contributions:
0

modifying the whats new sidebox centering image

I'm having some issues centering the image in the whats new (new products) sidebox... you can see it here http://pp.doesntexist.com/
I've tried to modify stylesheet sideboxleft section but that centers everything on the left column. I've also tried modifying the tpl_whats_new.php but that didn't worked...
Any help would be great. :blush:
Thanks

30 Jul 2009, 4:34 PM
#2
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: modifying the whats new sidebox centering image

For a quick fix add this to the bottom of your stylesheet:

.img_box1 img{display:block;margin:0 auto;}

Nick
iszent.com

30 Jul 2009, 4:49 PM
#3
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: modifying the whats new sidebox centering image

It looks like your sidebox has been edited from the default so I don't know if this will work with more than one 'new' product. It might be that you need a rule like:

.img_box1 img, .img_box2 img{display:block;margin:0 auto;}

or perhaps this is a better rule:

#whatsnew img{display:block;margin:0 auto;}

The reason that they are not absolutely central is that there is some padding apllied to the <td> that they are in. 25px in fact. If you get rid of this, or make it symmetrical it will help.

Nick
iszent.com

30 Jul 2009, 5:25 PM
#4
richard_tung avatar

richard_tung

New Zenner

Join Date:
May 2009
Location:
Toronto, Canada
Posts:
70
Plugin Contributions:
0

Re: modifying the whats new sidebox centering image

Hi Nick
Thanks for your quick reply... :D
I place your code into the my template's stylesheet and it worked...
Thanks for your help...

I've just noticed now that when you click on details in that sidebox it gives me an error not found.. Not linking to the correct page???? :no:

30 Jul 2009, 5:41 PM
#5
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: modifying the whats new sidebox centering image

Well, as I said this is a non-standard sidebox.

The link when you click on details is

<a href="http://pp.doesntexist.com/-p-.html?zenid=66ac654a1675a581371935294ccb46d9">

Which evidently is wrong and css can't have anything to do with that :smile: It is actually like the author of the code didn't quite get round to finishing it.

You need to have a look at the sidebox files and see what is creating this link.

Nick
iszent.com

30 Jul 2009, 5:50 PM
#6
richard_tung avatar

richard_tung

New Zenner

Join Date:
May 2009
Location:
Toronto, Canada
Posts:
70
Plugin Contributions:
0

Re: modifying the whats new sidebox centering image

From tpl_whats_new.php

<?php /** * Side Box Template * * @package templateSystem * @copyright Copyright 2003-2007 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 6128 2007-04-08 04:53:32Z birdbrain $ */ $content = ""; $whats_new_box_counter = 0; while (!$random_whats_new_sidebox_product->EOF) { $whats_new_box_counter++; $whats_new_price = zen_get_products_display_price($random_whats_new_sidebox_product->fields['products_id']); $content .= '<div class="sideBoxContent centeredContent">'; $content .= '<div style="padding-left:0; padding-top:0; padding-bottom:0; text-align:center; "><b><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']) . '">' . $random_whats_new_sidebox_product->fields['products_name'] . '</a></b></div><br />'; $content .= ' <table style="width:100%; margin:0 0 0 0;"> <tr> <td style="padding-left:25px;"> <div class="img_box1"> <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 .= '</a> </div> </td> </tr> <tr> <td style="width:100%; text-align:center;" class="txt1">'; $content .= '<div style="padding-top:13px; padding-bottom:10px; " class="productSpecialPrice">' . $whats_new_price . '</div> </td> </tr> </table> '; $content .= '<div style="text-align:center;"><a href="' . zen_href_link(zen_get_info_page($random_specials_sidebox_product->fields["products_id"]), 'cPath=' . zen_get_generated_category_path_rev($random_specials_sidebox_product->fields["master_categories_id"]) . '&products_id=' . $random_specials_sidebox_product->fields["products_id"]) . '">' . zen_image_button(BUTTON_IMAGE_GOTO_PROD_DETAILS, BUTTON_GOTO_PROD_DETAILS_ALT) . '</a></div>'; $content .= '</div>'; $random_whats_new_sidebox_product->MoveNextRandom(); } ?>
30 Jul 2009, 5:59 PM
#7
richard_tung avatar

richard_tung

New Zenner

Join Date:
May 2009
Location:
Toronto, Canada
Posts:
70
Plugin Contributions:
0

Re: modifying the whats new sidebox centering image

I've figured it out... when I copied and paste it here I found that the programmer put in specials instead whats_new.... so I've changed the code and it worked... yeahhhhhhh :clap:

30 Jul 2009, 6:01 PM
#8
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: modifying the whats new sidebox centering image

Great!!!

Nick
iszent.com