PhotoPost Community

PhotoPost Community (http://www.photopost.com/forum/)
-   ReviewPost Bug Reports (http://www.photopost.com/forum/reviewpost-bug-reports/)
-   -   showcat.php index thumb links now broken(FIXED) (http://www.photopost.com/forum/reviewpost-bug-reports/115507-showcat-php-index-thumb-links-now-broken-fixed.html)

Arnie September 1st, 2005 07:23 PM

showcat.php index thumb links now broken(FIXED)
 
I've just updated the core files with the latest version online and now the thumbnails for a product/review in a categroy have broken links.

E.g. /reviewpost/showcat.php?cat=16&page=1

Each image/thumbnail links to:

/reviewpost/showcat.php/cat/16/ppuser/

Arnie September 1st, 2005 07:58 PM

Well there's what I think the problem is: $thumbtag is not defined or assigned in showcat.php, then it's used on line 446:
$catimage = get_thumbtmpl( $id, $thumbrc, $height, $width, $thumbtag, $pcat );

Because thumbtag is null then means that the function in pp-inc defaults to:
if ( $Globals['spider'] == "yes" )
$murl = "<a href=\"{$Globals['maindir']}/showcat.php/cat/$whichcat/ppuser/$theuserid\">";

..where is $thumbtag meant to be assigned in the code?

Normally if the second to last variable isn't passed into the function:

function get_thumbtmpl( $id, $imgtag, $height, $width, $thumbtag, $whichcat="-1" , $thislink = "" ) {

it defaults to -1 and then works, however if you pass a null variable into the function is switches incorrectly. $whichcat is set to "null" not "-1"and it all falls over to the last else statement and thus creates the ppuser url.


Excuse my sprawling explanation it might not be right but it's a start.

Chuck S September 2nd, 2005 09:02 AM

we pass the $pcat variable as the $whichcat so that looks right to me. Your reporting something I beleive we handled the day or so after release.

Arnie September 4th, 2005 08:40 AM

I've updated to 3.01 and I still get this error, checkout the links to the products here:

http://www.arniesairsoft.co.uk/revie...?cat=16&page=1

Note showcat2.php is the NEW version of showcat (as jsut downloaded) it's not live as the code is in use and I'm not replacing the current version with one that's buggy ;)

Arnie September 4th, 2005 09:01 AM

Running a debug dump before $checklink is passed to get_thumbtpl on line 448, $checklink is equal to the actual server path for my image e.g.

/home/[name]/[site DNS]/html/reviewpost/data/16/37SV_005.jpg (which is correct)

And $pcat is equal to the category ID tag, which is again correct (there may be debug info on for the page I linked to as I'm messing with it to locate the issue.

get_thumbtmpl has not changed so I'm pretty sure the issue is in the new shotcat code, as the previous version I had worked just fine.

Arnie September 4th, 2005 09:09 AM

Well I think I ahve a fix.. but I don't know why yet.

Changing the line to : "$catimage = get_thumbtmpl( $id, $thumbrc, $height, $width, $checklink);" (removing the last variable passed, $pcat) makes everything work again properly.

Ah well there we go... $pcat is say 16, which is the category ID tag, get_thumbtmpl then correctly operates and goes to this loop:

if ( $Globals['spider'] == "yes" )
$murl = "<a href=\"{$Globals['maindir']}/showcat.php/cat/$whichcat/ppuser/$theuserid\">";
else
$murl = "<a href=\"{$Globals['maindir']}/showcat.php?cat=$whichcat&amp;ppuser=$theuserid\">";

This leaves us with the incorrect "showcat.php/ppuser" links. get_thumbtmpl is operating properly.. well as it's written, however it's outputting category style links instead of product links because showcat.php has sent the wrong variables across.

Chuck S September 4th, 2005 09:13 AM

There is no issue here I see

Here is the code I have in showcat.php

$checklink = "{$Globals['datafull']}$pcat/$tuserid$filename$theext";

if ( file_exists($checklink) ) {
$image_stats = @getimagesize( $checklink );
$width = $image_stats[0];
$height = $image_stats[1];
}


$catimage = get_thumbtmpl( $id, $thumbrc, $height, $width, $checklink, $pcat );

$gallery['hasimage'][$count] = "$catimage";

This just gets the width and height of an image IF IT EXISTS. The proper variables are passed

Also the very page you are linking works entirely correct as the links all work so where is your issue. The only problem I see on the whole page is you just debugging things

Arnie September 4th, 2005 09:15 AM

Check the URL links for the product thumbnails. I've just restored the code to "as is" from the distro, plus the DEBUG gumf. It worked because I was playing with it to try to get it to work.

Where is your install of the current code? It'd be nice to see the current code that's available for download working somewhere to test things.

Arnie September 4th, 2005 09:19 AM

To create a product link in showcat, $whichcat for the thumbnail code must be:

$whichcat == -1 || $whichcat == "most_views" || $whichcat == "latest" || $whichcat == "random")

You're passing $pcat from showcat.php, which is the ID tag for the product category. Therefore the code as is can't produce the link types it's meant to.

Look at your own install here:

http://www.omegatron.net/rp/showcat.php?cat=53

Now look at the URL link on the thumbnail product image.

Arnie September 4th, 2005 09:24 AM

On the lines in showcat.php after get_thumbtmpl you even assume that what you're showing is a product:

Code:

Content visible to verified customers only.
IMHO the code in showcat.php should be:

$catimage = get_thumbtmpl( $id, $thumbrc, $height, $width, $checklink)

There's no need to pass $pcat, it's not a category, it's a product thumbnail.

Chuck S September 4th, 2005 09:25 AM

Oh I See What Your Trying

THIS IS NOT A BUG

Remember the thumb image returns a link to the category it is in.

If you want to have it link elsewhere you need to place an ahref tag around the thumb to link to the product.

You where the very one weeks ago reporting an extra <a href tag which had me remove exactly what your trying to do

The link should be this then

if ( $Globals['spider'] == "yes" ) $gallery['hasimage'][$count] = "<a href=\"{$Globals['maindir']}/showproduct.php/product/$id/sort/$sortparam/cat/$cat/page/$page\">$thumbrc</a>";
else $gallery['hasimage'][$count] = "<a href=\"{$Globals['maindir']}/showproduct.php?product=$id&amp;sort=$sortparam&amp;cat=$pcat&amp;page=$page\">$thumbrc</a>";

Arnie September 4th, 2005 09:26 AM

You see the same problem on your own install?

Arnie September 4th, 2005 09:37 AM

Sorry but you're wrong.

Look at your own install:

http://www.omegatron.net/rp/showcat.php?cat=53

The link on that thumbnail should be to the product, NOT the category you are already viewing.

"Test VB 3.5" and the image of the coral underwater should link to the same place"

If it is as you say correct, then what on earth is the point of having a link on a thumbnail image to the same category that you are looking at? Surely it should link to the product, just as the product name does.

Chuck S September 4th, 2005 09:41 AM

THIS IS NOT A BUG!!

You choose what feature you want and go with it. The product is coded currently to allow the thumbnails on the showcat page to pick up the custom frames a user can choose as a result the get_thumbtmpl function returns a link to showcat and as such thats the link you get

Now if you want to use regular thumbnails with product links I have posted the code above.

You are the guy that reported the initial bug with a secondary a href tag being used and I removed it

Arnie September 4th, 2005 09:45 AM

The original bug I posted was in reference to having an a-href tag nested inside another tag, which was a very wierd way to have the html code..

My point is that the thumbnail for a product linking to the category you are already in, whilst possibly what you intended, is a rather odd way to go on. Sure I can customise it later, but why would you want it like that by default?

Simply changing the line (around 447) in showcat.php to this:

$catimage = get_thumbtmpl( $id, $thumbrc, $height, $width, $thumbtag );

..and it all works in a way that makes a lot more sense.

Chuck S September 4th, 2005 09:47 AM

Now I may be able to get both features to work together though ;)

Point is the way this was coded was a link is not necessary. The feature was to be able to grab the feature templates to wrap around the thumbs. The function you are talking properly passes a showcat.php which is what it is suppose to do. However there is a switch to pass a direct product link try this


TRY THIS

Code:

Content visible to verified customers only.

Arnie September 4th, 2005 09:51 AM

Hey that works a lot better :)


See it working here: http://www.arniesairsoft.co.uk/revie...at2.php/cat/16

THANK YOU.

My apologies for not being understood, but I'm glad that a mutual fix can be found. I've removed you off ICQ, so I'll just pester you on here.

Chuck S September 4th, 2005 09:55 AM

It's no problem IMing ( as long as its not consistent ) me but you where not understanding the real intention of the get_thumtmpl thing is the frame thing was the new feature not the link as the showcat link was correct.

I can always compromise and come up with a solution though ;)


All times are GMT -5. The time now is 10:17 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97