X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   css positioning (https://forum.x-cart.com/showthread.php?t=49088)

amy2203 08-10-2009 03:26 AM

css positioning
 
in my products.tpl file, I want to add an icon for reduced products,

at the moment I have:
Code:

{if $discount gt 0}<div class="SaveMoneyLabel"><span id="save_percent">{$discount}%</span></div>{/if}

where the current save money section is below the description, then in my css I set the size, image etc..

I really want this to be at the top of the product details section, but at that point in the tpl $discount is not set, so I can't just move the if statement further up.

My descriptions vary in size, so I can't just change the top: 10px; setting for the savemoneylabel as the value it needs to be is different each time.

Can anyone help me either change the if statment so I can move it further up, or change the css to have it positioned at the top of the PList section?

TIA

carpeperdiem 08-10-2009 04:06 AM

Re: css positioning
 
Amy, take a look at NEGATIVE positioning with css margin

something like:
Code:

{if $discount gt 0}
<div style="margin-top: -300px;" class="SaveMoneyLabel">
<span id="save_percent">{$discount}%</span>
</div>
{/if}


Negative positioning can really be a mind-f*%k, so be careful out there!

Google "negative margin css" and see what you find...

http://www.communitymx.com/content/article.cfm?cid=b0029

Jeremy

amy2203 08-10-2009 06:28 AM

Re: css positioning
 
I've got that, the problem is that at the moment the div is below the product description, which varies in size.

I want the div to appear at the top of the product description. I can't just move the div in the tpl as the variable it is testing ($discount) is not set higher up the tpl.

to move it with the negative value, the value would have to vary as the product description length varies, to put it above the description.

still looking for a solution,

Thanks

carpeperdiem 08-10-2009 07:57 AM

Re: css positioning
 
Amy,

Try: explore the "capture" smarty command ???

amy2203 08-10-2009 08:03 AM

Re: css positioning
 
not sure how this would work?

It seems like it allows you to 'move' template features down, I need to move the smarty stuff up, so the discount is caculated earlier, then I can just move the div up, or I need to move the div up so it's in the place I 'd like.

I'm not sure why $discount isn't calculated in the php and passed to the template, rather than being calculated in the template. I would have though the discount calulation was a php function instead of a display function,


All times are GMT -8. The time now is 10:59 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.