close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Trying to add a Category Description Field to products_results page

Thread began 11/25/2015 12:47 pm by Charles | Last modified 12/07/2015 5:50 pm by Ray Borduin | 1083 views | 12 replies |

Charles

Trying to add a Category Description Field to products_results page

My company wants to add a field to the products_results page(attached) that shows a Category Description above the listed products results. So I added a Category_Description field to the 'category' table in the DB, entered some text in that field, and added that field to the SQL Select statement on the products_results page line 98 and then mimicked the code that properly renders the Category Name at the top of the products_results page line 336 but with it calling the Category_Description field - line 341. You can see the result at the test page
http://outofchaos.net/gsc/www/products_results11-24.php?Category_ID=6&Search=1
They want the Category_Description where you see 'Description goes here' on the test page above but it's not pulling the Category_Description field data. What would you suggest? Thank you.

Attached Files
products_results11-24.php
Sign in to reply to this post

Ray BorduinWebAssist

You are using this when displaying your category description:

<?php echo((strpos($WADbSearch1->whereClause,"Category_Description"))?$row_WADAproducts['Category_Description']:"Descrption goes here"); ?>

I think you want:
<?php echo((strpos($WADbSearch1->whereClause,"Category"))?$row_WADAproducts['Category_Description']:"Descrption goes here"); ?>

Sign in to reply to this post

Charles

That worked to display the Category_Description text. Lesson for me in avoiding ambiguous table v field names. The only tweak left is that the text pushed out the Container way off to the right - see link below. Can you suggest where in the /style css on the page that we can contain the width, wrapping the text, to align with the right edge of the nav bars like the 2nd link below. Updated product_results.php attached. Thank you.

Sign in to reply to this post

mrsam5266

http://outofchaos.net/gsc/www/webassist/forms/fd_compact_default.css line 322 you have:

white-space: nowrap;

You probably want:
white-space: normal;

Sign in to reply to this post

Charles

That did it! Thanks for the assist. Have a great holiday.

Sign in to reply to this post

Charles

With your help, I successfully added the Category_Description field which you can see displayed at the link below. Now I am trying to to change the category_update.php in the Admin so the company can manage/add/edit the Category_Desreption. Attached is a copy of category_update.php for which I have 2 issues I hope you can help me with:
1> I added code to the Select statement and other places on the page for category_update and the screen displayed(attached) looks right except I need to make the Form Box that displays the text larger => 1024 characters so the Admin can really see it or most of it.
2> When I make an edit and click the Update button, I get the following error: "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE `Category_ID`='6'' at line 1" - I'm having trouble seeing the problem.
Your help would be much appreciated.

Sign in to reply to this post

Ray BorduinWebAssist

1) use a <textarea> instead of an <input type="text"> field and you can make it much larger and allow scrolling.
2) Try updating lines 85 and 86 to:

$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''";
$WA_comparisonStr = " LIKE | LIKE | LIKE | LIKE | LIKE | LIKE ";
Sign in to reply to this post

Charles

OK - so for
1> On, Category_update2.php, I changed line 208's 'input' from 'type="text" to "textarea' but I'm not sure this is the right place for that change as it did not enlarge the small Category_Description text box displayed
<input id="Category_Description" name="Category_Description" type="textarea" value="<?php echo((isset($_GET["invalid"])?ValidatedField("categoryupdate","Category_Description"):"".$row_WADAcategory["Category_Description"]."")); ?>" class="formTextfield_Medium" tabindex="5" title="Please enter a value.">

2> On, Category_update2.php(updated file attached), I changed 85 and 86 as you suggested adding a missing '|' on 85, When you click 'Update' now, it completes the operation but just removes or blanks out the text that you entered in the Category_Description field from the DB so that a blank now appears in that field in the DB and products_results page.
What would you suggest? Thank you

Attached Files
category_update2.php
Sign in to reply to this post

Ray BorduinWebAssist

1) You should have updated the field to:

<textarea id="Category_Description" name="Category_Description" tabindex="5" title="Please enter a value." ><?php echo((isset($_GET["invalid"])?ValidatedField("categoryupdate","Category_Description"):"".$row_WADAcategory["Category_Description"]."")); ?></textarea >



2) Line 84 also has an issue... it should be:

$WA_fieldValuesStr = "".((isset($_POST["Category"]))?$_POST["Category"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["Category_Code"]))?$_POST["Category_Code"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["Schofield_Stone"]))?$_POST["Schofield_Stone"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["Stone_Center"]))?$_POST["Stone_Center"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["3North"]))?$_POST["3North"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["Category_Description"]))?$_POST["Category_Description"]:"")  ."";
Sign in to reply to this post

Charles

Thanks for your patience. That worked. I was able to successfully modify the category_insert page as well with the code you suggested. Thank you!

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...