Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Free Reviews Confirmation Addon

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 05-22-2004, 02:59 PM
 
deniz deniz is offline
 

Advanced Member
  
Join Date: Sep 2003
Posts: 70
 

Default Free Reviews Confirmation Addon

Hi anyone,

I ve tried to make a simple mode for xcart product review,
When a review sended , first admin should confirm.

Simple steps to make this mode. (Please change some values to as yours)

1.
make a template under admin/main/yorum.tpl

Code:
In this screen you can confirm your product reviews. Mode Deniz made.. {capture name=dialog} <table border=0 cellspacing=5> <tr> <td valign=top>Review Id </td> <td valign=top>Email</td> <td valign=top>Message</td> <td valign=top>Product</td> <td valign=top><div align="center">?</div></td> </tr> {section name=cust_num loop=$wl_data2} <tr> <td valign=top>{$wl_data2[cust_num].review_id}</td> <td valign=top> {$wl_data2[cust_num].email}</td> <td valign=top> {$wl_data2[cust_num].message}</td> <td valign=top>{$wl_data2[cust_num].productid}</td> <td valign=top>Confirm</td> </tr> {/section} </table> {/capture} {include file="dialog.tpl" title="Reviews Confirmation Addon " content=$smarty.capture.dialog extra="width=100%"}

2.

create yorum.php under admin directory

admin/yorum.php

Code:
<? require "../smarty.php"; require "../config.php"; require "./auth.php"; require "../include/security.php"; # # Deniz Reviews modul... # $wl_data2= func_query("SELECT * FROM xcart_product_reviews WHERE confirm='N'"); { if ($_GET['mode'] = 'update') { mysql_query ("UPDATE xcart_product_reviews SET confirm ='Y' WHERE review_id='$_GET[review_id]'"); } } $smarty->assign("wl_data2",$wl_data2); $smarty->assign("main","yorum"); @include "../modules/gold_display.php"; $smarty->display("admin/home.tpl"); ?>

3. After you did , you have to add some lines to "include/vote.php" forexampe in SQL string " AND confirm='Y' "


Code:
<?php $N="N"; if (($mode=='vote') and ($productid) and ($vote>=1) and ($vote<=5)) { $result = func_query_first ("SELECT * FROM $sql_tbl[product_votes] WHERE remote_ip='$REMOTE_ADDR' AND productid='$productid'"); if ($result) { header ("Location: error_message.php?error_already_voted"); exit; } else { db_query ("INSERT INTO $sql_tbl[product_votes] (remote_ip, vote_value, productid) VALUES ('$REMOTE_ADDR','$vote', '$productid')"); header ("Location: product.php?productid=$productid"); exit; } } elseif (($mode=='review') and ($productid)) { $result = func_query_first ("SELECT * FROM $sql_tbl[product_reviews] WHERE remote_ip='$REMOTE_ADDR' AND productid='$productid' AND confirm='Y'"); if ($result) { header ("Location: error_message.php?error_review_exists"); exit; } else { $review_author = htmlspecialchars($review_author); $review_message = htmlspecialchars($review_message); db_query ("INSERT INTO $sql_tbl[product_reviews] (remote_ip, email, message, productid, confirm) VALUES ('$REMOTE_ADDR', '$review_author', '$review_message', '$productid', '$N')"); header ("Location: product.php?productid=$productid"); exit; } } $vote_result = func_query_first ("SELECT COUNT(remote_ip) as total, AVG(vote_value) as rating FROM $sql_tbl[product_votes] WHERE productid='$productid'"); if ($vote_result["total"] == 0) $vote_result["rating"] = 0; $smarty->assign ("vote_result", $vote_result); $vote_max_cows = floor ($vote_result["rating"]); $vote_little_cow = round (($vote_result["rating"]-$vote_max_cows) * 4); $vote_free_cows = 5 - $vote_max_cows - (($vote_little_cow==0) ? 0 : 1); $smarty->assign ("vote_max_cows", $vote_max_cows); $smarty->assign ("vote_little_cow", $vote_little_cow); $smarty->assign ("vote_free_cows", $vote_free_cows); if(!empty($login)) { $customer_info = func_userinfo($login,$login_type); $smarty->assign ("customer_info", $customer_info); } $reviews = func_query ("SELECT * FROM $sql_tbl[product_reviews] WHERE productid='$productid' AND confirm='Y'"); if (!empty($reviews)) foreach ($reviews as $k => $val) { $reviews[$k]["email"] = $val["email"]; $reviews[$k]["message"] = $val["message"]; } $smarty->assign ("reviews", $reviews); ?>

4. Add field to SQL database.
in your xcart_product_reviews
add the field

"Confirm" With VarChar 1 Default "N"

the Sql string is: (3.3.5 ? I didnot test the other versions but I guess no diffrences in)

SQL executer is:

Code:
CREATE TABLE xcart_product_reviews ( review_id int(11) NOT NULL auto_increment, remote_ip varchar(15) NOT NULL default '', email varchar(128) NOT NULL default '', message varchar(255) NOT NULL default '', productid int(11) NOT NULL default '0', confirm char(1) default 'N', PRIMARY KEY (review_id), KEY productid (productid), KEY remote_ip (remote_ip) ) TYPE=MyISAM;


5.
add the lines to single/home.tpl

Code:
{elseif $main eq "yorum"} {include file="admin/main/yorum.tpl"}

6.

Add the line under /admin/menu_admin.tpl


under the the line and save thatsall.



Yes this first step , I am not much time to improve the module , bu i will .

Have fun from Turkiye.....

Deniz.
Reply With Quote
  #2  
Old 05-23-2004, 03:14 PM
 
xcell67 xcell67 is offline
 

Senior Member
  
Join Date: Dec 2003
Posts: 149
 

Default

you KICK ASS deniz, i got this to work for 3.5.7, I love your suggestion mod, your customer service mod (although had to make a ton of changes to it, no problem) and this mod is excellent! No more flamers!

Thank you thank you for your contributions.
Reply With Quote
  #3  
Old 05-23-2004, 03:55 PM
 
scraps scraps is offline
 

Advanced Member
  
Join Date: Mar 2004
Posts: 60
 

Default

this would be great for 3.5 I would personally love to be able to confirm them first.

Scraps
X-cart 3.5whatever pro
Reply With Quote
  #4  
Old 05-23-2004, 04:04 PM
 
deniz deniz is offline
 

Advanced Member
  
Join Date: Sep 2003
Posts: 70
 

Default

I guess it may work , but please note you have to change only the SQL lines under vote.php like 'AND confirm=N'
Reply With Quote
  #5  
Old 05-26-2004, 01:23 AM
 
arabayaservis.com arabayaservis.com is offline
 

Member
  
Join Date: Nov 2003
Posts: 10
 

Default

for 3.5.7

/admin/yorum.php

delete
require "../smarty.php";
require "../config.php";
require "./auth.php";
require "../include/security.php";

add
require "./auth.php";
require $xcart_dir."/include/security.php";

thanks for mod from Istanbul!
Reply With Quote
  #6  
Old 05-26-2004, 07:43 AM
 
maki maki is offline
 

Advanced Member
  
Join Date: May 2003
Location: Spain
Posts: 46
 

Default cool mod, but ....

Hi all !!!

in admin page, when I do click in "Reviews Addon", single appears home page, and where it must appear yorum.tpl he does not appear nothing.

some idea?

greetings !!!
__________________
X -Cart v3.4.14
X-Cart V4.3.1
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 08:10 AM.

   

 
X-Cart forums © 2001-2020