PDA

View Full Version : Major Additions - Product Review Forums ? Research, Review & Compare Items


Pages : 1 2 3 4 5 6 7 [8]

Morrus
08-31-2014, 02:58 AM
Playing around as promised and I'm still not sure what's causing this for you...

Using a completely clean install, there's no issues preserving line breaks as you can see at http://vbulletin.moderninsider.com/ (no min posting to review, no limit on reviews / product).

This opens up the question as to your specific settings. Since we've got the basics, let's talk details... editor options? html allowed? bb code allowed? moderation?

And of course the most basic... you are using 4.2.2 for sure, right (this is the #1 cause of compatibility issues so sorry for asking twice).

I've tried every combination possible that I can find - Bbcode on/off, HTML on/off, both for vbulletin and for the mod specifically. Advanced editor is as shown in the above screenshots, both on and off. Like I say, it's fine everywhere else on the site.

For now I have HTML on so at least I can post some test reviews. But that can't be a long term solution, for obvious reasons.

(yup, 4.2.2!)

Ted S
08-31-2014, 03:04 AM
I've tried every combination possible that I can find - Bbcode on/off, HTML on/off, both for vbulletin and for the mod specifically. Advanced editor is as shown in the above screenshots, both on and off. Like I say, it's fine everywhere else on the site.

For now I have HTML on so at least I can post some test reviews. But that can't be a long term solution, for obvious reasons.

(yup, 4.2.2!)

Alright, that makes it way more painful to fix, sorry!

How are you with database queries? Good you say, fantastic!

Let's see how one of your review with line breaks looks in mySQL:

SELECT comments FROM pf_reviews WHERE postid = XXX (pick the post, will show all the reviews on it).

We're looking to see if we either get line breaks in the raw data or break tags added (which are getting removed).

Morrus
08-31-2014, 12:38 PM
Alright, that makes it way more painful to fix, sorry!

How are you with database queries? Good you say, fantastic!

Let's see how one of your review with line breaks looks in mySQL:

SELECT comments FROM pf_reviews WHERE postid = XXX (pick the post, will show all the reviews on it).

We're looking to see if we either get line breaks in the raw data or break tags added (which are getting removed).

We're slipping outside my comfort zone here - I'm not too sure what I'm doing.

So I went to PHYMYADMIN and entered that query. There's no table pf_reviews, but there is pf_review. I'm hoping that's just a typo and not an actual missing table.

Looking at pf_review I can't see anywhere there where the review is actually stored. It just has reviewid productid threadid postid userid rating comments headline fullname location ipaddress createddate approved.

I'm going to make a guess that postid is what I want in the post table? In that case, looking at the post, there's the wall of text, but no line breaks. The custom fields, at the bottom, though, are formatted with bold titles and line breaks, so that little bit works. The main body of the text is just the wall though.

Phew. That was a long way to say -- if I understand you right, no, there is no formatting in the actual database entry.

I'm pretty sure this has to be the same thing missing WYSIWYG toolbar. If we fix the toolbar, I'm willing to bet the formatting issue will fix itself too.

Also, as a data point - posting in HTML (when it's switched on) works just fine, and the formatting gets saved correctly.

Ted S
08-31-2014, 05:57 PM
Sorry, sounds like I gave you both a typo and bad details.

Since I can't duplicate the lack of the editor toolbar either, I have to ask you to keep playing along here, painful and slow as the process may be.

Give this version of the addon a spin and let me know if anything changes.

Morrus
08-31-2014, 06:08 PM
Sorry, sounds like I gave you both a typo and bad details.

pf_review is the correct place to be looking.

comments is the field that holds the actual review.

I realize you may not see any breaks in phpMyAdmin but try copying & pasting the text out. If there's still no breaks (and no HTML tags), that's a good indication that there's an issue on the front-end entering data. If they're there, it's something else.

Curiouser and curiouser. The comments field is entirely empty!

Ted S
08-31-2014, 06:46 PM
Curiouser and curiouser. The comments field is entirely empty!

Try clicking edit (if it's truly blank, there wouldn't be a review message, just a title).

Ted S
08-31-2014, 06:53 PM
Also, see my previous post which is edited to include a test version of the addon,

Morrus
08-31-2014, 08:02 PM
Nada. Empty.

Clicking the review title takes me to the forum thread, which shows the review text.

Morrus
08-31-2014, 08:03 PM
Also, see my previous post which is edited to include a test version of the addon,

I haven't tried that yet - issue being that with all the work I've done customizing it, I'm worried about now breaking what I've done!

Ted S
08-31-2014, 09:06 PM
Nada. Empty.

Clicking the review title takes me to the forum thread, which shows the review text.

So how do you know there's no line breaks? There shouldn't be any review at all...

Morrus
08-31-2014, 09:20 PM
So how do you know there's no line breaks? There shouldn't be any review at all...

Whether or not there shouldn't be a review, there is one. I don't know what else to tell you! .)

You're welcome to try it out yourself. Post a review and you'll see what it does.

http://www.enworld.org/forum/productforums.php

Ted S
08-31-2014, 09:27 PM
Whether or not there shouldn't be a review, there is one. I don't know what else to tell you! .)

You're welcome to try it out yourself. Post a review and you'll see what it does.

http://www.enworld.org/forum/productforums.php

Ok, I think I'm starting to understand more of the issue though still not sure why. I'll keep apologizing for this but there's no other way to chase it down until we can figure out what setting you have (I'm sure it's a legitimate one) is breaking things.

Can you run this version of forum/productforums.php and see if the review saves to the database?

Nothing will change in your styling.

Morrus
09-01-2014, 06:44 AM
Ok, I think I'm starting to understand more of the issue though still not sure why. I'll keep apologizing for this but there's no other way to chase it down until we can figure out what setting you have (I'm sure it's a legitimate one) is breaking things.

Can you run this version of forum/productforums.php and see if the review saves to the database?

Nothing will change in your styling.

So good news: yes - that does now appear in the database.

The database entry contains the full text of the review, with all formatting stripped. I've double checked by copying and pasting it from PHPMYADMIN to Notepad, and there are no tags or breaks of any kind there.

(Also, somewhat unfortunately, the new file undoes some changes I made which allowed me to do the latest reviews page and show publisher names next to product names; that's not too serious for the moment though).

Ted S
09-01-2014, 04:57 PM
So good news: yes - that does now appear in the database.

The database entry contains the full text of the review, with all formatting stripped. I've double checked by copying and pasting it from PHPMYADMIN to Notepad, and there are no tags or breaks of any kind there.

(Also, somewhat unfortunately, the new file undoes some changes I made which allowed me to do the latest reviews page and show publisher names next to product names; that's not too serious for the moment though).

We're you able to update the new plugin version?

If not, try opening up the template prodforums_review_create and use this version:

These changes... were they hacks to the code and if so, at what points (so I can make them into hooks).

Morrus
09-01-2014, 05:12 PM
We're you able to update the new plugin version?

If not, try opening up the template prodforums_review_create and use this version:

I just uploaded the productforums.php file you posted above. Was there another thing?

These changes... were they hacks to the code and if so, at what points (so I can make them into hooks).

A load of template changes and some alterations of productforums.php. Nothing big, mind you - I don't understand what I'm doing, so I just copy bits from elsewhere in the file and see if they work. The recent reviews thing was a copy/paste of the whole "list reviews by reviewer" with the reviewer matching criteria removed and a do=recent thingy (whatever that is called) added, and there are some changes to the way product ratings are calculated so that they get an overall % ranking based on the individual 1-5 ranks.

I can upload it if you're curious (or, hell, if anyone else wants to use it).

Ted S
09-01-2014, 05:17 PM
I just uploaded the productforums.php file you posted above. Was there another thing?



A load of template changes and some alterations of productforums.php. Nothing big, mind you - I don't understand what I'm doing, so I just copy bits from elsewhere in the file and see if they work. The recent reviews thing was a copy/paste of the whole "list reviews by reviewer" with the reviewer matching criteria removed and a do=recent thingy (whatever that is called) added, and there are some changes to the way product ratings are calculated so that they get an overall % ranking based on the individual 1-5 ranks.

I can upload it if you're curious (or, hell, if anyone else wants to use it).

The other thing was the complete XML plugin but while the template manager should keep your changes, let's not risk it... Just manually replace that one template in my previous post and let's see if that fixes the editor.

Morrus
09-01-2014, 05:42 PM
The other thing was the complete XML plugin but while the template manager should keep your changes, let's not risk it... Just manually replace that one template in my previous post and let's see if that fixes the editor.

Tried it, but it didn't help, sadly. Still no WYSIWYG editor toolbar and no linebreaks etc. saved.

Ted S
09-01-2014, 06:03 PM
Tried it, but it didn't help, sadly. Still no WYSIWYG editor toolbar and no linebreaks etc. saved.

What browser / os are you using?

Also, I've got a test account on your site... any sub-forums with reviews enabled that I can get too (it's "Ted S").

Morrus
09-01-2014, 06:16 PM
What browser / os are you using?

Also, I've got a test account on your site... any sub-forums with reviews enabled that I can get too (it's "Ted S").

The latest Firefox on Windows 7.

Also the same when I try iOS.

I turned off the automatic thread creation in forums (and that template change for the forum didn't seem to be working anyway). The reviews are at the default location, though.

Ted S
09-02-2014, 11:55 PM
The latest Firefox on Windows 7.

Also the same when I try iOS.

I turned off the automatic thread creation in forums (and that template change for the forum didn't seem to be working anyway). The reviews are at the default location, though.

One more request, this one very quick. Try turning off all your (other) plugins and load the write a review page. 99% sure it won't change anything but hey, it happens. Obviously best to do this at an off time and quickly.

Morrus
09-03-2014, 11:07 AM
One more request, this one very quick. Try turning off all your (other) plugins and load the write a review page. 99% sure it won't change anything but hey, it happens. Obviously best to do this at an off time and quickly.

Holy crap, that took a long time. Guess what I discovered? vBulletin doesn't have a "turn all off" option.

Nope, no difference.

Now to go and turn them all back on again one at a time....

Morrus
09-03-2014, 12:44 PM
Incidentally, what was the productforums.php change you made? I'd like to re-upload my custom version and restore various bits of functionality, but with the posting-to-database issue fixed. Is it a small change I can apply myself?

Ted S
09-03-2014, 09:22 PM
Incidentally, what was the productforums.php change you made? I'd like to re-upload my custom version and restore various bits of functionality, but with the posting-to-database issue fixed. Is it a small change I can apply myself?

There's likely a few tweaks around the file as digging this way turns up more than just the issue. Using a file compare (UltraCompare) is the best way to track it...

Speaking of code hacks, let's open up productforums.php and find:


// make the post as HTML using the right version of wysiwyg
if ($vbulletin->GPC['message'])
{
// handle this properly based on vBulletin version
if (version_compare(@$vbulletin->versionnumber, '4.1.4', '>=')){
require_once(DIR . '/includes/class_wysiwygparser.php');
$html_parser = new vB_WysiwygHtmlParser($vbulletin);
$comments =& $html_parser->parse_wysiwyg_html_to_bbcode($message, 1);

// older forum versions
} else {
require_once(DIR . '/includes/functions_wysiwyg.php');
$comments =& convert_wysiwyg_html_to_bbcode($message, 1);

}
}
if(!$comments AND $vbulletin->GPC['message']){ $comments = $vbulletin->GPC['message'] . "\n\r" . $optmsg; }
else if($vbulletin->GPC['comments']){ $comments = $vbulletin->GPC['comments'] . "\n\r" . $optmsg; }


Replace this with:


if ($vbulletin->GPC['message'])
{
echo "found on message<br>";
$comments = nl2br();
} else if($vbulletin->GPC['comments']) {
echo "found on comments<br>";
$comments = nl2br();
} else {
echo "found nothing"; die;
}


Post up a review and look to see if anything gets displayed quickly on the screen at the top of the page.

This is not safe content filtering so be sure to revert to your current version when you're done, less someone decide to add a bunch of unfiltered links to a product.

Morrus
09-03-2014, 09:42 PM
Post up a review and look to see if anything gets displayed quickly on the screen at the top of the page.

This is not safe content filtering so be sure to revert to your current version when you're done, less someone decide to add a bunch of unfiltered links to a product.

It did two things.

1) It rejected my review saying it had 0 characters.

2) Plus it had this at the top of the screen:

found on message

Warning: nl2br() expects at least 1 parameter, 0 given in ..../productforums.php on line 413

Ted S
09-03-2014, 10:03 PM
It did two things.

1) It rejected my review saying it had 0 characters.

2) Plus it had this at the top of the screen:

Well this is just embarrassing... Forgot to actually finish the code.


if ($vbulletin->GPC['message']) { echo "found on message<br>"; $comments = nl2br($vbulletin->GPC['message'); }
else if($vbulletin->GPC['comments']) { echo "found on comments<br>"; $comments = nl2br($vbulletin->GPC['comments'); }
else { echo "found nothing"; die; }
On the plus side, we got the debug info I needed to keep playing.

Morrus
09-03-2014, 10:13 PM
So do I need to do anything now, or do you have what you need?

Ted S
09-04-2014, 12:39 AM
So do I need to do anything now, or do you have what you need?

Try the code change with the updated version, let's see if it's a reasonable stop-gap while I try and figure out why your editor isn't loading up (still have no idea on the cause, everything seems normal).

On a related note, I'm traveling tomorrow - monday without web access. Sorry. :erm:

Morrus
09-04-2014, 04:20 PM
Try the code change with the updated version, let's see if it's a reasonable stop-gap while I try and figure out why your editor isn't loading up (still have no idea on the cause, everything seems normal).

Ah... I'm unclear. Code change with the updated version? You mean that file you said to only use briefly?

On a related note, I'm traveling tomorrow - monday without web access. Sorry. :erm:

Ugh. I guess I'll hang on until next week then. Darnit; I'm running out of time! :)

Ted S
09-08-2014, 04:39 PM
Ah... I'm unclear. Code change with the updated version? You mean that file you said to only use briefly?

Yes. Have to figure out what's causing the editor not to work as that does seem to be where the issue lies.

tpearl5
09-08-2014, 09:52 PM
Certainly possible.

What Amazon functionality were you looking for?

Forgot to reply to this :) Mainly importing of products with images (if available) from specific categories and then providing a link to 'buy' with a current price. It would probably also need the ability to filter by keyword. For example, all products from Cameras with keyword 'Nikon' import into category 'Nikon Cameras'.

Morrus
09-09-2014, 11:14 AM
Yes. Have to figure out what's causing the editor not to work as that does seem to be where the issue lies.

Ah. Well, with that file the page won't load at all - blank white page.

markoroots
09-24-2014, 08:56 PM
Hi Ted,
I'm trying the plugin on a 4.2.2 but each time I try to add an item from the acp
The first field of the page is "Forum" if I click on it is empty and let me go back to add the empty fields :(

Ted S
09-25-2014, 06:36 PM
Hi Ted,
I'm trying the plugin on a 4.2.2 but each time I try to add an item from the acp
The first field of the page is "Forum" if I click on it is empty and let me go back to add the empty fields :(

So there's no forums listed in the dropdown?

Haywire0311
10-17-2014, 05:42 PM
Ted, I've been trying to play around with the code for a few days now to figure out a way to either create a wishlist per user (user click on 'Want' and it adds it to a Want Profile tab) or allows them to favorite a product (similar to wishlist idea). Anything like that coming down the pipe because my coding skills are very basic at the moment.

Ted S
10-20-2014, 11:07 PM
Ted, I've been trying to play around with the code for a few days now to figure out a way to either create a wishlist per user (user click on 'Want' and it adds it to a Want Profile tab) or allows them to favorite a product (similar to wishlist idea). Anything like that coming down the pipe because my coding skills are very basic at the moment.

Not planned, certainly nothing crazy to build yourself. You can use the productid field already in the mod to link everything together and just work on an adding / deleting routine and a viewing / purchasing one.

Haywire0311
10-22-2014, 01:48 PM
Ted - got another question for you.

I'm trying to import a large amount of products into the review system. When I tested the file that was provided as a sample, it worked like a charm. I then decided to create a new one with about 50 different products in it. I pulled the data from a site, exported into a csv and then converted into XML. When I go to import those 50 new products, I get two issues -

1. If any of the text fields have an apostrophe in them, it breaks the import an generates a SQL error.

2. After loading about 2-3 products, it starts to import the next one but then just stops.

I've attached the XML for you to look at. At this point though, I'm stumped as to what is going wrong.

Ted S
10-22-2014, 04:06 PM
Are you importing images along with the product data?

Haywire0311
10-22-2014, 05:55 PM
Are you importing images along with the product data?
Nope, not at all.

Ted S
10-22-2014, 07:41 PM
What's the error on #1 and do you get any feedback at all on #2 (how far does it get if not)?

Haywire0311
10-23-2014, 12:13 AM
What's the error on #1 and do you get any feedback at all on #2 (how far does it get if not)?

When I import the XML file I create, it usually creates the first and somestime the second product but by the time it gets to the third, I get the message before it just stops:

post on line 1840 in /home/swtfyw/public_html/dbtech/vbactivity/includes/class_core.php
#0 /home/swtfyw/public_html/dbtech/vbactivity/includes/class_core.php(1911): VBACTIVITY::check_feature('achievement', '5', Array)
#1 /home/swtfyw/public_html/dbtech/vbactivity/hooks/threadfpdata_postsave.php(52): VBACTIVITY::check_feature_by_typenames('achievemen t', Array, Array)
#2 /home/swtfyw/public_html/includes/class_dm_threadpost.php(1955) : eval()'d code(1): require('/home/swtfyw/pu...')
#3 /home/swtfyw/public_html/includes/class_dm_threadpost.php(1955): eval()
#4 /home/swtfyw/public_html/includes/class_dm_threadpost.php(1785): vB_DataManager_Thread_FirstPost->post_save_each(true)
#5 /home/swtfyw/public_html/includes/functions_newpost.php(697): vB_DataManager_Thread_FirstPost->save()
#6 /home/swtfyw/public_html/admincp/productforums.php(1701): build_new_post('thread', Array, Array, Array, Array, Array)
#7 {main}

Edit: Ok, just tried disabling vBActivity and then importing and it now works.

However, a new issue I noticed is that for every word in the product title that has a letter 'd' in it, it automatically adds a j after the d. For instance, armageddon becomes armagedjdjon. I double checked the XML file to make sure the words were not spelled in correctly and the issue definitely does not lie there.

Edit #2: After looking at the j issue some more, it really gets bizarre. The thread is created without the letter j in it but the product title has the j in it. See attached.

Ted S
10-23-2014, 04:56 AM
Yuck. I'll dig in shortly... sorry!

Haywire0311
10-23-2014, 01:44 PM
Yuck. I'll dig in shortly... sorry!

I figured out the 'j' after 'd' issue. It's due to the normalize special character function starting on line 1861.

function normalize_str($str)
{
$invalid = array('?'=>'S', '?'=>'s', '?'=>'Dj', 'd'=>'dj', '?'=>'Z', '?'=>'z',
'C'=>'C', 'c'=>'c', 'C'=>'C', 'c'=>'c', '?'=>'A', '?'=>'A', '?'=>'A', '√'=>'A',
'?'=>'A', '≈'=>'A', '∆'=>'A', '?'=>'C', '?'=>'E', '?'=>'E', '+'=>'E', '?'=>'E',
'?'=>'I', '?'=>'I', '?'=>'I', '?'=>'I', '?'=>'N', '?'=>'O', '?'=>'O', '?'=>'O',
'?'=>'O', '?'=>'O', '?'=>'O', '?'=>'U', '⁄'=>'U', '?'=>'U', '?'=>'U', '?'=>'Y',
'fi'=>'B', 'fl'=>'Ss', '?'=>'a', '?'=>'a', '?'=>'a', '?'=>'a', '?'=>'a', '?'=>'a',
'?'=>'a', '?'=>'c', '?'=>'e', '?'=>'e', '?'=>'e', '?'=>'e', '?'=>'i', '?'=>'i',
'?'=>'i', '?'=>'i', ''=>'o', '?'=>'n', '?'=>'o', '?'=>'o', '?'=>'o', 'ı'=>'o',
'?'=>'o', '?'=>'o', '˘'=>'u', '˙'=>'u', '˚'=>'u', '˝'=>'y', '˝'=>'y', '˛'=>'b',
'ˇ'=>'y', 'R'=>'R', 'r'=>'r', "`" => "'", "?" => "'", "?" => ",", "`" => "'",
"?" => "'", "?" => "\"", "?" => "\"", "?" => "'", "&acirc;??" => "'", "{" => "",
"~" => "", "?" => "-", "?" => "'");
$str = str_replace(array_keys($invalid), array_values($invalid), $str);
return $str;
}

You can see that the first line within the array calls for replacing d with dj. I fixed it by just getting rid of it.

Still doesn't work well with vBActivity but no a big deal. I'll just shut off vBActivity when I do the mass upload.

Thanks for trying to help me through it. Now, only if you could do that hard part for me and build out that Wants/Gots function ;)

Ted S
10-24-2014, 02:12 AM
I figured out the 'j' after 'd' issue. It's due to the normalize special character function starting on line 1861.

function normalize_str($str)
{
$invalid = array('?'=>'S', '?'=>'s', '–'=>'Dj', 'd'=>'dj', '?'=>'Z', '?'=>'z',
'C'=>'C', 'c'=>'c', 'C'=>'C', 'c'=>'c', '?'=>'A', '?'=>'A', '?'=>'A', '√'=>'A',
'ƒ'=>'A', '≈'=>'A', '∆'=>'A', '?'=>'C', '?'=>'E', '…'=>'E', '+'=>'E', '?'=>'E',
'?'=>'I', '?'=>'I', 'Œ'=>'I', 'œ'=>'I', '—'=>'N', '“'=>'O', '”'=>'O', '‘'=>'O',
'’'=>'O', '?'=>'O', '?'=>'O', 'Ÿ'=>'U', '⁄'=>'U', '€'=>'U', '‹'=>'U', '›'=>'Y',
'fi'=>'B', 'fl'=>'Ss', '‡'=>'a', '?'=>'a', '‚'=>'a', '„'=>'a', '‰'=>'a', '?'=>'a',
'?'=>'a', '?'=>'c', '?'=>'e', '?'=>'e', '?'=>'e', '?'=>'e', '?'=>'i', '?'=>'i',
'?'=>'i', '?'=>'i', ''=>'o', '?'=>'n', '?'=>'o', '?'=>'o', '?'=>'o', 'ı'=>'o',
'ˆ'=>'o', '?'=>'o', '˘'=>'u', '˙'=>'u', '˚'=>'u', '˝'=>'y', '˝'=>'y', '˛'=>'b',
'ˇ'=>'y', 'R'=>'R', 'r'=>'r', "`" => "'", "?" => "'", "?" => ",", "`" => "'",
"?" => "'", "?" => "\"", "?" => "\"", "?" => "'", "&acirc;??" => "'", "{" => "",
"~" => "", "?" => "-", "?" => "'");
$str = str_replace(array_keys($invalid), array_values($invalid), $str);
return $str;
}You can see that the first line within the array calls for replacing d with dj. I fixed it by just getting rid of it.

Still doesn't work well with vBActivity but no a big deal. I'll just shut off vBActivity when I do the mass upload.

Thanks for trying to help me through it. Now, only if you could do that hard part for me and build out that Wants/Gots function ;)

Nice work!! Guess we know how often this gets used... lol.

Looking into vBa (any bug is a bad bug) and that other thing this weekend.

Ted S
10-24-2014, 02:16 AM
Do you have any mods / addons that impact the activity system?

The line with the error is calling up the hook "threadfpdata_postsave" and I'd like to fix that less is impact the frontend features (which use the same build_post routine).

Haywire0311
10-24-2014, 11:38 AM
Do you have any mods / addons that impact the activity system?

The line with the error is calling up the hook "threadfpdata_postsave" and I'd like to fix that less is impact the frontend features (which use the same build_post routine).

The only one I can think of that has any effect on the activity system is the DragonByte vBActivty mod.

Also, I think I found another small bug that probably needs some kind of SQL script run to fix it. When importing about 1700 products, I realized I imported them all into the wrong category. So, I fixed the issue in the XML and then re-uploaded to overwrite the data with the correct categoryid. It overwrote the data and corrected the categoryid and category name. However, the category count in the style dropdown in both admincp and frontend show the incorrect count number. Not sure the correct SQL syntax to use to fix the category count number.

Edit: If you want access to admin on my site, let me know and I can send you a PM with the details.

Edit #2: Just fixed the incorrect count number. Went into one of the revised items in the category just to ensure everything was correct after re-upload. All data was fine. I re-saved the item record and the count fixed itself. So the XML import overwrite won't actually fix the count until you edit a record and save again.

Ted S
10-27-2014, 02:13 AM
Suspect that addon is doing it (not a negative to the addon, it's just likely colliding between things). I'll take a look.

As for counts, that's an easy fix I'll add in along with the character mapping. Just has to recalc at the end of the import process.

Anything else strike you as off while I'm working on these tweaks?

Haywire0311
10-27-2014, 10:37 AM
Suspect that addon is doing it (not a negative to the addon, it's just likely colliding between things). I'll take a look.

As for counts, that's an easy fix I'll add in along with the character mapping. Just has to recalc at the end of the import process.

Anything else strike you as off while I'm working on these tweaks?
Just that there is no ability to add products to a wants/gots list :) Just kidding!

I really haven't found many other issues, just those bugs listed above at this point. The special character bug doesn't speak to the function not being used much. My site focuses around beer and there's tons of beers from all over the world that have funky names and characters. I think that's the only reason why I caught it and no one else did.

Sorry for pestering you with all these small tweaks. I'd do it myself but I'm really only good at reading and small tweaks to code. I'm not capable of building my own yet. Btw, great job on this mod! Love it compared to the other review mods out there. Quite a few functions that others are missing.

Morrus
11-12-2014, 04:47 PM
So I revisited this to see if I could get it working the way I wanted it to. The post formatting issues I was having above I've decided to accept, and simply tell my users it's for a short unformatted comment rather than a full review.

The last thing I need to do is to add an extra field for external reviews, so users cna use it in a Metacritic kinda way. So here's what I did:

- I changed the "Your location" text to "Original Review Location", and added some verbiage to tell the user to enter the URL of the full review in that box, and a short summary in the main message area.

- All good so far. But I can't figure out which template I change to so that I can turn that into a link rather than plain text when the actual review is displayed. Ideally, what I plan to do is post a little icon, and link that to the entered URL. I figure that's an easy template edit if I can figure out which template I need to edit.

Morrus
11-12-2014, 10:05 PM
Also, any idea why this code isn't working? I thought it was the same code I was using before, but reviews stick at the rating of the first review, and don't alter when new reviews are added.

// if we're approved, update the product count & average review, and user's review count
if(!$vbulletin->options['prodforums_appreviews'])
{
$ratings = $db->query_first_slave("SELECT rating FROM "
. TABLE_PREFIX
. "pf_review WHERE productid = "
. $db->escape_string($vbulletin->GPC['productid']) );

$new_rating = (array_sum($ratings)/((count($ratings)*5))*100);

$db->query_write("UPDATE "
. TABLE_PREFIX
. "pf_product SET rating = "
. $new_rating
.", reviews = reviews + 1 WHERE productid = '"
. $db->escape_string($vbulletin->GPC['productid']) ."'");

}

Morrus
11-14-2014, 12:23 PM
I got that code working (redid it - took the original averaging code and just applied a multiplier).

I haven't managed to figure out the location thing, though.

I have added a column to display the added date (which I've renamed release date). Only issue there is you have to use PHPMYADMIN to edit the dates after they are added, but it's doable. The main reason I wanted to do that was so I could add upcoming products, but have them not show a review link until the release date. I can't for the life of me figure out how I compare today's date to that date in a bulletin template conditional, though. I suspect it's not possible.

Here's where I am so far. It looks quite good, I think, though the code and templates are probably now a hideous mess:

http://www.enworld.org/forum/productforums.php

Morrus
11-15-2014, 05:27 PM
Additional question - how on earth do you persuade vBulletin to display the created date on the product details/reviews page?

Ted S
11-15-2014, 11:32 PM
To make the location into a link, you'll just need to update the prodforums_matches_bit template again:
<a href="{vb:raw review.location}">click me</a>

You may also want to add some validation to the location string to insure it's a valid formatted URL. This can be done by adding to the hook location productforums_writereview_top (which will insure it stays intact if you upgrade the plugin down the road).

You can use one of many common regex strings (just google php regex for urls) for the check function depending on what you want to allow.

Ted S
11-16-2014, 03:04 AM
Additional question - how on earth do you persuade vBulletin to display the created date on the product details/reviews page?

Use the variable createddate which vBulletin's template engine can format.

https://www.vbulletin.com/docs/html/main/styleref_templates_syntax

Morrus
11-16-2014, 11:31 AM
Use the variable createddate which vBulletin's template engine can format.

https://www.vbulletin.com/docs/html/main/styleref_templates_syntax

I tried both {vb:raw createddate} and {vb:var createddate} but neither of them work.

(vb:date createddate} just gives me Thu, 01 Jan 1970 00:00:00.

I tried them all with posteddate too. This isthe full list of things I've tried so far:

{vb:raw posteddate}
{vb:var posteddate}
{vb:raw createddate}
{vb:var createddate}
{vb:date createddate}
{vb:date posteddate}
{vb:var product.creatteddate}
{vb:var product.posteddate}
{vb:raw product.creatteddate}
{vb:raw product.posteddate}

I need to figure this out, partly because I want to add further product fields (pagecount, format, etc.) I'm learning stuff as I go, and getting this little bit wrking will hopefully mean I then know how to do it with other things.

Morrus
11-16-2014, 12:01 PM
To make the location into a link, you'll just need to update the prodforums_matches_bit template again:
<a href="{vb:raw review.location}">click me</a>

You may also want to add some validation to the location string to insure it's a valid formatted URL. This can be done by adding to the hook location productforums_writereview_top (which will insure it stays intact if you upgrade the plugin down the road).

You can use one of many common regex strings (just google php regex for urls) for the check function depending on what you want to allow.

prodforums_matches_bit isn't the right one - I meant where the actual review is. I guess it's a postbit template?

I've attached an image which hopefully explains it!

Morrus
11-16-2014, 01:52 PM
Another question. Sorry!

I see this code in productforums.php:

$history = $db->query_first_slave("SELECT reviewid FROM " . TABLE_PREFIX . "pf_review WHERE productid = '". $db->escape_string($vbulletin->GPC['productid']) ."' AND userid = ". $vbulletin->userinfo['userid']);

Now, can I copy that over to the product listing part of the file? And, if so, is there then a way I can use that $history thing (variable?) in the template to determine whether or not to display a link to review a product or a note that the user already has reviewed it?

Shinkaze
11-16-2014, 08:25 PM
Very cool (and needed) mod. I just installed it and am setting everything up. However the image uploader does not appear to work well with my version of vB (4.2.2). I have set the CHMOD for the upload directory a directed to 777, but am still getting a failed to open stream error on upload of images?

Morrus
11-16-2014, 08:59 PM
It's not the vBulletin version. I'm on 4.2.2 also, and it works fine. You issue is not related to your version of vBulletin.

Shinkaze
11-16-2014, 09:05 PM
It's not the vBulletin version. I'm on 4.2.2 also, and it works fine. You issue is not related to your version of vBulletin.In that case here is some of my PHP info?

PHP Version 5.5.17
System Linux x86_64
Build Date Sep 19 2014 09:49:15
GD Support enabled
GD Version bundled (2.1.0 compatible)

Morrus
11-16-2014, 09:12 PM
In that case here is some of my PHP info?

PHP Version 5.5.17
System Linux x86_64
Build Date Sep 19 2014 09:49:15
GD Support enabled
GD Version bundled (2.1.0 compatible)

Sadly, you're mistaking me for something more than somebody else who happened to install it on the same version.

Ted S
11-21-2014, 06:24 AM
I tried both {vb:raw createddate} and {vb:var createddate} but neither of them work.

(vb:date createddate} just gives me Thu, 01 Jan 1970 00:00:00.



When you look at your database, are there values on those fields in the pf_ tables?

Ted S
11-21-2014, 06:25 AM
Very cool (and needed) mod. I just installed it and am setting everything up. However the image uploader does not appear to work well with my version of vB (4.2.2). I have set the CHMOD for the upload directory a directed to 777, but am still getting a failed to open stream error on upload of images?

According to the error, your file path is incorrect. Be sure it's set from the root of your server, not just the root location you FTP into which is likely a far higher level.

Also some functions I need to update, hence the depreciated warnings. These aren't nice but won't impact the function.

Ted S
11-21-2014, 06:28 AM
prodforums_matches_bit isn't the right one - I meant where the actual review is. I guess it's a postbit template?

I've attached an image which hopefully explains it!

Ahh.

Viewing a review is actually just viewing a post/ thread. While there's index data, the module simply creates new posts when a review is posted to allow for the discussion to continue.

As such, you'd have to append the link to the post before it's created.

There's no hook location that's ideal for this in the module but if you add your code around line 407, you should be good. I'll add one to the next release for portability.

Ted S
11-21-2014, 06:32 AM
Now, can I copy that over to the product listing part of the file? And, if so, is there then a way I can use that $history thing (variable?) in the template to determine whether or not to display a link to review a product or a note that the user already has reviewed it?

Not sure where you want to use this? Can you rephrase or provide a url (remove your domain if you wish, I just need the forum part)?

Morrus
11-21-2014, 10:40 AM
When you look at your database, are there values on those fields in the pf_ tables?

Oh, that was a while ago now! I figured it out. The variable wasn't registered (a concept I was not even aware of 5 days ago).

I had to learn how to register variables for use with templates. But before that, I had to work out where the code was, and it took me a couple of days to work out it was in a plugin, and what a plugin was.

Still, I got there eventually. Took a while!

Morrus
11-21-2014, 10:41 AM
Not sure where you want to use this? Can you rephrase or provide a url (remove your domain if you wish, I just need the forum part)?

I have buttons around the place saying "Review this!". I would like them not to appear if the user has already reviewed it.

Example:

http://www.enworld.org/forum/productforums.php

As you can see every item has a button at present.

Ted S
11-21-2014, 02:50 PM
Oh, that was a while ago now! I figured it out. The variable wasn't registered (a concept I was not even aware of 5 days ago).

I had to learn how to register variables for use with templates. But before that, I had to work out where the code was, and it took me a couple of days to work out it was in a plugin, and what a plugin was.

Still, I got there eventually. Took a while!

What ones did you add in (so I can be sure to port it to the next update)?

Ted S
11-21-2014, 02:52 PM
I have buttons around the place saying "Review this!". I would like them not to appear if the user has already reviewed it.

Example:

http://www.enworld.org/forum/productforums.php

As you can see every item has a button at present.

Gotcha.

You could use that query though it will add more load as it's coming up on every view to those pages.

To minimize, run it on logged in users only (simple check that there is a userid set). Then use $history with your templates to decide if the button shows or not. I can help if you get stuck in any of that.

Morrus
11-21-2014, 03:14 PM
What ones did you add in (so I can be sure to port it to the next update)?

I wouldn't worry. My version of the product is so different to yours now that I'm never going to be able to use any updated versions! :)

My current bugbear is showing product info (rating, number of reviews, etc.) in the umatches_bit template. The PHP code in that area of productforums.php is too complex for me to play with, with all its arrays and loops and stuff.

gfran5
12-07-2014, 09:05 AM
Am i able to have this without it being displayed on forumhome? Want it just to be accessed through the nav bar...

Ted S
12-08-2014, 04:19 PM
Am i able to have this without it being displayed on forumhome? Want it just to be accessed through the nav bar...

There's nothing that it shows in forumhome other than forums.

Athena1984
01-26-2015, 07:12 AM
Hello,

I've made a new tab for the product reviews and would like to know if it's possible to keep the "Reviews" tab selected when viewing the product thread. Any help would be greatly appreciated.

tomshawk
02-08-2015, 07:43 PM
If I wanted to change the name from Products to something else, for the name of the file as well as everywhere in the pages, say I want to change it to book or books.

So for example productforums.php just becomes books.php
On that page where it says Products and Reviews, it becomes books and reviews. ETC
What would be the easiest way to do that?

Thanks in advance for any help

Ted S
02-08-2015, 10:39 PM
If I wanted to change the name from Products to something else, for the name of the file as well as everywhere in the pages, say I want to change it to book or books.

So for example productforums.php just becomes books.php
On that page where it says Products and Reviews, it becomes books and reviews. ETC
What would be the easiest way to do that?

Thanks in advance for any help

Rename the file.

Search template manager and phrase manager for all current names and do the same in actual script just in case!

tagline
03-09-2015, 03:11 PM
Hi guys,

I've installed this product but is not what I'm searching for. I've tried to unistall but there is no way to remove Product Review Settings and Product Review Items tab's from ACP. How to do that? Thank's

Ted S
03-09-2015, 03:55 PM
Hi guys,

I've installed this product but is not what I'm searching for. I've tried to unistall but there is no way to remove Product Review Settings and Product Review Items tab's from ACP. How to do that? Thank's

Delete all the files you uploaded including those in the includes/ folder.

tagline
03-09-2015, 04:55 PM
Delete all the files you uploaded including those in the includes/ folder.

Thank's :up:

DreadsUK
03-25-2015, 03:40 PM
Hi, i've moved our forum to a different domain and the images for all the products have been lost. Can anyone tell me where i can change the domain name for the plugin to direct back all the images.

Thanks

Ted S
03-27-2015, 06:49 PM
Hi, i've moved our forum to a different domain and the images for all the products have been lost. Can anyone tell me where i can change the domain name for the plugin to direct back all the images.

Thanks

The addon uses relative paths and assumes everything is hosted on the same domain as most forums are. You'll need to resync images / update the databsse if you moved the structure around.

tomshawk
04-04-2015, 04:30 AM
I'm curious, in the 3rd pic on the OP. The list of products?

How easy would it be to modify this.

I'd like to see
my books image
the name
the rating
the price,
and a link to the description page
but in 3 or 4 columns across

I think it would take up less space and make room for more products on a page.

Ted S
04-13-2015, 01:06 AM
I'm curious, in the 3rd pic on the OP. The list of products?

How easy would it be to modify this.

I'd like to see
my books image
the name
the rating
the price,
and a link to the description page
but in 3 or 4 columns across

I think it would take up less space and make room for more products on a page.

It's all displayed via a template so, assuming you don't want to add any fields, editing is as quick as you can change the html and corresponding css.

tomshawk
04-13-2015, 01:57 AM
Thank you but as a novice changing html and CSS is not my fortay

Could you assist with this?

Also,

I have a few more questions as well if you do not mind

What if I want to add fields for the reviews in pic 1 and 2, for example, a field in my books for reading level, or amount of pages in a book.

Also, is there a way to add more images to the product profile like you see on ebay for example?

Thank you in advance for the outstanding addon BTW

tomshawk
04-15-2015, 05:11 AM
Are you comfortable editing php? If so, try removing the ,1 from line 416 of the script.

If not, tell me about your server... is it using Apache? Shared or dedicated host? Does the review still post?

I installed this onto a friends site and I get this same error.
I removed the ,1 and the error remains.
The star rating does not register, and the review counter does not show up as there being one.

The review truncates into a large wall of text.
I see the review there in the review forum as well as in the AdminCP, if I go to delete it in the admincp I get this error

Warning: mysqli_query() [function.mysqli-query (http://www.theloeg.org/forums/admincp/function.mysqli-query)]: (22003/1690): BIGINT UNSIGNED value is out of range in '(`tomwayne_vb422`.`vb422pf_product`.`reviews` - 1)' in ..../includes/class_core.php on line 1393

This is a vbulletin 4.2.2 PL4 fresh install

Any help would be great, thank you

tomshawk
04-16-2015, 06:22 PM
Anybody have an idea?

This mod works perfectly on vb 4.0.0 but gives the error above in 4.2.2 PL4

Sorry if I seem impatient but I told my friend about how good it is and well.

Thanks in advance

Ted S
04-16-2015, 11:13 PM
Thank you but as a novice changing html and CSS is not my fortay

There's a forum here for coding support discussions that may be a good place to try.

What if I want to add fields for the reviews in pic 1 and 2, for example, a field in my books for reading level, or amount of pages in a book.

The addon supports custom fields but it's pretty basic. You can't change them by category for example but they will allow this sort if info. They're in the admin settings.

Also, is there a way to add more images to the product profile like you see on ebay for example?

You can use bbcode or basic html to embed them if they're already posted somewhere (which works depends on your forum settings).

Ted S
04-16-2015, 11:16 PM
I installed this onto a friends site and I get this same error.
I removed the ,1 and the error remains.
The star rating does not register, and the review counter does not show up as there being one.

The review truncates into a large wall of text.
I see the review there in the review forum as well as in the AdminCP, if I go to delete it in the admincp I get this error

Warning: mysqli_query() [function.mysqli-query (http://www.theloeg.org/forums/admincp/function.mysqli-query)]: (22003/1690): BIGINT UNSIGNED value is out of range in '(`tomwayne_vb422`.`vb422pf_product`.`reviews` - 1)' in ..../includes/class_core.php on line 1393

This is a vbulletin 4.2.2 PL4 fresh install

Any help would be great, thank you

The problem is that the value being posted is negative. Sounds like the counter didn't go up properly and needs to be reset to 1 if the content is still there to delete or 0 if it's been cleared.

You'll have to excuse me but I don't recall the exact details anymore and didn't see what you quoted from in the last few pages of the thread?

tomshawk
04-16-2015, 11:29 PM
Thank you Ted, I was able to figure out the custom fields option while playing on my site. I have not customized my friends yet but I know where to start.

I will ask about the HTML changes on the other forum.

The error I am reffereing to is

Writing a review causes
Warning: Only variables should be assigned by reference in ..../productforums.php (line 416)

You suggested this

Are you comfortable editing php? If so, try removing the ,1 from line 416 of the script.

The server is running apache

The star rating does not register, and the review counter does not show up as there being one.

The review truncates into a large wall of text.
I see the review there in the review forum as well as in the AdminCP, if I go to delete it I get this error

Removing the ,1 from that line did not fix the problem.

I am also getting this

Warning: mysqli_query() [function.mysqli-query (http://www.theloeg.org/forums/admincp/function.mysqli-query)]: (22003/1690): BIGINT UNSIGNED value is out of range in '(`tomwayne_vb422`.`vb422pf_product`.`reviews` - 1)' in ..../includes/class_core.php on line 1393

when trying to delete the review.

This is vbulletin 4.2.2 PL4 where mine is 4.0.0thank you again for your support on this awesome addon, it is greatly appreciated

tomshawk
04-22-2015, 07:17 PM
OK, this problem seems to be related to the socialpages problem with vbulletin 4.2.2
I found it as I noticed I got another error when just trying to use advanced search function in VB on this new site, as soon as I patched that error, this one went away.

So, now the only problem I have now is the truncating of the review into a long wall of text instead of paragraphs and lines as it should be.

Not to drive you up the wall but, as part of my customization, I want to remove the start rating system

I have removed it for all the pages via templates except the review creation screen.
If I remove it from there, I cant not create a review as I did not add a rating.

How do I remove it as a requirement?

Thank you

Ted S
04-23-2015, 10:59 PM
So, now the only problem I have now is the truncating of the review into a long wall of text instead of paragraphs and lines as it should be.


Do you allow HTML or BBCode on the forum reviews post to? Can you try toggling both on / off to see if it helps?

How do I remove it as a requirement?

Remove it from the template and add a hidden form field with a value of 1 in its place. This way it gets past along for the script to check and the database to insert though you won't show it back anywhere.

tomshawk
04-24-2015, 01:35 AM
Do you allow HTML or BBCode on the forum reviews post to? Can you try toggling both on / off to see if it helps?

Remove it from the template and add a hidden form field with a value of 1 in its place. This way it gets past along for the script to check and the database to insert though you won't show it back anywhere.

Forgive my ignorance, again

This hidden form field

Is this done in the Custom form field?
If it is, I do not see a hidden option
and I assume the title does not matter.

What will this do to the Thread creating title.
right now, it says 5 out of 5 rating for (Product title)

I'd rather it just say Rev: (Product Title)

Ted S
04-24-2015, 08:42 PM
Forgive my ignorance, again

This hidden form field

Is this done in the Custom form field?
If it is, I do not see a hidden option
and I assume the title does not matter.

What will this do to the Thread creating title.
right now, it says 5 out of 5 rating for (Product title)

I'd rather it just say Rev: (Product Title)

No, you would be adding it to the HTML code (the field name is "rating").

Remove:


<div class="blockrow">
<label for="rating">{vb:phrase prodforums_writeitrating} <span style="color:red;">*</span></label>
<select name="rating">
<option value="">--- {vb:phrase prodforums_select} ---</option>
<option value="1">1 {vb:phrase prodforums_star}</option>
<option value="2">2 {vb:phrase prodforums_stars}</option>
<option value="3">3 {vb:phrase prodforums_stars}</option>
<option value="4">4 {vb:phrase prodforums_stars}</option>
<option value="5">5 {vb:phrase prodforums_stars}</option>
</select>
</div>

Add


<input type="hidden" name="rating" value="1" />


http://www.w3schools.com/tags/att_input_type.asp

The thread title is set from the phrase prodforums_reviewtitle. {2} is the title, the rest can be removed.

tomshawk
04-24-2015, 10:00 PM
Thank you, that hidden code eliminates the need for rating.

But, now, the product details page does not count the review, it still says would you like to be first to review.

Also, still just a huge wall of text though, with bbcode and html enabled on the forums as well as the usergroup

The title fix worked perfectly, thank you

tomshawk
04-24-2015, 10:28 PM
I figured I would try something

If I copy the review before submitting, then edit the review and paste it in after I submit, it looks fine

If I re-write the review but add in the line break manually with

<br>

It posts but double-spaced lines.

Very wierd

Ted S
04-25-2015, 05:01 PM
Thank you, that hidden code eliminates the need for rating.

But, now, the product details page does not count the review, it still says would you like to be first to review.

Also, still just a huge wall of text though, with bbcode and html enabled on the forums as well as the usergroup

The title fix worked perfectly, thank you

Does this bug continue if you write a second review? Any errors with the posting process along the way?

Will dig in to the breaktags more tomorrow or monday.

tomshawk
04-25-2015, 06:01 PM
Yes, subsequent reviews do the same thing.

Turns reviews into a wall of text and the review counter does not multiply

Ted S
04-28-2015, 08:50 PM
Turns reviews into a wall of text and the review counter does not multiply

Hrm, if you look in the table pf_product (via phpmyadmin, mysql or just through your vbulletin query manager), do you see any value on that thread id?

SELECT * FROM pf_product WHERE threadid = X;

(add prefixes before pf_product if used).

Ted S
04-28-2015, 08:59 PM
Yes, subsequent reviews do the same thing.

This is not going to be fun as I can't replicate so I apologize but I'm going to have to try making changes and have you try them out. Try this version of the addon to start.

REPLACE IT WITH THE CURRENT ACTIVE VERSION AFTER YOU HAVE TESTED, IT WILL SHOW DEBUG CONTENT.

tomshawk
04-28-2015, 10:15 PM
Hrm, if you look in the table pf_product (via phpmyadmin, mysql or just through your vbulletin query manager), do you see any value on that thread id?

SELECT * FROM pf_product WHERE threadid = X;

(add prefixes before pf_product if used).

Strange, it is giving error 1146
Table does not exist.

That new productforums.php just gives me a blank white screen when I try to go to it.

Don't apologize, I realize this addon was made quite a while ago and for a different version of vBulletin.

I truly appreciate all the help.

Ted S
04-29-2015, 03:11 PM
Strange, it is giving error 1146
Table does not exist.

Do you use table prefixes? if so, you need to include them into the query.

tomshawk
04-29-2015, 10:43 PM
I went into repair optimize tables as I did not think he used a prefix but I found

vb422pf_product

so ran the query again

SELECT * FROM vb422pf_product WHERE threadid = X
this time I get

An error occurred while attempting to execute your query. The following information was returned.
error number: 1054
error desc: Unknown column 'X' in 'where clause'

Then just for giggles I ran this thinking there needed to be a . between the prefix and the table name

SELECT * FROM vb422.pf_product WHERE threadid = X;

and got this error

An error occurred while attempting to execute your query. The following information was returned.
error number: 1142
error desc: SELECT command denied to user 'tomwayne_vb422'@'localhost' for table 'pf_product'

Ted S
04-30-2015, 03:53 AM
X is the id of the thread you're looking at reviews for (shown in the url). You could also use productid to figure it out that way.

Whichever you go with, you have to change it to an actual value :)

Killhunter
08-10-2016, 02:38 PM
I would like to keep asc order instead of desc, the latter is being forced every time I search for something on the product listing page. Anyone has a tip for me? It's only like this since the update. Before that, they were sorted by date (which would be great for the front page).

Morrus
08-11-2016, 10:06 AM
Ted S, I wonder if you can help with something?

I'm still using this (fairly heavily modded) and it works great. However, there is a "workflow" issue I run into -- people add a new product, I get round to noticing that it has been added, I clean up the entry, approve it... and by then the original person has forgotten they ever added it.

I'd love to streamline this somehow. Basically, I'd like people to be able to add a product and it go live immediately so that the user is immediately prompted to add his/her review. I can always clean up the product entries later.

Is there an easy way to do this? Basically, I guess, it's a permissions thing - just setting a new item to "approved" immediately.

PattiOz
11-23-2016, 05:09 AM
Greetings! I am using version 1.2.3
Is upgrading as simple as over-writing existing files with the new files?
Thank you.