Support Forums

Extra Field Search / Save Extra Field to Short Desciption

This is a discussion on Extra Field Search / Save Extra Field to Short Desciption within the Technical Support forums, part of the Technical Support Forums category; v4.1.8 Designer I just upgraded to 4.1.8, and the includes / classes / kernel / Listings.php file is HUGELY different. ...


Go Back   68 Classifieds Forums > Technical Support Forums > Technical Support

Reply
 
Thread Tools Display Modes
Old 01-27-2010, 10:18 PM   #1
Customer
 
tlombard's Avatar
 
Join Date: Oct 2009
Location: Parker, CO
Posts: 37
Rep Power: 5
tlombard is on a distinguished road
Default Extra Field Search / Save Extra Field to Short Desciption

v4.1.8 Designer

I just upgraded to 4.1.8, and the includes / classes / kernel / Listings.php file is HUGELY different.

I was saving the extra field values to the shortDesciption database field (so the search would work with the extra fields) by doing this:

In the function addListingFields($id) at line 1124 I inserted:
PHP Code:
if (!$result
                    {
                        die(
mysql_error());
                    }
/**
*TOM LOMBARD
*ADD EXTRA FIELDS TO SHORT DESCRIPTION
*STORE EXTRA FIELD VALUES TO STRING
*/
$extraFieldValues.=GetSQLValueString(trim($objValue), "text");
                    
$i++; 
Then at line 1134 I inserted:
PHP Code:
 }// end foreach
/**
*TOM LOMBARD
*ADD EXTRA FIELDS TO SHORT DESCRIPTION
*UPDATE SHORT DESCRIPTION FIELD WITH EXTRA FIELDS
*/
$query="UPDATE ".PREFIX."listings SET shortDescription=$extraFieldValues WHERE id=$id";
mysql_query($query);
    } 
I did the exact same thing in the function editListingFields($id).

Now that the includes / classes / kernel / Listings.php is so different, can someone take a quick look and help me figure how to accomplish this with the new Listings.php file structure.

Please help.

-Tom
__________________
-Tom

GunListUSA.com
Gun List USA is Better...
No Auctions, Just FREE Ads!!!
tlombard is offline   Reply With Quote
Old 01-28-2010, 08:15 AM   #2
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 2,939
Rep Power: 71
seymourjames is a jewel in the rough
Default

I was looking at this too and it is ironic that a new thread about was just made. You could try adding it as a set of key phrases to the main description itself. Let us know if it works.
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68 Classifieds
seymourjames is offline   Reply With Quote
Old 01-29-2010, 12:41 PM   #3
Customer
 
tlombard's Avatar
 
Join Date: Oct 2009
Location: Parker, CO
Posts: 37
Rep Power: 5
tlombard is on a distinguished road
Default

Wow...The Listings file is WAY DIFFERENT and WAY confusing.

At first blush...I don't even find the 'UPDATE' SQL statements for listings or the extra fields.

Maybe a developer can chime in here.

If I want to save the extra field values to the short description field..LIKE I HAD working in the previous version, where/how would this be accomplished NOW?

-Tom
__________________
-Tom

GunListUSA.com
Gun List USA is Better...
No Auctions, Just FREE Ads!!!
tlombard is offline   Reply With Quote
Old 01-29-2010, 03:25 PM   #4
Customer
 
tlombard's Avatar
 
Join Date: Oct 2009
Location: Parker, CO
Posts: 37
Rep Power: 5
tlombard is on a distinguished road
Default

Ok...I figured it out.

(FYI...Extra fields are stored in the products_fields table. When they are edited. Clas68 DELETES them ALL then RE-Inserts each of them back into the products_fields table.)

So to save Extra Fields to Short Description field:
in file: includes / classes / kernel / Listings.php

In the function addListingFields($id) at line ~ 1124.

PHP Code:
if (!$result

   die(
mysql_error()); 

/** 
*TOM*LOMBARD 
*ADD*EXTRA*FIELDS*TO*SHORT*DESCRIPTION 
*STORE*EXTRA*FIELD*VALUES*TO*STRING 
*/ 
$extraFieldValues.=$objValue;
  
$i++; 
Then at line 1134 I inserted:

PHP Code:
}// end foreach 

/** 
*TOM*LOMBARD 
*ADD*EXTRA*FIELDS*TO*SHORT*DESCRIPTION 
*UPDATE*SHORT*DESCRIPTION*FIELD*WITH*EXTRA*FIELDS 
*/ 
$extra "UPDATE ".PREFIX."listings SET ";
$extra.="shortDescription='$extraFieldValues' ";
$extra.="WHERE id=$id";
$result=@mysql_query($extra);
if (!
$result
    {
        die(
mysql_error());
    }

I did the exact same thing in the function editListingFields($id).

I also had to remove any reference to the shortDescription Text Field and Databse Field in in the SQL INSERT statements.

I'm back...NOW my Quick Search will also include for the Extra Fields.

www.gunlistusa.com

-Tom
__________________
-Tom

GunListUSA.com
Gun List USA is Better...
No Auctions, Just FREE Ads!!!
tlombard is offline   Reply With Quote
Old 03-02-2010, 10:32 AM   #5
Customer
 
Join Date: Feb 2010
Posts: 25
Rep Power: 4
JWB is on a distinguished road
Default

Tom -> Nice - I was also frustrated about the search didn't include the fields. I think some thing like this should be default for 68.

Any way - I would really like to try your hack. I just have one question I hope you can help me with:

Quote:
I also had to remove any reference to the shortDescription Text Field and Databse Field in in the SQL INSERT statements.
Didn't followed you completely there - in which file and where do I do this?

Sorry to ask - but I am a complete newbie to this software....
JWB is offline   Reply With Quote
Old 03-02-2010, 11:53 AM   #6
Customer
 
tlombard's Avatar
 
Join Date: Oct 2009
Location: Parker, CO
Posts: 37
Rep Power: 5
tlombard is on a distinguished road
Default

In this file:
/ includes / classes / kernel / Listings.php

Find the 'Add Listing Function' (function addListing($data, $admin=FALSE))

remove 'short description' from the INSERT SQL string:
PHP Code:
$sSQL sprintf("INSERT INTO ".PREFIX."listings (owner, title, description, section, price, display, dateadded, expiration, orderID, featured, pBold, pHighlighted, url) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
Comment out the 'Short Description' line:
PHP Code:
GetSQLValueString(htmlspecialchars($data['title']),"text"),
//GetSQLValueString(htmlspecialchars($data['shortDescription']),"text"),
GetSQLValueString(htmlspecialchars($data['description']),"text"), 
THEN find the 'Edit Listing Function' (function editListing($data))

remove 'short description' from the UPDATE SQL string:
PHP Code:
$sSQL=sprintf("UPDATE ".PREFIX."listings SET ".$updateSQL." title=%s,description=%s,featured=%s,price=%s,display=%s,url=%s,pBold=%s,pHighlighted=%s WHERE id=%s AND owner=%s"
Comment out the 'Short Description' line:
PHP Code:
GetSQLValueString(htmlspecialchars($data['title']),"text"),
//GetSQLValueString(htmlspecialchars($data['shortDescription']),"text"),
GetSQLValueString(htmlspecialchars($data['description']),"text"), 
That should do it.
__________________
-Tom

GunListUSA.com
Gun List USA is Better...
No Auctions, Just FREE Ads!!!
tlombard is offline   Reply With Quote
Old 03-02-2010, 12:04 PM   #7
Customer
 
Join Date: Feb 2010
Posts: 25
Rep Power: 4
JWB is on a distinguished road
Default

Thank you Tom! Your help is really aprreciated and so fast!

I will try your suggested edits - hopefully the coming hours - and notify in this thread whether it works...
JWB is offline   Reply With Quote
Old 03-04-2010, 06:13 PM   #8
Customer
 
Join Date: Feb 2010
Posts: 25
Rep Power: 4
JWB is on a distinguished road
Default

What version of 68 Classifieds are you running?
V4.1.9 developper
What template are you using?
Neo blue (neither does it work in the default)


Okay it sounded easy - but it wasn't. I must have done some stupid error or missing some thing completely. I have made some screen shots as I think it might be easier to find the code lines and compare. Here are my edits (before change = orignal file and after):

Before:
edit1-2-before.gif

After:
edit1-2-after.jpg

Before:
edit3-4-before.jpg

After:
edit3-4-after.gif

After:
edit5-removal_of_references.jpg

Last edited by JWB; 03-04-2010 at 06:39 PM.
JWB is offline   Reply With Quote
Old 03-04-2010, 06:18 PM   #9
Customer
 
Join Date: Feb 2010
Posts: 25
Rep Power: 4
JWB is on a distinguished road
Default

After:
edit6-removal_of_references.gif

It gave a lightning fast error message:
error-message.gif

I was allowed to continue but not allowed to add and ad in the end with expiration of ad...

It said:
Quote:
We are sorry but an error occured. Please contact support
JWB is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search by extra field tom11011 Technical Support 12 10-31-2009 04:15 PM
Need a way to search on extra field data Bronxgodzilla Technical Support 0 04-10-2009 07:40 AM
Extra Field search not working right naidu01 Technical Support 7 01-13-2009 02:00 PM


All times are GMT -4. The time now is 10:11 PM.


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