Welcome, Guest
Username: Password: Remember me
Use this Category for your support questions about Virtuemart Template - PureMart (SKU# FLEX-00010)

TOPIC: [SOLVED] Criteria for the "NEW!" badge

[SOLVED] Criteria for the "NEW!" badge 11 years 6 months ago #519

The other badges are obvious but how do i set the "new" badge to display or prevent it from displaying and what are the on/off timings for this please ?
Last Edit: 11 years 6 months ago by Richard.
The topic has been locked.

Criteria for the "NEW!" badge 11 years 6 months ago #523

Hi,

Since Virtuemart doesn't support this feature, there is no environment to choose the "time period" for showing the "NEW" badge. It is set to 1 week by default. So; the item that has been added within 1 week, have the "NEW" badge. But you can change this time period to whatever you want.

This is easy though,
Please open this PHP file:
ROOT/template/<yourjoomlatemplatefolder>/html/com_virtuemart/category/default.php
(default.php or flexv2.php, which ever you are using curretcly for category browse page layouts)

Then find this line:
// CHECK IF THE PRODUCT IS NEW OR OLD. IF THE PRODUCT WAS CREATED LESS THAN 1 WEEK AGO, IT WILL HAVE "NEW" BADGE.
	$createddate = strtotime(($product->created_on) . " +1 week");  // +1 week can anything you want:  +2 week, +1 month, +24 hour   so on..

The description is already written there, basically you are going to change this +1 week" to "+1 day" or "+2 week" or even "+52 week" , it is up to you.
The topic has been locked.

Criteria for the "NEW!" badge 11 years 6 months ago #524

thats great thanks - for stock that is already added is it possible to force the "new" to show up at all ?
i have tried changing the "availability date" to today but that doesnt do it (i have changed the code as you described to 4 weeks
thanks again.
The topic has been locked.

Criteria for the "NEW!" badge 11 years 6 months ago #531

Hi,

Unfortunately a CORE Hack is requirement for what you are asking (which we refuse to do).
Virtuemart captures 2 different dates for each product and store them in the MySQL: They are: 1)creation date, 2)modified date.

No matter what you choose for "availability" or what so ever; the creation date will persist. There is no way to change/update it, but the modified date, is updated once the product is updated. Lets say, you change price, or change product info etc.., this date will be updated.

For the new badge icon, we used the "creation date". And since there is no way to update it (UNLESS you delete the old one and re-add it, or update this parameter manually from phpmyadmin) there is no way to force any product to have the NEW badge.

If the Virtuemart CORE hack was possible, we would put a an additional field in the VM Backend, and we will call it: NEW BADGE UNTIL THIS DATE: so you would select a specific date and the NEW badge will be there until that date, But this would be CORE hack and we don't want to do it.

Cheers.
The topic has been locked.

Criteria for the "NEW!" badge 11 years 6 months ago #535

Ok thats great thanks for the information as always very helpful!
The topic has been locked.

Criteria for the "NEW!" badge 11 years 6 months ago #538

your welcome.
The topic has been locked.
Time to create page: 0.088 seconds

MaterialMart

for Virtuemart 3

Google's Material Design has finally arrived to Virtuemart

Virtumart Template - MaterialMart Virtumart Template - CleanMart Virtumart Template - CleanMart Virtumart Template - CleanMart

Fully responsive!

Buy Now   |   Live Demo