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)
-   -   How to show "New Arrival!" Icon (https://forum.x-cart.com/showthread.php?t=8589)

jin 07-22-2004 04:46 PM

How to show "New Arrival!" Icon
 
Hi everyone.

I would like to show a little "New Arrival!" graphic icon or text next to the product name in product list and product's detail page.
And I want this icon to show up with products which were added recently(i.e. lastweek, in last 21days, et cetra...).
Could anyone tell me how to do this?

dsparks 07-23-2004 03:54 PM

I have been using the following code for over a year. The source below is from my current store version 3.54.

You only need to change one file and add a small graphic image to display the "New" status on items that were added in the last "so many days". I added the image right after where the item title is displayed. I'm sure you can move it anywhere you would like. My image size is 31x12.

The following code will show the "New" icon if the item was added 20 days or less ago.

1. Add your graphic file in folder "skin1/images". I named my graphic file "skin1/images/mynew.gif". Shown below is the icon I use.

http://www.CabdCollectibles.com/store/skin1/images/mynew.gif

2. The file "skin1/customer/main/products.tpl" was changed to add the following code. Just insert the following code after line 12:

Code:

{* // 60 * 60 * 24 * 20 days in unix time = 1728000  *}
{if ($products[product].add_date gt $smarty.now - 1728000) and ($products[product].add_date lt $smarty.now)}
[img]{$ImagesDir}/mynew.gif[/img]
{/if}


>>>>>>>>>> Listed below is the code that is before the above code just for a quick reference point of where to insert the additional code.

Hope it works....


Code:

{* $Id: products.tpl,v 1.36 2003/11/11 14:02:37 svowl Exp $ *}
{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}
{section name=product loop=$products}
<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=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].tmbn_url}
{$lng.lbl_see_details}</a>
/td>
<td valign=top>
{$products[product].product}</font>

{* // 60 * 60 * 24 * 20 days in unix time = 1728000  *}
{if ($products[product].add_date gt $smarty.now - 1728000) and ($products[product].add_date lt $smarty.now)}
[img]{$ImagesDir}/mynew.gif[/img]
{/if}


jin 07-26-2004 03:16 PM

thanks!
 
Sorry for replying late. Didn't notice my post was moved to other section...

Anyway, the code you gave me works totally fine!
Thanks.

24md 09-15-2004 06:48 AM

I have just implemented this addition to my site. It is really useful for highlighting new items.

Thanks for the code.

mosh 12-27-2004 03:38 PM

I can't seem to get it to work. Here is the code, it should be ok.:



{* $Id: products.tpl,v 1.33.2.2 2003/08/26 06:06:22 svowl Exp $ *}
{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}
{section name=product loop=$products}
<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}>{in clude 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>
</td>
<td valign=top>
{$products[product].product}</font>

{* // 60 * 60 * 24 * 20 days in unix time = 1728000б═ *}
{if ($products[product].add_date gt $smarty.now - 1728000) and ($products[product].add_date lt $smarty.now)}
[img]{$ImagesDir}/newstar.gif[/img]
{/if}


<font size=1>




{$products[product].descr|truncate:300:"...":true}


</font>
<hr size=1 noshade width=230 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].list_price gt 0 and $products[product].price lt $products[product].list_price}
{math equation="100-(price/lprice)*100" price=$products[product].price lprice=$products[product].list_price format="%d" assign=discount}
<font class=MarketPrice>{$lng.lbl_market_price}: <s>
{include file="currency.tpl" value=$products[product].list_price}
</s></font>

{/if}
<font class=ProductPrice>{$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].list_price gt 0 and $products[product].price lt $products[product].list_price}, save {$discount}%{/if}{if $config.Taxes.use_vat eq "Y" and $products[product].vat gt "0"}, {$lng.lbl_including_vat} {$products[product].vat}%{/if}
{else}
<font class=ProductPrice>{$lng.lbl_enter_your_price}</font>
{/if}
{/if}
{if $usertype eq "C" and $config.Appearance.buynow_button_enabled eq "Y"}
{include file="customer/main/buy_now.tpl" product=$products[product]}
{/if}
</td></tr>
</table>






{/section}
{else}
{$lng.lbl_no_products_found}
{/if}
{/if}

nfc5382 12-28-2004 02:51 PM

this is great, thanks!

QVS 12-29-2004 02:50 AM

is there a solution for xcart 4 users, this could be quite a handy mod to have if it works :)

cheers

Mary Jo Robins 12-29-2004 05:46 AM

Works in 4.0.9
 
Quote:

Originally Posted by QVS
is there a solution for xcart 4 users, this could be quite a handy mod to have if it works :)

cheers


I am using the same configuration as stated above and it works fime for me. I am now at 4.0.9

QVS 12-29-2004 03:08 PM

Re: Works in 4.0.9
 
Quote:

Originally Posted by Mary Jo Robins
Quote:

Originally Posted by QVS
is there a solution for xcart 4 users, this could be quite a handy mod to have if it works :)

cheers


I am using the same configuration as stated above and it works fime for me. I am now at 4.0.9


excellent, will give it a whirl.....didnt work first time, but maybe missed something :)

rjcbear 12-29-2004 07:44 PM

I copy and paste the code in the location it was suggested and It did not work for me.

any ideas?


Kind regards,
Ricky


All times are GMT -8. The time now is 08:03 AM.

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