View Single Post
  #19  
Old 10-28-2003, 06:04 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Yay! Go to bed Piper, you dunnit! Only thing is you had the forsale condition set to "n" in all instances but it should be as below!

Grey - Disabled product, Red - Out of stock, Yellow - Inventory level of 1

http://www.adpmods.com/graphics/x-ample1.gif

Create a file in skin1/main called products_colors.tpl

Code:
{* $Id: products_colors.tpl,v 1.0 2003/10/26 13:07:50 ADPBoss Exp $ *} {if $products[cat_num].forsale eq "N"} bgcolor="#CCCCCC" {elseif $products[cat_num].forsale eq "Y" and $products[cat_num].avail eq "0"} bgcolor="#FF3333" {elseif $products[cat_num].forsale eq "Y" and $products[cat_num].avail eq "1"} bgcolor="#FFFF99" {/if}

Next you need to add the color formatting tags to your skin1/main/products.tpl file

Code:
{* $Id: products.tpl,v 1.22 2002/11/13 07:17:54 alfiya Exp $ *} {section name=cat_num loop=$products} { if %cat_num.first% } <table border=0> <tr class=TableHead> <td>ID</td> <td>Product</td> {if $usertype eq "A" or $active_modules.Simple_Mode ne ""} <TD>Pos.</TD> {/if} <TD>Quantity</TD> <td colspan=2>Shop price</td> <td nowrap>Your price</td> </tr> {/if} <tr> {* START COLOR CODE MOD *} <td width=1% {include file="main/products_colors.tpl"}>#{$products[cat_num].productid}</td> <td width=99% {include file="main/products_colors.tpl"}> <input type=radio name=productid value="{ $products[cat_num].productid }" { if %cat_num.first% }checked{/if}> <a href="product_modify.php?productid={ $products[cat_num].productid }"> <font class=ItemsList>{ $products[cat_num].product|escape|truncate:35:"...":false}</font> </a> </td> {if $usertype eq "A" or $active_modules.Simple_Mode ne ""} <TD nowrap align=right {include file="main/products_colors.tpl"}><INPUT type=text size=4 maxlength=4 value="{$products[cat_num].orderby}" name="product_orderby[{$products[cat_num].productid}]"></TD> {/if} <TD nowrap align=right {include file="main/products_colors.tpl"}><INPUT type=text size=6 maxlength=6 value="{$products[cat_num].avail}" name="product_avail[{$products[cat_num].productid}]"></TD> <td nowrap align=right {include file="main/products_colors.tpl"}> <font class=ProductPriceConverting>{math equation="price/(1-(discount/100))" price=$products[cat_num].price discount=$products[cat_num].discount format="%.1f" assign=unformatted}{include file="currency.tpl" value=$unformatted}</font> </td> <td nowrap align=right {include file="main/products_colors.tpl"}> <font class=AdvancedDiscount> -{$products[cat_num].discount}%</font> </td> <td nowrap align=right {include file="main/products_colors.tpl"}> {* END COLOR CODE MOD *} <input type="text" size="7" value="{$products[cat_num].price}" name="product_price[{$products[cat_num].productid}]"> </td> </tr> { if %cat_num.last% } </table> {/if} {/section}

You will see that I commented where the code change starts and ends. Basically we are adding

Code:
{include file="main/products_colors.tpl"}

inside all of the TD tags that are on the product information lines.

Now, last change. Because we are using red to mark zero stock products, then we had to change the default admin small message css being used on the Advanced Discount display. I created a new CSS style in skin1.css called "AdvancedDiscount". I used a blue colour for the NEW advanced discount display on this page.

You will see the code on the line that produces the discount % display.

Code:
font class=AdvancedDiscount

That's it. Thank Piper for coming up with a really great idea that all of you developers should be incorporating into your cart builds. To the average Joe E-Commerce merchant, this kind of added UI friendliness is a very cool feature.

** One more note, I have changed the hyperlinking on the product name display in main/products.tpl to link to the modify page rather than the details page. I product modify constantly and this is a nice feature for someone like me. Again, thank Piper for the inspiration.
Reply With Quote