Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Label "New" Rate Topic   - - - - -

 
  • Andrew77
  • Member
  • Members
  • Join Date: 11-Sep 08
  • 98 posts

Posted 14 October 2008 - 11:33 PM #1

Hello
I'd like that at all new goods was displayed label "NEW". How it can be made?
In advance thanks
Andrey

 
  • customfx
  • Senior Member
  • Members
  • Join Date: 19-Jun 07
  • 117 posts

Posted 14 October 2008 - 11:54 PM #2

Yea good idea.

Just to add to it, it would be good to have the 'new' label generate automatically based on the product Create Date and then to be removed after 'x' days.

The label should be visible at the Category level and the Product Details page.

Cheers,
Greg

 
  • Andrew77
  • Member
  • Members
  • Join Date: 11-Sep 08
  • 98 posts

Posted 15 October 2008 - 06:14 PM #3

I'd be very grateful for the decision of the given problem

 
  • mdekok3000
  • Senior Member
  • Members
  • Join Date: 06-Feb 08
  • 883 posts

Posted 15 October 2008 - 08:50 PM #4

I believe this trick should work. It did for me. Backup your original copies first though.

1. First put an image "new.gif" into the "skins/CLIENT_SKIN/customer/images" directory.

2. Run this SQL command on your database.

INSERT INTO `cscart_settings` (`option_id`,`option_name`,`section_id`,`subsection_id`,`option_type`,`value`,`position`,`is_global`) VALUES (1000000,'new_label_period','Appearance','','I','0',181,'Y');
INSERT INTO `cscart_settings_descriptions` (`object_id`,`description`,`object_type`,`lang_code`,`object_string_id`) VALUES (1000000,'\"New\" label period','O','EN','');
3. For the product_details.tpl and products.tpl/products_advanced.tpl/products_multicolumns.tpl files, add this code where you want the image to show up:

{php}
$new_period = $settings['Appearance']['new_label_period'];
$prod = $this->get_template_vars('product');
$dbd = max(0,date('U') - db_get_field('SELECT timestamp FROM cscart_products WHERE product_id = ' . $prod['product_id'] . ';')) / 86400;
if($new_period >= $dbd) {
    $this->assign('new','Y');
} else {
    $this->assign('new','N');
}
{/php}
{if $new == "Y"}
<img src="{$images_dir}/new.gif" style="vertical-align:middle;" />
{/if}
4. Set the number of days in Appearance Settings. 0 will make no "new" icons appear at all.
[SIZE=2]
[/SIZE]

 
  • customfx
  • Senior Member
  • Members
  • Join Date: 19-Jun 07
  • 117 posts

Posted 15 October 2008 - 10:35 PM #5

Many thanks Matt for your time...and skills.

I'll give it a whirl today and let you all know :)

 
  • Darius
  • Douchebag
  • Members
  • Join Date: 20-Apr 08
  • 3349 posts

Posted 16 October 2008 - 05:04 AM #6

Great mod! Haven't tested it yet.

Is there a way to have newly listed in categories as default sorting?

Thank you.

 
  • mdekok3000
  • Senior Member
  • Members
  • Join Date: 06-Feb 08
  • 883 posts

Posted 16 October 2008 - 09:25 AM #7

1. Add a language variable:

date_added = Newly listed

2. In "/include/common/search_products.php"

ADD THE PART IN RED BELOW

$sortings = array (
    'code' => 'products.product_code',
    'avail' => 'products.avail',
[COLOR=#ff0000]    'timestamp' => 'products.timestamp',[/COLOR]
    'product' => 'descr1.product',
    'position' => ($settings['General']['improved_product_search'] == 'Y') ? 'avail_products.position' : 'products_categories.position',
    'price' => 'prices.price',
    'list_price' => 'products.list_price',
    'weight' => 'products.weight',
    'amount' => 'products.amount'
);
3. In "/skins/CLIENT_SKIN/customer/product_pages/sorting.tpl"

ADD THE PART IN RED BELOW

<div align="right">
 <b>{$lang.sort_by}:</b>   
 [COLOR=red]<a class="underlined{if $sort_by == 'timestamp'}-bold{/if}" href="{$curl}&sort_by=product&amp;sort_order={if $sort_by == 'timestamp'}{$sort_order}{else}desc{/if}" {$onclick} rel="nofollow">{$lang.date_added}{if $sort_by == 'timestamp'}{if $sort_order == 'asc'}<img src="{$images_dir}/sort_desc.gif" width="13" height="7" border="0" alt="" style="margin-left: 5px;" />{else}<img src="{$images_dir}/sort_asc.gif" width="13" height="7" border="0" alt="" style="margin-left: 5px;" />{/if}{/if}</a>    [/COLOR]
 <a class="underlined{if $sort_by == 'product'}-bold{/if}" href="{$curl}&sort_by=product&amp;sort_order={if $sort_by == 'product'}{$sort_order}{else}asc{/if}" {$onclick} rel="nofollow">{$lang.product}{if $sort_by == 'product'}{if $sort_order == 'asc'}<img src="{$images_dir}/sort_desc.gif" width="13" height="7" border="0" alt="" style="margin-left: 5px;" />{else}<img src="{$images_dir}/sort_asc.gif" width="13" height="7" border="0" alt="" style="margin-left: 5px;" />{/if}{/if}</a>    
 <a class="underlined{if $sort_by == 'price'}-bold{/if}" href="{$curl}&sort_by=price&amp;sort_order={if $sort_by == 'price'}{$sort_order}{else}asc{/if}" {$onclick} rel="nofollow">{$lang.price}{if $sort_by == 'price'}{if $sort_order == 'asc'}<img src="{$images_dir}/sort_desc.gif" width="13" height="7" border="0" alt="" style="margin-left: 5px;" />{else}<img src="{$images_dir}/sort_asc.gif" width="13" height="7" border="0" alt="" style="margin-left: 5px;" />{/if}{/if}</a>    
 <a class="underlined{if $sort_by == 'position'}-bold{/if}" href="{$curl}&sort_by=position&amp;sort_order={if $sort_by == 'position'}{$sort_order}{else}asc{/if}" {$onclick} rel="nofollow">{$lang.default}</a>    
</div>

[SIZE=2]
[/SIZE]

 
  • Andrew77
  • Member
  • Members
  • Join Date: 11-Sep 08
  • 98 posts

Posted 16 October 2008 - 03:44 PM #8

Many many thanks!!! Great mod

 
  • Andrew77
  • Member
  • Members
  • Join Date: 11-Sep 08
  • 98 posts

Posted 22 October 2008 - 08:29 AM #9

mdekok3000, can you help me?
When "Position short" = 0 for goods in admin, mod work great, but when I sort the goods (1,2,3 and ...) the label is duplicated on all goods and correctly does not work, that is change of date of addition of the goods in what does not result
Many thanks

 
  • mdekok3000
  • Senior Member
  • Members
  • Join Date: 06-Feb 08
  • 883 posts

Posted 22 October 2008 - 04:07 PM #10

Try the changes on step 3 for the "new" label and step 2 for the sorting.
[SIZE=2]
[/SIZE]

 
  • Andrew77
  • Member
  • Members
  • Join Date: 11-Sep 08
  • 98 posts

Posted 22 October 2008 - 05:34 PM #11

I'm sorry but i'm newbie. What lines I should change? Thanks

 
  • mdekok3000
  • Senior Member
  • Members
  • Join Date: 06-Feb 08
  • 883 posts

Posted 22 October 2008 - 07:08 PM #12

For the "new" label,

add the part in red below:

{php}
$new_period = $settings['Appearance']['new_label_period'];
$prod = $this->get_template_vars('product');
$dbd = max(0,date('U') - db_get_field('SELECT timestamp FROM cscart_products WHERE product_id = ' . $prod['product_id'] . ';')) / 86400;
if($new_period >= $dbd) {
    $this->assign('new','Y');
[COLOR=Red]} else {
    $this->assign('new','N');[/COLOR]
}
{/php}
{if $new == "Y"}
<img src="{$images_dir}/new.gif" style="vertical-align:middle;" />
{/if}
For the sorting, change the red part below

$sortings = array (
    'code' => 'products.product_code',
    'avail' => 'products.avail',
[COLOR=#ff0000]    'timestamp' => 'products.timestamp',[/COLOR]
    'product' => 'descr1.product',
    'position' => ($settings['General']['improved_product_search'] == 'Y') ? 'avail_products.position' : 'products_categories.position',
    'price' => 'prices.price',
    'list_price' => 'products.list_price',
    'weight' => 'products.weight',
    'amount' => 'products.amount'
);

[SIZE=2]
[/SIZE]

 
  • Andrew77
  • Member
  • Members
  • Join Date: 11-Sep 08
  • 98 posts

Posted 22 October 2008 - 09:20 PM #13

It works perfectly! Many thanks

 
  • mirnitagl
  • Senior Member
  • Members
  • Join Date: 19-Nov 06
  • 334 posts

Posted 19 April 2009 - 05:54 PM #14

Hi! I have followed instructions step by step, yet it is not working in my store.
I have just added new products top see it working but no results.

Just to make myself sure: the new.gif must be stored in myskin/customer/images,right?

One more question, where do you place the new image? I know it depends on people's choice and likes but I'd like to know where you place, for me it'd be ideal to have it where the red label goes but then I may have problems if the 2 images must appear together.

Please, let me know if you continue using this mod, I'd like to see some live examples.

 
  • Darius
  • Douchebag
  • Members
  • Join Date: 20-Apr 08
  • 3349 posts

Posted 22 April 2009 - 11:30 AM #15

For me this code only partly work

<a class="underlined{if $sort_by == 'timestamp'}-bold{/if}" href="{$curl}&sort_by=[COLOR="Red"]product[/COLOR]&amp;sort_order={if $sort_by == 'timestamp'}{$sort_order}{else}desc{/if}" {$onclick} rel="nofollow">{$lang.date_added}{if $sort_by == 'timestamp'}{if $sort_order == 'asc'}<img src="{$images_dir}/sort_desc.gif" width="13" height="7" border="0" alt="" style="margin-left: 5px;" />{else}<img src="{$images_dir}/sort_asc.gif" width="13" height="7" border="0" alt="" style="margin-left: 5px;" />{/if}{/if}</a>    

products mudst be named to timestamp.

Also

&amp;
must be & for aquarelle green template


Also this gives only sorting option, how can code be adjusted so default sort criteria would be "Newly listed" meaning when you enter category it shows you what is added most recently?


1. Add a language variable:

date_added = Newly listed

2. In "/include/common/search_products.php"

ADD THE PART IN RED BELOW

$sortings = array (
    'code' => 'products.product_code',
    'avail' => 'products.avail',
[COLOR=#ff0000]    'timestamp' => 'products.timestamp',[/COLOR]
    'product' => 'descr1.product',
    'position' => ($settings['General']['improved_product_search'] == 'Y') ? 'avail_products.position' : 'products_categories.position',
    'price' => 'prices.price',
    'list_price' => 'products.list_price',
    'weight' => 'products.weight',
    'amount' => 'products.amount'
);
3. In "/skins/CLIENT_SKIN/customer/product_pages/sorting.tpl"

ADD THE PART IN RED BELOW

<div align="right">
 <b>{$lang.sort_by}:</b>   
 [COLOR=red]<a class="underlined{if $sort_by == 'timestamp'}-bold{/if}" href="{$curl}&sort_by=product&amp;sort_order={if $sort_by == 'timestamp'}{$sort_order}{else}desc{/if}" {$onclick} rel="nofollow">{$lang.date_added}{if $sort_by == 'timestamp'}{if $sort_order == 'asc'}<img src="{$images_dir}/sort_desc.gif" width="13" height="7" border="0" alt="" style="margin-left: 5px;" />{else}<img src="{$images_dir}/sort_asc.gif" width="13" height="7" border="0" alt="" style="margin-left: 5px;" />{/if}{/if}</a>    [/COLOR]
 <a class="underlined{if $sort_by == 'product'}-bold{/if}" href="{$curl}&sort_by=product&amp;sort_order={if $sort_by == 'product'}{$sort_order}{else}asc{/if}" {$onclick} rel="nofollow">{$lang.product}{if $sort_by == 'product'}{if $sort_order == 'asc'}<img src="{$images_dir}/sort_desc.gif" width="13" height="7" border="0" alt="" style="margin-left: 5px;" />{else}<img src="{$images_dir}/sort_asc.gif" width="13" height="7" border="0" alt="" style="margin-left: 5px;" />{/if}{/if}</a>    
 <a class="underlined{if $sort_by == 'price'}-bold{/if}" href="{$curl}&sort_by=price&amp;sort_order={if $sort_by == 'price'}{$sort_order}{else}asc{/if}" {$onclick} rel="nofollow">{$lang.price}{if $sort_by == 'price'}{if $sort_order == 'asc'}<img src="{$images_dir}/sort_desc.gif" width="13" height="7" border="0" alt="" style="margin-left: 5px;" />{else}<img src="{$images_dir}/sort_asc.gif" width="13" height="7" border="0" alt="" style="margin-left: 5px;" />{/if}{/if}</a>    
 <a class="underlined{if $sort_by == 'position'}-bold{/if}" href="{$curl}&sort_by=position&amp;sort_order={if $sort_by == 'position'}{$sort_order}{else}asc{/if}" {$onclick} rel="nofollow">{$lang.default}</a>    
</div>



 
  • mirnitagl
  • Senior Member
  • Members
  • Join Date: 19-Nov 06
  • 334 posts

Posted 23 April 2009 - 10:52 PM #16

As this mod didn't work out for me I'm deleting the changes I made. For the tpl files is easy, I had saved the files before the changes.

For the database, can anyone confirm if this would be the appropiate statement?

DELETE FROM `cscart_settings` WHERE (`option_id`,`option_name`,`section_id`,`subsection_id`,`option_type`,`value`,`position`,`is_global`) VALUES (1000000,'new_label_period','Appearance','','I','0',181,'Y');
DELETE FROM `cscart_settings_descriptions` WHERE (`object_id`,`description`,`object_type`,`lang_code`,`object_string_id`) VALUES (1000000,'\"New\" label period','O','EN','');

 
  • Darius
  • Douchebag
  • Members
  • Join Date: 20-Apr 08
  • 3349 posts

Posted 24 April 2009 - 04:46 AM #17

As this mod didn't work out for me I'm deleting the changes I made. For the tpl files is easy, I had saved the files before the changes.

For the database, can anyone confirm if this would be the appropiate statement?

DELETE FROM `cscart_settings` WHERE (`option_id`,`option_name`,`section_id`,`subsection_id`,`option_type`,`value`,`position`,`is_global`) VALUES (1000000,'new_label_period','Appearance','','I','0',181,'Y');
DELETE FROM `cscart_settings_descriptions` WHERE (`object_id`,`description`,`object_type`,`lang_code`,`object_string_id`) VALUES (1000000,'\"New\" label period','O','EN','');


Before you delete anything try this

{php}
$new_period = $settings['Appearance']['new_label_period'];
$prod = $this->get_template_vars('product');
$dbd = max(0,date('U') - db_get_field('SELECT timestamp FROM cscart_products WHERE product_id = ' . $prod['product_id'] . ';')) / 86400;
if($new_period >= $dbd) {
    $this->assign('new','Y');
} else {
    $this->assign('new','N');
}
{/php}
{if $new == "Y"}
[COLOR="Red"]<img src="{$images_dir}/new.gif" style="vertical-align:middle;" />[/COLOR]
{/if}

Replace red part of the code with
<font color="#FF0000"><b>New </b></font />

It should be added to files products.tpl products_advanced.tpl products_multicolumns.tpl

Personally I use only products.tpl this is simple list of products in category, products_advanced.tpl is one with bulk addition to cart feature.

in products.tpl

I have added above code in

<div class="products-list-wrapper">

<a href="{$index_script}?{$target_name}=products&product_id={$product.product_id}">{include file="common_templates/image.tpl" image_width=$settings.Appearance.thumbnail_width obj_id=$obj_id images=$product.main_pair object_type="product"}</a>

[COLOR="Red"]{php}
$new_period = $settings['Appearance']['new_label_period'];
$prod = $this->get_template_vars('product');
$dbd = max(0,date('U') - db_get_field('SELECT timestamp FROM cscart_products WHERE product_id = ' . $prod['product_id'] . ';')) / 86400;
if($new_period >= $dbd) {
    $this->assign('new','Y');
} else {
    $this->assign('new','N');
}
{/php}
{if $new == "Y"}
<font color="#FF0000"><b>New </b></font />
{/if}[/COLOR]
		<a href="{$index_script}?{$target_name}=products&product_id={$product.product_id}" class="list-product-title">{$product.product|escape:html}</a> 
		{if $settings.General.inventory_tracking == 'Y' && $settings.General.allow_negative_amount != 'Y' && $product.tracking != 'D' && $product.is_edp != 'Y'}

My code is modified, your may not look 100% same

 
  • mirnitagl
  • Senior Member
  • Members
  • Join Date: 19-Nov 06
  • 334 posts

Posted 26 April 2009 - 09:33 PM #18

Thank you Darius but it still doesn't work.
Never mind, it is not something I necessarily need to have in my store.

Do you know if the statement for deleting the code i added in my database is correct?

You say you only use this in products.tpl, have you added other mods to your products.tpl as well, such as "the manufacturer logo name or image"? That is mod I truly need and I only get it to work in products_details.tpl, nowhere else.
It is such a pity the manufacturer name does not show in any product's list. I believe it is important for most stores.

 
  • Darius
  • Douchebag
  • Members
  • Join Date: 20-Apr 08
  • 3349 posts

Posted 27 April 2009 - 05:29 AM #19

Sorry, don't know how to remove this from database.

I simply redesigned my products.tpl to look more like ebay. Added sorting by newly added, viewing as grid or list, added rating stars... Not using manufacturers, not sure how to install it.



Thank you Darius but it still doesn't work.
Never mind, it is not something I necessarily need to have in my store.

Do you know if the statement for deleting the code i added in my database is correct?

You say you only use this in products.tpl, have you added other mods to your products.tpl as well, such as "the manufacturer logo name or image"? That is mod I truly need and I only get it to work in products_details.tpl, nowhere else.
It is such a pity the manufacturer name does not show in any product's list. I believe it is important for most stores.



 
  • baballuci
  • Senior Member
  • Members
  • Join Date: 02-Mar 06
  • 969 posts

Posted 27 April 2009 - 07:22 PM #20

Hi! I have followed instructions step by step, yet it is not working in my store.
I have just added new products top see it working but no results.


Did you set the number of days in Admin -> Settings -> "New" label period

The default is 0 which will not show any images.
Charlie