X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Color coded order status... (https://forum.x-cart.com/showthread.php?t=4949)

enge919 11-07-2003 11:38 PM

OK, I got the list price to show but still not the discount. only shows -%

Heres the code I have

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>List 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"}>
{if $products[cat_num].list_price gt 0}
{math equation="100-(price/lprice)*100" price=$products[cat_num].price lprice=$products[cat_num].list_price format="%d" assign=discount}
<font class=ProductPriceConverting>{include file="currency.tpl" value=$products[cat_num].list_price}</font>
{else}
<font class=ProductPriceConverting>{include file="currency.tpl" value=$products[cat_num].price}</font>
{/if}
</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}


This is what I actually changed (or added) in the code supplied for this mod:

Code:

{if $products[cat_num].list_price gt 0}
{math equation="100-(price/lprice)*100" price=$products[cat_num].price lprice=$products[cat_num].list_price format="%d" assign=discount}
<font class=ProductPriceConverting>{include file="currency.tpl" value=$products[cat_num].list_price}</font>
{else}
<font class=ProductPriceConverting>{include file="currency.tpl" value=$products[cat_num].price}</font>
{/if}


Again, thanks in advance!

adpboss 11-08-2003 02:33 AM

What version are you running? You need to put your version and server type in your forum signature. It's tough to help someone if we don't know what they are running.

Did you copy the whole products.tpl verbatim or just change the tags?

I don't understand the code you posted that you changed. It has nothing to do with this mod. We are adding smarty tags to the cell formatting by inserting the smarty include in the TD tags. That and adding the NEW AdvancedDiscount CSS.

enge919 11-08-2003 09:48 AM

I cipied the whole thing verbatim and then noticed the list price (or shop price as it showed after the change) was 0.00 and the discount was -%, being the kinda guy I am, I backed everytinhg up first and then started tearing apart code. Afterall how else do I learn?

So after copying the code verbatim and seeing the list price and discount not working, I started analyzing the original code vs. the modified code and came up with the chunk of code I included, that was in the original code.

In short, using the supplied code in 3.4.8, the list price and discount no longer came up.....hmmmmm

adpboss 11-08-2003 09:53 AM

Do you think it could be that you copied my 3.3.8 code and used it for your version?

If you want to implement this mod, I would recommend going into your original products file and manually adding the tags. If you were using 3.3.8 you may be able to shortcut by copying the code but across release versions it is bound to have issues.

I only provided my products code to show all of the instances where I had to add the tags.

Good Luck!

enge919 11-08-2003 10:07 AM

Nevermind......

ADVICE FOR NEWBIES that are really trying to learn how to manipulate the code in X-Cart and think it seems impossible and when you think it makes absolutely no sense do this:

Step back a minute
Take a deep breath


and...............READ THE CODE!


adpBoss, forget everything I said and did in this post. I'm getting better! I just read the code and made a couple changes and everything works just fine. Thanks to all for this mod (and the orders.tpl mod)..They make x-cart a better experience..

adpboss 11-08-2003 10:12 AM

No problem.

We all have to start somewhere and trust me, staring at your cart code for hours on end will make everything seem difficult and confusing.

Sometimes going for a walk and coming back to a problem can work miracles.

Good Luck with your store! :D

nfc5382 11-10-2003 02:57 PM

love it!!!!

BoomBoomBap 11-10-2003 10:15 PM

Custom order date format
 
Not really wanting to create a new topic for this so Im posting it in the forum that inspired me. Sweet mod in this forum I might add!

Anyhow, here's my mod:

Code:

{$orders[cat_num].date|date_format:"%h. %d, %Y - %r"}

This will display your orders in the following format:
Nov. 10, 2003 - 06:33:21 PM

Here's a useful page for further date customizations:
http://unix.about.com/library/weekly/aa042301a.htm

magnumkp 11-11-2003 03:47 AM

Shame I missed this thread earlier. Some good mods here, makes life much easier. \:D/

wild boar 12-10-2003 09:09 PM

Thanks pipercub.. this makes life easier..


All times are GMT -8. The time now is 05:35 PM.

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