Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / align product image to right

align product image to right

Locked

Views: 1,963

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
9 Aug 2006, 7:26 PM
#1
manage_it avatar

manage_it

Inactive

Join Date:
May 2006
Posts:
80
Plugin Contributions:
0

align product image to right

How do I align the product detail image to the right and the product description to the top left?

8 Dec 2006, 3:51 PM
#2
subb avatar

subb

New Zenner

Join Date:
Oct 2006
Posts:
26
Plugin Contributions:
0

Re: align product image to right

i too would love to know how to do this.

i would like to have each products' description on the left and the image to the
right.

cheers for any help

8 Dec 2006, 4:15 PM
#3
bombknex avatar

bombknex

New Zenner

Join Date:
Sep 2006
Location:
Madison, WI
Posts:
54
Plugin Contributions:
0

Re: align product image to right

I can give you guys some hints because I don't have time to go into the full explanation but basically you want to take a look at **tpl_product_info_display.php **located in includes/templates/YOUR_TEMPLATE/templates

If you scroll through the code you'll find this section:

/**
 * display the main product image
 */
   require($template->get_template_dir('/tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php'); ?>
<?php
  }
?>
<!--eof Main Product Image-->

<!--bof Product Name-->
<h1 id="productName" class="productGeneral"><?php echo $products_name; ?></h1>
<!--eof Product Name-->

<!--bof free ship icon  -->
<?php if(zen_get_product_is_always_free_shipping($products_id_current)) { ?>
<div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON; ?></div>
<?php } ?>
<!--eof free ship icon  -->

 <!--bof Product description -->
<?php if ($products_description != '') { ?>
<div id="productDescription" class="productGeneral biggerText"><?php echo stripslashes($products_description); ?></div>
<?php } ?>
<!--eof Product description -->
<br class="clearBoth" />
```You'll probably see some other stuff in the code that looks familiar too. Both the product image and description are wrapped in divs (you can see this by viewing the source on your product page). You can try rearranging the code above to have description come before the image but you may also have to edit the stylesheet and setup some styles for the divs that the content is wrapped in. Try the float and position properties. In CSS those are used for positioning elements on a page.

Thats all I can do for now... Gotta get back to work :wink2:

- Jonah
8 Dec 2006, 4:22 PM
#4
subb avatar

subb

New Zenner

Join Date:
Oct 2006
Posts:
26
Plugin Contributions:
0

Re: align product image to right

thanks very much for the quick reply Jonah, much appreciated mate.

i did do some digging around and found that the CSS property

.back {
	float: left;
	}

was the section i needed to change to

.back {
	float: right;
	}

again, many thanks for the help

8 Dec 2006, 4:37 PM
#5
bombknex avatar

bombknex

New Zenner

Join Date:
Sep 2006
Location:
Madison, WI
Posts:
54
Plugin Contributions:
0

Re: align product image to right

No problem. You may want to be careful editing that style class because it applies to other elements in the store besides on the product page. For example, many of the back/forward or back/submit buttons that are arranged one on the left and one on the right are controlled by .back and .forward

Do some looking around to make sure nothing else looks out of place. Another thing you could do is edit tpl_main_product_info.php or tpl_main_products_image.php to have custom classes for your needs. For example, where you see in the code .back change it to .custom (or whatever) and then create this new class in the stylesheet. :wink2:

Hope that helps!

8 Dec 2006, 10:45 PM
#6
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Location:
Colorado Springs, CO USA
Posts:
7,017
Plugin Contributions:
12

Re: align product image to right

subb:

thanks very much for the quick reply Jonah, much appreciated mate.

i did do some digging around and found that the CSS property

.back {
float: left;
}

> 
> was the section i needed to change to
> 
> ```
.back {
	float: right;
	}

again, many thanks for the help

Changing that declaration may bring up problems in other places on your site since "class="back" to align other things to the left are used on several template pages throughout Zen Cart.

NOTE: We are sorry that Clyde is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

23 Dec 2006, 10:50 PM
#7
wils avatar

wils

Zen Follower

Join Date:
Apr 2006
Location:
Göteborg
Posts:
124
Plugin Contributions:
0

Re: align product image to right

My take is that CSS is the way to go. Have not done extensive testing, but why not look at

#productMainImage {
float: right;
margin: 0em 5em 1em 5em ;
}

/Wils