Exclusive eBooks, Software Solutions, Quality Guaranteed
 
Web NukeBiz
Welcome to NukeBiz · Members
Amazon
show cart or checkout0 items
Cart Value: 0.00

Forums » DragonflyCMS Projects » MReviews » Import from Reviews Module
Import from Reviews Module
A system for categorizing and managing reviews.
Topic initiation via Bugger.

Post new topic    Reply to topic    Printer Friendly Page     Forum Index »  Community » MReviews

View previous topic :: View next topic  
Author Message
MajorHeadache
Nice Poster
Nice Poster

Offline Offline
Joined: May 10, 2005
Posts: 5

PostPosted: Thu May 12, 2005 3:16 am
Post subject: Import from Reviews Module

Is there a way to bring my existing Reviews from the regular reviews module over to MReviews?

Also, we use ours for "trader feedbacks" much like ebay's system. It would be a lot better if the score at the top was an aggregate average, rather than just what the first user gave them. Any way to do this?


MajorHeadache please enter your server specs in your user profile! Crying or Very sad
Back to top
View user's profile
Phoenix
Chairman
Chairman

Offline Offline
Joined: Mar 17, 2004
Posts: 1543
Location: Netizen
PostPosted: Thu May 12, 2005 6:48 am
Post subject: Re: Import from Reviews Module

I'd have to review the tables but it is possible.

I can look at 'averaging' - will depend on how many db queries it adds to the system - it will probably be an extra field since the ratings are in different tables, and to preserve the original reviewer's rating.

btw, not an overnight exercise - need to find some time for it Smile


Phoenix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website ICQ Number Yahoo Messenger Photo Gallery
MajorHeadache
Nice Poster
Nice Poster

Offline Offline
Joined: May 10, 2005
Posts: 5

PostPosted: Thu May 12, 2005 9:10 am
Post subject: Re: Import from Reviews Module

Cool, well, do whatever you can. I am attaching the Reviews and Comments tables here for your perusal.


MajorHeadache please enter your server specs in your user profile! Crying or Very sad
Back to top
View user's profile
Phoenix
Chairman
Chairman

Offline Offline
Joined: Mar 17, 2004
Posts: 1543
Location: Netizen
PostPosted: Thu May 12, 2005 9:50 am
Post subject: Re: Import from Reviews Module

How many reviews in your database?
MReviews uses categories and sub-categories, so these would have to be manually entered in the reviews and comments tables Sad


Phoenix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website ICQ Number Yahoo Messenger Photo Gallery
MajorHeadache
Nice Poster
Nice Poster

Offline Offline
Joined: May 10, 2005
Posts: 5

PostPosted: Thu May 12, 2005 9:54 am
Post subject: Re: Import from Reviews Module

about 500 reviews, but all the same category. Would be nice if I could programatically put them all in the same category with one phpmyadmin command, or somehting like that.

I could even do it in excel if puch came to shove.


MajorHeadache please enter your server specs in your user profile! Crying or Very sad
Back to top
View user's profile
Phoenix
Chairman
Chairman

Offline Offline
Joined: Mar 17, 2004
Posts: 1543
Location: Netizen
PostPosted: Thu May 12, 2005 10:16 am
Post subject: Re: Import from Reviews Module

we can easily apply the same category/sub-category to the whole db through PMA with a couple of simple queries.

If you're familiar with PMA, you could also duplicate the existing Reviews tables via the "Operations" tab, thus eliminating any risk to your existing Reviews.


Phoenix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website ICQ Number Yahoo Messenger Photo Gallery
MajorHeadache
Nice Poster
Nice Poster

Offline Offline
Joined: May 10, 2005
Posts: 5

PostPosted: Thu May 12, 2005 10:24 am
Post subject: Re: Import from Reviews Module

I could probably muddle thru, but it wouldn't be pretty. I'm definitely an amature. Although I think I could handle copying pretty well.

EDIT: Done and done!


MajorHeadache please enter your server specs in your user profile! Crying or Very sad
Back to top
View user's profile
Phoenix
Chairman
Chairman

Offline Offline
Joined: Mar 17, 2004
Posts: 1543
Location: Netizen
PostPosted: Thu May 12, 2005 10:29 am
Post subject: Re: Import from Reviews Module

hmm, perhaps a special cpg_inst.php file might do the job seamlessly, and provide a sound basis for others wishing to changeover.


Phoenix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website ICQ Number Yahoo Messenger Photo Gallery
MajorHeadache
Nice Poster
Nice Poster

Offline Offline
Joined: May 10, 2005
Posts: 5

PostPosted: Thu May 12, 2005 10:43 am
Post subject: Re: Import from Reviews Module

That would be ideal =)


MajorHeadache please enter your server specs in your user profile! Crying or Very sad
Back to top
View user's profile
Phoenix
Chairman
Chairman

Offline Offline
Joined: Mar 17, 2004
Posts: 1543
Location: Netizen
PostPosted: Fri May 13, 2005 8:24 am
Post subject: Re: Import from Reviews Module

This is really basic, but it worked fine on a very small test database.
It doesn't affect your reviews database, but backup those tables anyway.
Copy the code below and create a file with some obscure name and place it in your root directory, then run it.
Please feedback results here.
PHP:
<?php
##########################################################################
# File to convert an existing Reviews database to a NEW MReviews database
# It is extremely basic.
# Install the latest MReviews module, as new.
# BACKUP your Reviews databases BEFORE doing anything else!!!
# Give this file some obscure name and run it in your root directory.
# Run this file ONCE - should be fine for small databases, say 500 or so.
# DELETE this file when it's finished.
# Check your MReviews database for the data.
# Adjust Category and Sub-Category title through admin interface.
# Delete any superfluous example categories etc.
# Happy MReviewing Smile
##########################################################################
include("includes/cmsinit.inc");

global $db, $prefix, $user_prefix;

$result = $db->sql_query('SELECT * FROM '.$prefix.'_reviews', true);
if ($db->sql_numrows($result) > 0) {
while ($row = $db->sql_fetchrow($result)) {
$db->sql_query("INSERT INTO ".$prefix."_MReviews SET rid='$row[id]', cid='1', scid='1', date='$row[date]', author='".Fix_Quotes($row['reviewer'])."', author_email='".Fix_Quotes($row['email'])."', author_user='0', author_ip='0', pagename='".Fix_Quotes($row['title'])."', content='".Fix_Quotes($row['text'])."', cover='".Fix_Quotes($row['cover'])."', r_link='".Fix_Quotes($row['url'])."', r_link_title='".Fix_Quotes($row['url_title'])."', score='$row[score]', counter='$row[hits]'");
}
}
$db->sql_freeresult($result);

$result2 = $db->sql_query("SELECT u.username, m.author FROM ".$user_prefix."_users AS u INNER JOIN ".$prefix."_MReviews AS m ON ( u.username = m.author)");
while (list($uname) = $db->sql_fetchrow($result2, SQL_NUM)) {
$db->sql_query("UPDATE ".$prefix."_MReviews SET author_user='1' WHERE author='".$uname."'");
}
$db->sql_freeresult($result2);

$result3 = $db->sql_query('SELECT * FROM '.$prefix.'_reviews_comments', true);
if ($db->sql_numrows($result3) > 0) {
while ($row3 = $db->sql_fetchrow($result3)) {
$db->sql_query("INSERT INTO ".$prefix."_MReviews_comments SET rid='$row3[rid]', userid='".Fix_Quotes($row3['userid'])."', userip='0', com_id='$row3[cid]', date='$row3[date]', comments='".Fix_Quotes($row3['comments'])."', score='$row3[score]'");
}
}
$db->sql_freeresult($result3);

echo
"Finished converting Reviews to MReviews - please delete this file";
?>


Phoenix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website ICQ Number Yahoo Messenger Photo Gallery
Display posts from previous:   
Post new topic    Reply to topic    Printer Friendly Page    Forum Index »  Community » MReviews
Page 1 of 1
All times are GMT + 9.5 Hours



Jump to:  


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum