close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Products Insert into multiple categories

Thread began 8/19/2015 4:44 pm by Charles | Last modified 11/03/2015 5:21 pm by Ray Borduin | 2116 views | 11 replies |

Charles

Products Insert into multiple categories

Hopefully you could help me with an easy way to do this. I've already built the DB, Product Catalog, dropdown-category menu and Product Admin using DA. With your help, all is working and our admin has already Inserted 150 products and they display well - so far so good. However, in products_insert.php(attached), each entry associates one product with one Category ID. It has now become clear, beyond the original requirements, that the company has the same product in multiple categories and it would save entering the same product multiple times if we could modify products_insert.php to allow entry of one product into products_insert.php and designate multiple Category IDs. Is there a simple modification like entering in the Category ID field multiple IDs maybe pipe delimited, eg 1|2|3 and modifying the code to insert multiple records in the DB or do I need to rebuild this whole thing?
Would appreciate any guidance or suggestions you can give.

Sign in to reply to this post

Ray BorduinWebAssist

Relational database design would have you create a new table called ProductCategories that would have:

ProductCategoryID - Autonumber
ProductID - ProductID of product
CategoryID - CategoryID of product

That way a single product could have any number of product categories.

Then you would delete your CategoryID column from your products table and use this new table to maintain the relationship of products to categories.

The webassist Server Behavior "Manage Relational Table" would then be used to maintain the ProductCategories table from the product update page.

Then you use INNER JOINS to join the tables and display results for a given category. These concepts can be a bit tricky the first few times you do it, so I'd suggest a premier support ticket the first time to save you a lot of effort getting up to speed.

Sign in to reply to this post
Did this help? Tips are appreciated...

Charles

See PM

Sign in to reply to this post

Ray BorduinWebAssist

Once we create the new table and before we delete the column in the products table we can write a query to transfer over the existing categories to the new structure so they won't have to be re-entered.

Sign in to reply to this post
Did this help? Tips are appreciated...

Charles

That's good news. Thanks. Lets schedule a Premier Ticket Support session. See PM.

Sign in to reply to this post

Ray BorduinWebAssist

Sounds good. Please use our online form to fill out a premier support request: http://www.webassist.com/premier_request.php

Sign in to reply to this post
Did this help? Tips are appreciated...

Charles

Just discovered a strange by-product of the work we did together on this ticket. The Admin for the company finally got the time to start entering new products into products_insert.php after we added the multiple categories code to it. When she enter a 'Description' it displays after submission in the 'Color' field; 'Color' entered displays in "Sizes';' Size' entered displays in 'Sold By' etc. It's as if every field has shifted down one when entered vs whats displayed.
See link below and look at the Product called 'Bulk Test' to see how it's incorrectly displayed. Note: the other products displayed on that page display coorectly because they were entered before we made the code change to products_insert.php to accomodate multiple categories. Also, products_update.php does work correctly and entries there do display correctly. I tried comparing code between the two and I ca,t see the bug. Your help would be greatly appreciated. Attached is products_insert, Products_update(works) and a screen grab of the Insert form. Thank you.

Sign in to reply to this post

Ray BorduinWebAssist

It looks like an issue on the insert page... here is an update that should correct the problem.

Attached Files
products_insert.php
Sign in to reply to this post
Did this help? Tips are appreciated...

Charles

That seems to have done the trick. Thanks again.

Sign in to reply to this post

Charles

There still seems to be a glitch in the products_update.php file(attached). If you look at the link below, you see that the 'Sizes' displayed are ' 3/4" to 11/2" thickness'. However, when our Admin goes to edit that product, she sees a truncated entry in the 'Sizes' box: '3/4' (screenshot attached). Problem is that if she is editing some other field and Submits the update, the truncated Sizes data will now appear in the Db and on the public web site. Can't see in the code why it would be doing this. Please have a look. 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...