Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Product Reviews: Removing "Date Added"

Product Reviews: Removing "Date Added"

Views: 5,886

Results 1 to 20 of 23
7 Jul 2006, 6:17 PM
#1
designbydemeter avatar

designbydemeter

Zen Follower

Join Date:
Jun 2006
Location:
Taos,NM
Posts:
225
Plugin Contributions:
0

Product Reviews: Removing "Date Added"

I've search the forum and with the aid of the developers tool kit, I found a file:

includes/modules/pages/product_reviews/header.php

in there is a block:

while (!$reviews->EOF) {
$reviewsArray[] = array('id'=>$reviews->fields['reviews_id'],
'customersName'=>$reviews->fields['customers_name'],
'dateAdded'=>$reviews->fields['date_added'],
'reviewsText'=>$reviews->fields['reviews_text'],
'reviewsRating'=>$reviews->fields['reviews_rating']);
$reviews->MoveNext();

wherein the 'dateAdded.... was what I thought the pertinent code. I commented that out - to no avail.

Are there additional steps I need to take. I have a lot of comments emailed to me that I need to either backdate, or not have any date at all.

Thanks,
Laura

7 Jul 2006, 8:07 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Product Reviews: Removing "Date Added"

In everything one should first exhaust the possibilities in the admin instead of turning directly to the code.

In the admin > catalog > product types > select layout > Show Date Added and set to false

7 Jul 2006, 8:24 PM
#3
designbydemeter avatar

designbydemeter

Zen Follower

Join Date:
Jun 2006
Location:
Taos,NM
Posts:
225
Plugin Contributions:
0

Re: Product Reviews: Removing "Date Added"

I did do that - that switch refers to the date the product was added, not the date the review was added.

Any other suggestions?

~L

7 Jul 2006, 11:15 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Product Reviews: Removing "Date Added"

:oops: My Error...I didn't read your post closely enough as you did specify.

Will check this and get back, or another will.

7 Jul 2006, 11:30 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Product Reviews: Removing "Date Added"

You are trying to get too "deep" in the code ...

Go to the template level ...

/includes/templates/template_default/templates/tpl_product_review_info_default.php

Copy to your template and overrides directory ...

Find the line near the bottom for:

<div id="reviewsInfoDefaultDate" class="bold"><?php echo sprintf(TEXT_REVIEW_DATE_ADDED, zen_date_short($review_info->fields['date_added'])); ?> <?php echo sprintf(TEXT_REVIEW_BY, zen_output_string_protected($review_info->fields['customers_name'])); ?></div>

You can comment out the date just by changing this to read:

<div id="reviewsInfoDefaultDate" class="bold"><?php // echo sprintf(TEXT_REVIEW_DATE_ADDED, zen_date_short($review_info->fields['date_added'])); ?> <?php echo sprintf(TEXT_REVIEW_BY, zen_output_string_protected($review_info->fields['customers_name'])); ?></div>

Notice the two little forward slashes that I added ...

7 Jul 2006, 11:32 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Product Reviews: Removing "Date Added"

Note: there are several pages to the reviews ... that also will need a tweek ...

23 May 2011, 7:36 PM
#7
seeker88 avatar

seeker88

New Zenner

Join Date:
Jan 2011
Posts:
15
Plugin Contributions:
0

Re: Product Reviews: Removing "Date Added"

Ajeh:

Note: there are several pages to the reviews ... that also will need a tweek ...

Can you tell me where each is located. Thanks a million.

23 May 2011, 10:29 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Product Reviews: Removing "Date Added"

Go to the Tools ... Developers Tool Kit ... and do a search on:
review

and select Catalog ... then click Search ... and you should locate all pages for the reviews ...

This will show all references to that, among other things ...

23 May 2011, 11:18 PM
#9
seeker88 avatar

seeker88

New Zenner

Join Date:
Jan 2011
Posts:
15
Plugin Contributions:
0

Re: Product Reviews: Removing "Date Added"

Well do, thank again.

23 May 2011, 11:27 PM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Product Reviews: Removing "Date Added"

Once you review that, you can also narrow things down on a search for:
TEXT_REVIEW_DATE_ADDED

24 May 2011, 1:18 AM
#11
seeker88 avatar

seeker88

New Zenner

Join Date:
Jan 2011
Posts:
15
Plugin Contributions:
0

Re: Product Reviews: Removing "Date Added"

Thanks!!

I think total is 3 and u already gave 1.

Well, I am a newbie but I will try your instructions. But if anyone who have done this before and can just give me the exact path for the remaining 2, that be great too :D

24 May 2011, 1:29 AM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Product Reviews: Removing "Date Added"

The Developers Tool Kit provides the exact path to the files ...

24 May 2011, 2:57 AM
#13
seeker88 avatar

seeker88

New Zenner

Join Date:
Jan 2011
Posts:
15
Plugin Contributions:
0

Re: Product Reviews: Removing "Date Added"

:oops: My bad.

26 Aug 2021, 10:53 PM
#14
rlexyd avatar

rlexyd

Zen Follower

Join Date:
Nov 2006
Location:
Sydney, Australia
Posts:
460
Plugin Contributions:
0

Re: Product Reviews: Removing "Date Added"

Ajeh:

You are trying to get too "deep" in the code ...
Go to the template level ...
/includes/templates/template_default/templates/tpl_product_review_info_default.php
Copy to your template and overrides directory ...
Find the line near the bottom for:

<div id="reviewsInfoDefaultDate" class="bold"><?php echo sprintf(TEXT_REVIEW_DATE_ADDED, zen_date_short($review_info->fields['date_added'])); ?> <?php echo sprintf(TEXT_REVIEW_BY, zen_output_string_protected($review_info->fields['customers_name'])); ?></div> ``` > You can comment out the date just by changing this to read: > ```php <div id="reviewsInfoDefaultDate" class="bold"><?php // echo sprintf(TEXT_REVIEW_DATE_ADDED, zen_date_short($review_info->fields['date_added'])); ?> <?php echo sprintf(TEXT_REVIEW_BY, zen_output_string_protected($review_info->fields['customers_name'])); ?></div> ``` > Notice the two little forward slashes that I added ...

Hi Linda,
I know this is an old post but just wondering if there is a way to Display just the month & year in the date added field that shows on the review?
I know you advise to comment out the date where you find (TEXT_REVIEW_DATE_ADDED) which will remove the date added entirely..
But I would like to keep displaying the Month and Year but Remove the actual Date digit if at all possible?!
For example: Date Added: 27/08/2021 will change to Date Added: 08/2021 or something similar.

30 Aug 2021, 6:23 AM
#15
rlexyd avatar

rlexyd

Zen Follower

Join Date:
Nov 2006
Location:
Sydney, Australia
Posts:
460
Plugin Contributions:
0

Re: Product Reviews: Removing "Date Added"

No response yet... is this because it's in the way too hard basket!?
Any helpful response would be greatly appreciated.

17 Sep 2021, 8:54 AM
#16
rlexyd avatar

rlexyd

Zen Follower

Join Date:
Nov 2006
Location:
Sydney, Australia
Posts:
460
Plugin Contributions:
0

Re: Product Reviews: Removing "Date Added"

Can someone help with this?

17 Sep 2021, 11:57 AM
#17
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Product Reviews: Removing "Date Added"

rlexyd:

Can someone help with this?

Bit of a guess but it looks as though it is the zen_date_short function that outputs the date of a review. In includes /functions/functions_general.php look for

function zen_date_short($raw_date) {

you could create a copy of that function, edit it to output just the month and year, and use that copy in your templates/tpl_product_review_info_default.php

17 Sep 2021, 10:18 PM
#18
rlexyd avatar

rlexyd

Zen Follower

Join Date:
Nov 2006
Location:
Sydney, Australia
Posts:
460
Plugin Contributions:
0

Re: Product Reviews: Removing "Date Added"

simon1066:

Bit of a guess but it looks as though it is the zen_date_short function that outputs the date of a review. In includes /functions/functions_general.php look for

function zen_date_short($raw_date) {

> you could create a copy of that function, edit it to output just the month and year, and use that copy in your templates/tpl_product_review_info_default.php

Thank you very much for your suggestion.
Ok, I did the following but not sure if I got it right as now, No date is showing.

I copied and adjusted the short date code and added it Below the original short date code in the /functions/functions_general.php:

////
// Output a REVIEWS short raw date string in the selected locale date format
// $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS
function zen_[B]reviews_[/B]date_short($raw_date) {
if ($raw_date <= '0001-01-01 00:00:00' || empty($raw_date)) return false;

$year = substr($raw_date, 0, 4);
$month = (int)substr($raw_date, 5, 2);

// $day = (int)substr($raw_date, 8, 2); <---- Commented this line out ---->
$hour = (int)substr($raw_date, 11, 2);
$minute = (int)substr($raw_date, 14, 2);
$second = (int)substr($raw_date, 17, 2);
}

Then I went to MYTEMPLATE/templates/ and adjusted the following three files by changing the code zen_date_short to zen**_reviews**_date_short:

tpl_product_review_info_default.php
tpl_product_reviews_default.php
tpl_reviews_default.php
<div id="reviewsInfoDefaultDate"><?php echo sprintf(TEXT_REVIEW_DATE_ADDED, zen[B]_reviews[/B]_date_short($review_info->fields['date_added'])); ?> <?php echo sprintf(TEXT_REVIEW_BY, zen_output_string_protected($review_info->fields['customers_name'])); ?></div> ``` ``` <div class="productReviewsDefaultReviewer"><?php echo sprintf(TEXT_REVIEW_DATE_ADDED, zen[B]_reviews[/B]_date_short($reviews['dateAdded'])); ?> <?php echo sprintf(TEXT_REVIEW_BY, zen_output_string_protected($reviews['customersName'])); ?></div> ``` ``` <div><?php echo sprintf(TEXT_REVIEW_DATE_ADDED, zen[B]_reviews[/B]_date_short($reviews->fields['date_added'])); ?> <?php echo sprintf(TEXT_REVIEW_BY, zen_output_string_protected($reviews->fields['customers_name'])); ?></div> ```
18 Sep 2021, 12:06 PM
#19
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Product Reviews: Removing "Date Added"

simon1066:

Bit of a guess but it looks as though it is the zen_date_short function that outputs the date of a review. In includes /functions/functions_general.php look for

function zen_date_short($raw_date) {

> 
> you could create a copy of that function, edit it to output just the month and year, and use that copy in your templates/tpl_product_review_info_default.php

It appears that the date formatting is set by the define of DATE_FORMAT. In your zen_reviews_date_short function (copy of zen_date_short) in /functions/functions_general.php, change the two instances of 

DATE_FORMAT

to

DATE_FORMAT_REVIEWS


and in includes/languages/YOUR_TEMPLATE/english.php, add this below the existing DATE_FORMAT line

define('DATE_FORMAT_REVIEWS', 'm/Y'); // this is used for reviews date()


I've tested it and it should work.
18 Sep 2021, 9:17 PM
#20
rlexyd avatar

rlexyd

Zen Follower

Join Date:
Nov 2006
Location:
Sydney, Australia
Posts:
460
Plugin Contributions:
0

Re: Product Reviews: Removing "Date Added"

Thank you very much Simon, an Excellent fix :D That did it!!
I just had to un-comment out the $day = (int)substr($raw_date, 8, 2); line as it was generating some error logs.
*I'm really happy with the above solution, just *curious though, is there a way to get Zen Cart to show the name of the actual month instead of the digits? Eg: September/2021 instead of 09/2021.