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

How to show "New Arrival!" Icon

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 07-22-2004, 04:46 PM
 
jin jin is offline
 

Member
  
Join Date: Jul 2004
Posts: 12
 

Default 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?
Reply With Quote
  #2  
Old 07-23-2004, 03:54 PM
 
dsparks dsparks is offline
 

Advanced Member
  
Join Date: Nov 2002
Posts: 34
 

Default

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}
Reply With Quote

The following 2 users thank dsparks for this useful post:
am2003 (03-26-2011), lash (11-08-2009)
  #3  
Old 07-26-2004, 03:16 PM
 
jin jin is offline
 

Member
  
Join Date: Jul 2004
Posts: 12
 

Default 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.
Reply With Quote
  #4  
Old 09-15-2004, 06:48 AM
 
24md 24md is offline
 

Advanced Member
  
Join Date: Jul 2003
Location: United Kingdom
Posts: 44
 

Default

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

Thanks for the code.
__________________
www.anime-on-line.com
4.5.2 (live)
php 5.3.17
mysql 5.5.27
Reply With Quote
  #5  
Old 12-27-2004, 03:38 PM
 
mosh mosh is offline
 

Member
  
Join Date: Apr 2004
Posts: 22
 

Default

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}
__________________
X-Cart version 4.0.7
Reply With Quote
  #6  
Old 12-28-2004, 02:51 PM
 
nfc5382 nfc5382 is offline
 

X-Adept
  
Join Date: Nov 2002
Posts: 480
 

Default

this is great, thanks!
__________________
-----------------------
x-cart v4.7.6 [LIVE]
x-cart v4.0.18 [retired 2004-2016]
x-cart v3.5.13 [retired]
x-cart v3.4.14 [retired]
Reply With Quote
  #7  
Old 12-29-2004, 02:50 AM
 
QVS QVS is offline
 

Senior Member
  
Join Date: Nov 2004
Posts: 136
 

Default

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

cheers
__________________
xcart version 4.1.6
UK - Brighton

QVS ELECTRICAL SUPPLIES - http://www.qvsdirect.com

We supply a huge range of cables, electrical accessories, heating, ventilation, fire and security products, consumer units & circuit distribution, indoor and outdoor lighting, showers and water heating, tools and fixings, timer switches, sockets, switches, air conditioning, trunking, and much much more.
Reply With Quote
  #8  
Old 12-29-2004, 05:46 AM
 
Mary Jo Robins Mary Jo Robins is offline
 

Advanced Member
  
Join Date: Aug 2003
Location: Virginia Beach, VA 23462
Posts: 87
 

Default 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
__________________
X-Cart version 4.0.14
Sales-n-Stats 1.1 build 36
PHP 5.0.5
MySQL server 4.1.22-Standard
Perl 5.008
Reply With Quote
  #9  
Old 12-29-2004, 03:08 PM
 
QVS QVS is offline
 

Senior Member
  
Join Date: Nov 2004
Posts: 136
 

Default 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
__________________
xcart version 4.1.6
UK - Brighton

QVS ELECTRICAL SUPPLIES - http://www.qvsdirect.com

We supply a huge range of cables, electrical accessories, heating, ventilation, fire and security products, consumer units & circuit distribution, indoor and outdoor lighting, showers and water heating, tools and fixings, timer switches, sockets, switches, air conditioning, trunking, and much much more.
Reply With Quote
  #10  
Old 12-29-2004, 07:44 PM
  rjcbear's Avatar 
rjcbear rjcbear is offline
 

X-Adept
  
Join Date: Jun 2004
Location: Alabama,U.S.A
Posts: 503
 

Default

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

any ideas?


Kind regards,
Ricky
__________________
X-CART Gold version 4.0.14 & 4.1.11
Apache Version 1.3.29 (Unix)
EWDHosting-Quality X-cart Hosting
We will always sell you the right shoe and the left one is free.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 02:39 PM.

   

 
X-Cart forums © 2001-2020