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

Alternate row colours

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 04-03-2003, 10:20 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Would say that

<font color="{cycle values="#cc0000,#ff6600"}">

Obviously replace with the colours that you want.
__________________
ex x-cart guru
Reply With Quote
  #12  
Old 08-03-2003, 10:36 AM
  groovico's Avatar 
groovico groovico is offline
 

X-Man
  
Join Date: Apr 2003
Location: Firetanksoftware.com
Posts: 2,326
 

Default

Quote:
Originally Posted by cmolocznik
Yes it will!

<tr class="{cycle values="alternate1,alternate2"}">

http://smarty.php.net/manual/en/language.function.cycle.php

Now that's a such a smart simple way of doing it.

Ahh those smarty authors just like to show off.
__________________
Groovico

Used by X-carters the world over:
Marketing Manager Pro Bundle For X-cart
Featured Product Manager for X-cart
Feed manager pro for X-cart

http://www.firetanksoftware.com

Celebrating 7 Years of providing quality X-cart Add ons and X-cart Mods for x-cart 3.X to X-cart 4.4.X
Reply With Quote
  #13  
Old 10-22-2003, 09:27 AM
 
Scurvy Scurvy is offline
 

Member
  
Join Date: Apr 2003
Posts: 15
 

Default

This is pretty cool but I have a question. Where would I put this snippet (Funkydunk's) in the following?: This is the code for 2 columns of products from post http://forum.x-cart.com/viewtopic.php?t=287&postdays=0&postorder=asc&start =0

Code:
<table border=0 width=100%><tr><td> <table border=0 width=100%> {section name=product loop=$products} {if $smarty.section.product.index is div by 2} </tr><tr valign="top"> {/if} <td valign="top"{if $smarty.section.product.index is div by 2} class="alternate1"{else} class="alternate2"{/if}> <table border=0 width=100%><tr> <td width=90 align=center valign=top><a href=product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}>{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=70 product=$products[product].product} { $lng.lbl_see_details }</a></td> <td valign=top>{$products[product].product|escape}</font> <font class=ProductTitle></font><font size=1> {$products[product].descr|truncate:100:"...":true} </font><hr size=1 noshade width=130 align=left> {if $active_modules.Subscriptions ne "" and $products[product].catalogprice} {include file="modules/Subscriptions/subscription_info_inlist.tpl"} {else} {if $products[product].price ne 0} {if $products[product].discount ne 0} <font class=MarketPrice>{$lng.lbl_market_price}: <s>{math equation="(price/(100-discount))*100" price=$products[product].price discount=$products[product].discount format="%d.00" assign=unformatted}{include file="currency.tpl" value=$unformatted}</s></font> {/if} <font class=ProductTitle>{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].price}</font><font class=MarketPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].price}</font>{if $products[product].discount ne 0}, save {$products[product].discount}%{/if} {else} <font class=ProductTitle>{$lng.lbl_enter_your_price}</font> {/if} {/if} </td></tr> </table> </td> {/section} </td></tr></table> </td></tr></table>
If I keep it where it is (about line 10), I get the right column in all grey but the left column is white. I think because of the way the products are listed in a multi column view:

product1 | product2
product3 | product4

whereas in a single column it would be:
product1
product2
product3
etc.
I've tried it in the <table> <tr> and <td> tags with no success.
Any advice is welcome,
Scurvy[/url]
Reply With Quote
  #14  
Old 10-22-2003, 05:44 PM
 
Scurvy Scurvy is offline
 

Member
  
Join Date: Apr 2003
Posts: 15
 

Default

Figured it out with some help from my bro.
We used BOOMER's multi column layout mod and cmolocznik's smarty alternate row colors

In Edit Templates -> customer/main/products.tpl
If you're using Boomer's multi column mod just add
bgcolor="{cycle values="#F7F5EE,#EFEFEF"}">
{/if}
to the code in the second <tr> tag.
Change this:
Code:
<table border=0 width=100%><tr><td> <table border=0 width=100%> {section name=product loop=$products} {if $smarty.section.product.index is div by 2} </tr><tr valign="top"> <td valign="top">
to....
Code:
<table border=0 width=100%><tr><td> <table border=0 width=100%> {section name=product loop=$products} {if $smarty.section.product.index is div by 2} </tr><tr valign="top" bgcolor="{cycle values="#F7F5EE,#EFEFEF"}"> {/if} <td valign="top">
in the very first section of the code. The rest is the same as he posted.
The tricky part (for me at least) was finding the right <tr> or <table> or <td> to put it in.
Works like a charm folks. Congrats and much thanks for your knowledge
Reply With Quote
  #15  
Old 05-02-2005, 01:12 AM
 
WPOO WPOO is offline
 

Advanced Member
  
Join Date: May 2004
Location: Delft - Netherlands -
Posts: 31
 

Default sytle doesn't work with background hover

Thanks I used this to alternate colors but i can not seam to get it to work with hover. below is a example of the code i am using.

skin1.css
Code:
.alternate1{ BACKGROUND-COLOR: #FFFFFF; } .alternate1:hover{ BACKGROUND-COLOR: #000000; } .alternate2{ BACKGROUND-COLOR: #D9D9D9; } .alternate2:hover{ BACKGROUND-COLOR: #000000; }

is there a way to do this.

Thanks in advance. This is a very old but usefull post.

Regards WP
__________________
X-Cart Gold 4.13
X-Configurator
X-ROM
Easy Checkout
Reply With Quote
  #16  
Old 05-02-2005, 05:47 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

Code:
<table border=0 width=100%> {section name=product loop=$products} {if $smarty.section.product.index is div by 2} </tr><tr valign="top" class="{cycle values="alternate1,alternate2"}"> {/if} <td valign="top">

May want to try it on TD tags if hover isn't working. or define the CSS more with TR.alternate1 instead of .alternate1
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #17  
Old 05-02-2005, 10:55 AM
 
WPOO WPOO is offline
 

Advanced Member
  
Join Date: May 2004
Location: Delft - Netherlands -
Posts: 31
 

Default Thanks for the reply but where can i do this.

Here is my example.

http://www.shop4u.nl/home.php?cat=24

I need them to change color when i go over them. Here is part of the code aswel

Code:
{section name=product loop=$products} {assign var="discount" value=0}<table style="border-bottom:solid #999999 1.0pt" width="96%" border="0" cellspacing="0" cellpadding="0" align="center"> <tr bgcolor="{cycle values="#FFFFFF,#F3F3F3"}"> <td width="2%"></td> <td width="15%"> <div align="left"> <FONT class="SmallListMenu">{$products[product].productcode}</FONT></div> </td> <td width="40%"> <div align="left"> {* {if $active_modules.Special_Offers ne "" and $products[product].have_offers} {include file="modules/Special_Offers/customer/product_offer_thumb.tpl" product=$products[product]} {$lng.lbl_see_details} {else} <A href="product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}{if $featured eq 'Y'}&featured{/if}">{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].tmbn_url} {$lng.lbl_see_details}</A> {/if}

Thanks WP
__________________
X-Cart Gold 4.13
X-Configurator
X-ROM
Easy Checkout
Reply With Quote
  #18  
Old 05-02-2005, 11:58 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

You'll need:
Code:
{literal} <script language="JavaScript"><!-- function classChange(element,newclass) { element.className = newclass; } //--></script>

Then use onMouseOver and onMouseOut like this on your <TD>
Code:
{section name=product loop=$products} <TD onMouseOver="classChange(row{$products[product].productid}{%product.index%},'rowon')" onMouseOut="classChange(row{$products[product].productid}{%product.index%},'rowoff')">
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #19  
Old 05-02-2005, 01:31 PM
 
WPOO WPOO is offline
 

Advanced Member
  
Join Date: May 2004
Location: Delft - Netherlands -
Posts: 31
 

Default Where do I do this?

Thanks for the message but where do i put the code. I tried this but it doesn't seam to work.

Code:
{* $Id: products.tpl,v 1.45.2.11 2004/12/01 15:15:49 mclap Exp $ *} {if $active_modules.Feature_Comparison ne '' && $products && $printable ne 'Y'} {include file="modules/Feature_Comparison/compare_selected_button.tpl"} {include file="modules/Feature_Comparison/products_check_js.tpl"} {/if} {if $usertype eq "C" and $config.Appearance.products_per_row ne "" and $config.Appearance.products_per_row gt 0 and $config.Appearance.products_per_row lt 4 and ($featured eq "Y" or $config.Appearance.featured_only_multicolumn eq "N")} {include file="customer/main/products_t.tpl" products=$products} {else} {if $products} <table height="23" width="96%" border="0" cellspacing="0" cellpadding="0" align="center" background="{$ImagesDir}/custom/menu_head_bg.gif"> <tr> <td width="2%"></td> <td width="15%"> <div class="MenuListTitle" align="left"> Art Nr.</div> </td> <td width="40%"> <div class="MenuListTitle" align="left"> Artikel</div> </td> <td width="12%"> <div class="MenuListTitle" align="left"> {if $login ne ""} Jouw Prijs {else} Normale Prijs {/if} </div> </td> <td width="12%"> <div class="MenuListTitle" align="left"> {if $login ne ""} Jouw Prijs {else} Studenten Prijs {/if} </div> </td> <td width="4%"> <div class="MenuListTitle" align="left"> Info</div> </td> <td width="11%"> <div class="MenuListTitle" align="left"> Levertijd</div> </td> </tr> </table> {literal} <script language="JavaScript"><!-- function classChange(element,newclass) { element.className = newclass; } </script> {section name=product loop=$products} {assign var="discount" value=0}<table style="border-bottom:solid #999999 1.0pt" width="96%" border="0" cellspacing="0" cellpadding="0" align="center"> <TD onMouseOver="classChange(row{$products[product].productid}{%product.index%},'rowon')" onMouseOut="classChange(row{$products[product].productid}{%product.index%},'rowoff')" width="2%"></td> <td width="15%"> <div align="left"> <FONT class="SmallListMenu">{$products[product].productcode}</FONT></div> </td> <td width="40%"> <div align="left"> {* {if $active_modules.Special_Offers ne "" and $products[product].have_offers} {include file="modules/Special_Offers/customer/product_offer_thumb.tpl" product=$products[product]} {$lng.lbl_see_details} {else} <A href="product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}{if $featured eq 'Y'}&featured{/if}">{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].tmbn_url} {$lng.lbl_see_details}</A> {/if} *} <FONT class="SmallListMenu">{$products[product].product}</FONT></div> </td> <td width="12%"> <div align="left"> {if $products[product].product_type eq "C"} {include file="buttons/details.tpl" href="product.php?productid=`$products[product].productid`&cat=`$cat`&page=`$navigation_page`"} {else} {if $active_modules.Subscriptions ne "" and $products[product].catalogprice} {include file="modules/Subscriptions/subscription_info_inlist.tpl"} {else} {if $products[product].taxed_price ne 0} {if $products[product].list_price gt 0 and $products[product].taxed_price lt $products[product].list_price} {math equation="100-(price/lprice)*100" price=$products[product].taxed_price lprice=$products[product].list_price format="%d" assign=discount} {if $discount gt 0} <FONT class="MarketPriceSale">{$lng.lbl_actie_price}</FONT><FONT class="MarketPrice"><S> {include file="currency.tpl" value=$products[product].list_price} </S> </FONT> {/if} {/if} <FONT class="ProductPriceList">{include file="currency.tpl" value=$products[product].taxed_price}</FONT></div> </td> <td width="12%"> <div align="left"> {if $login ne ""} {if $discount gt 0}<FONT class="StudentenPriceListSale">{$discount}% {$lng.lbl_save_price_extra} </FONT>{/if} <FONT class="StudentenPriceListSale">{include file="currency.tpl" value=$products[product].taxed_price}</FONT> {else} {if $discount gt 0}<FONT class="StudentenPriceListSale">{$discount}% {$lng.lbl_save_price_extra_nonmem} </FONT>{/if} <FONT class="StudentenPriceListSale">{include file="currency.tpl" value=$products[product].taxed_price/1.05}</FONT>{/if} {* {include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].taxed_price} *} {* {if $discount gt 0}<FONT class="ProductPriceSmall">{$lng.lbl_save_price_extra} {$discount}%</FONT>{/if} {if $products[product].taxes}</FONT> <TABLE border="0"> <TR> <TD>[img]{$ImagesDir}/spacer.gif[/img]</TD> <TD>{include file="customer/main/taxed_price.tpl" taxes=$products[product].taxes} </TR> </TABLE> {/if} *} </div> </td> <td width="4%"> <div align="center"> [img]{$ImagesDir}/info.gif[/img]</div> </td> <td width="11%"> <div align="left"> <font class="SmallListMenu"> {if $products[product].avail > 0 && $products[product].avail gt 9000} <font color="red">Op Bestelling</font> {elseif $products[product].avail > 0 && $products[product].avail gt 900} <font color="orange">In Bestelling</font> {elseif $products[product].avail > 0 } <font color="green">Op Voorraad </font> {else} <font color="blue">2-3 dagen</font> {/if} </font> </div> </td> </tr> </table> {else} <FONT class="ProductPriceList">BEL NU</FONT></div> </td> <td width="12%"> <div align="left"> <FONT class="StudentenPriceList">BEL NU</FONT> </div> </td> <td width="4%"> <div align="center"> [img]{$ImagesDir}/info.gif[/img] </div> </td> <td width="11%"> <div align="left"> <FONT class="SmallListMenu"> {if $products[product].avail > 0 && $products[product].avail gt 9000} <font color="red">Op Bestelling</font> {elseif $products[product].avail > 0 && $products[product].avail gt 900} <font color="orange">In Bestelling</font> {elseif $products[product].avail > 0 } <font color="green">Op Voorraad </font> {else} <font color="blue">2-3 dagen</font> {/if} </font> </div> </td> </tr> </table> {/if} {/if} {/if} {/section} {if $active_modules.Feature_Comparison ne '' && $products && $printable ne 'Y'} {include file="modules/Feature_Comparison/compare_selected_button.tpl"} {/if} {else} {$lng.txt_no_products_found} {/if} {/if}

in products.tpl

Thanks again
__________________
X-Cart Gold 4.13
X-Configurator
X-ROM
Easy Checkout
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 09:25 PM.

   

 
X-Cart forums © 2001-2020