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

TOPIC: new label

new label 11 years 2 months ago #2295

hi, is there a reason for the new label appearing only on some items where all the items have exactly the same creation date?
I hardcoded the default.php and others to 8 weeks.
Articles have been added 1 week ago.

VM 2.018a and flexible template

thanks, nicola
Attachments:
The administrator has disabled public write access.

new label 11 years 2 months ago #2302

Hi,

In the Category Browse page Default.php
(ROOT/templates/<youjoomlatemplate>/html/com_virtuemart/category/default.php)

This line below checks whether the NEW icon should be visible or hidden:
$category_new_timeframe = $params->get('category_new','+2 week');
						$createddate = strtotime(($product->created_on) . " ".$category_new_timeframe."");  // +1 week can anything you want:  +2 week, +1 month, +24 hour   so on..
						$today = strtotime(date("Y-m-d G:i:s")); //todays date
						if ($createddate > $today) {
							$NEWorOLD = "FlexibleNew";
							} else {
							$NEWorOLD = "";
							}

I can't be sure which PureMart you were using, but couple months ago, we have changed the way our VM Template works, we have added a joomla plugin to control these variable (such as; time period to show the NEW label). So by simplying changing the time period through joomla plugin (1 day, 2 days, 1 week, 2 months etc..) you can define the time period to show the NEW label from the creation date. I am guessing you have the old version, so you will need to change this time-period variable with HARD coding.

There are 2 different DATEs for each product that stored in the Virtuemart DATABASE (by Virtuemart itself):
Creation date: this is the date when the product is created
Modification date: this is the date when the product is modified (price change, name change, etc..)

The creation date never refreshes. You need to create a new product to set a new creation date. And our PureMart grabs this creation date from the database to compare with the today's date. Therefore, if you are saying; some products show NEW, some not. My guess is; something is wrong with their creation dates. Maybe at first you have created a TEST product while opening the store, then change their product name, price etc.. and made a new product, but in this case, the "creation date" remains the same as you created that TEST product for the first time. This might be reason why the NEW label won't get shown in some products. Because they were not newly created, but modified.

Regards.
Forum Support.
Last Edit: 11 years 2 months ago by Support.
The administrator has disabled public write access.

new label 11 years 2 months ago #2305

Yes, I use the old version puremart.
Anyway, I hardcoded the date check (8 weeks), and by your right doubt about creation date, I checked it out directly in database table of virtuemart, and there, it's for sure the creation date is the same: it is fot this that I say it's very strange..
The administrator has disabled public write access.

new label 11 years 2 months ago #2307

did you migrate your products from VM1.1x to VM2.0.xx?

How it behaves if you create a brand new product? Still random behavior?
Just try it. Create a new product, And by hard coding change the time-period as +10 minute
And check the website if the NEW label is disappeared after 10 minutes.

strtotime() function that we used converts the date to seconds (to compare)
For instance;
February 6 2013 12:00 AM is converted to something like:
123142352534534 (that kind of thing)

This might be the problem. If your Virtuemart's date is American style, and your server's DATE is European style (or the opposite) this might lead this confusion. (Feb 6 2013 is written as: 2/6/2013 in US standards but it is written as 6/2/2013 in european style.)

You can try to change it by modifying this:
$today = strtotime(date("Y-m-d G:i:s")); //todays date

This is YEAR : MONTH : DAY format
Change it to this:
$today = strtotime(date("Y-d-m G:i:s")); //todays date

It might fix the problem. Just give it a shot.

Also for the testing purpose. See what your website is defining for those VALUES.
Add "echo" in the beginning of these lines, something like:
echo $createddate = strtotime(($product->created_on) . " ".$category_new_timeframe."");  // +1 week can anything you want:  +2 week, +1 month, +24 hour   so on..
echo $today = strtotime(date("Y-m-d G:i:s"));

And in the website see what your website is printing for those values.
Regards.
The administrator has disabled public write access.

new label 11 years 2 months ago #2310

drivin' crazy..
put an echo to print the creation date..

products has been added the same day, few minutes once to another...

Is it definivly VM bug???

one more: I checked the database, but no products have date 0000... from where comes that damned value???
Attachments:
Last Edit: 11 years 2 months ago by nicola giatti.
The administrator has disabled public write access.

new label 11 years 2 months ago #2376

I don't know where that 000 came from in the database. It is really weird. But you should keep this in mind that, our VM Template HAS NOTHING TO DO with database, so... whatever value is typing in the database, those are written there with Virtuemart Component. You can manually edit those dates through phpMyAdmin though. I am sure when those values are corrected, the NEW badge in the VM Template will work just fine.

Regards.
Forum Support.
The administrator has disabled public write access.
Time to create page: 0.156 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