Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

css positioning

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-10-2009, 03:26 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default 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
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #2  
Old 08-10-2009, 04:06 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default 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
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #3  
Old 08-10-2009, 06:28 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default 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
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #4  
Old 08-10-2009, 07:57 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: css positioning

Amy,

Try: explore the "capture" smarty command ???
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #5  
Old 08-10-2009, 08:03 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default 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,
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:22 PM.

   

 
X-Cart forums © 2001-2020