Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2004
    Location
    Newport, Wales
    Posts
    283
    Plugin Contributions
    0

    Default How to use a append query to update all product descriptions?

    Hi
    I would like to add a couple of lines of code to the beginning of every product description on my website celtmyth.co.uk and figured the easiest way after quick updates would be to use an append query but everything I have done has failed so far. (I use the Trial & Error query technique )


    I tried
    UPDATE `zen_products_description`(products_description, <h4>Special gifts for special occasions</h4> <h1>the details</h1>)

    as well as

    INSERT INTO `zen_products_description`(`products_description`) VALUES ([<h4>Special gifts for special occasions</h4> <h1>the details</h1>])

    Neither worked so any help would be appreciated.

    Cheers
    Brinley

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,403
    Plugin Contributions
    87

    Default Re: How to use a append query to update all product descriptions

    How about a different solution to the problem?

    Rather than adding that text to all products' descriptions, why not just update your (presumed, since you're using a URL rewriter) template's tpl_product_info_display.php file to include that common-to-all-products lead-in?

  3. #3
    Join Date
    Aug 2004
    Location
    Newport, Wales
    Posts
    283
    Plugin Contributions
    0

    Default Re: How to use a append query to update all product descriptions

    Hi lat9

    Rather a good idea - and I may eventually take that route if I cant get the query option to work.

    But the query is my preference purely because I would now like to see if I can get it to work

    Cheers
    Brinley

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,403
    Plugin Contributions
    87

    Default Re: How to use a append query to update all product descriptions

    Quote Originally Posted by welshop.com View Post
    Hi lat9

    Rather a good idea - and I may eventually take that route if I cant get the query option to work.

    But the query is my preference purely because I would now like to see if I can get it to work

    Cheers
    Brinley
    OK, Brinley, based on this stackoverflow posting, you'd enter the following into your admin's Tools->Install SQL Patches (after backing up your database!):
    Code:
    UPDATE products_description SET products_description=CONCAT('<h4>Special gifts for special occasions</h4> <h1>the details</h1>',products_description);
    That will prepend the HTML you identified into each product's description.

  5. #5
    Join Date
    Aug 2004
    Location
    Newport, Wales
    Posts
    283
    Plugin Contributions
    0

    Default Re: How to use a append query to update all product descriptions

    Hi lat9

    Thanks for the help - I did read quite a few threads on Stackoverflow and did see one on using CONCAT but didn't really understand it so i used append instead.

    Will try it out later.

    Thanks once again.

    Cheers
    Brinley

  6. #6
    Join Date
    Jul 2012
    Posts
    16,719
    Plugin Contributions
    17

    Default Re: How to use a append query to update all product descriptions

    Quote Originally Posted by welshop.com View Post
    Hi lat9

    Thanks for the help - I did read quite a few threads on Stackoverflow and did see one on using CONCAT but didn't really understand it so i used append instead.

    Will try it out later.

    Thanks once again.

    Cheers
    Brinley
    Not entirely sure if there is still a quest to find a way to append data to an existing field by any means other than the use of CONCAT (in applications such as Microsoft Excel or Open Office this would be CONCATENATE) or not. I've done some searching and it makes me think that the concept of an append query is/was being misunderstood. In other applications (the "popular" one on the Internet is Microsoft Access) an append query adds the records (rows) of data from one table to another. This is not the same as addding the field of one table (even if the table being temporary or permanent had only one record which was the data to be merged to the existing table) to the field of another.

    Maybe once the above is attempted the success of its use can be identified.

    Further, understanding the "need" to solve the problem to which the above solution was provided, be sure to consider the bigger picture like, now that this has been done with existing data, what is going to be done in the future to ensure that the exact same data will be prepended in the future? Why is the exact same data referenced? Well, consider further down the line when it is desired to change that statement? The only "convenient" way is to run another sql/search and modify the data one-for-one...

    From a database container perspective, now every record contains the same data. This is instead of a single record of some type (suggested was a non-database style reference) that takes up less storage space or as suggested no database storage space at all.

    There's nothing technically wrong about the approach, but remember that with every change or desired action, there is or will be maintenance involved. May not seem so now, but obviously there was something not liked about how it was, likely to be a similar dissatisfaction in the future.

    Nothing wrong with trying to get to the bottom of an issue and trying to get one's questions answered. :)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Aug 2004
    Location
    Newport, Wales
    Posts
    283
    Plugin Contributions
    0

    Default Re: How to use a append query to update all product descriptions

    I have just run the query and can confirm it works perfectly - thx lat9 ur a star!

    mc12345678 I understand the drawbacks you highlight but given that he length of the appended string is really small I don't think its an issue. I did look at creating a single addition to the product info page but decided I felt more comfortable with trying the query route.
    As for the need make changes in the future - luckily I already know how to run a replace query

    Thanks again for the input both- much appreciated.

    Cheers
    Brinley

  8. #8
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,403
    Plugin Contributions
    87

    Default Re: How to use a append query to update all product descriptions

    Happy to have helped, Brinley.

 

 

Similar Threads

  1. v151 Order Status Update / Append Comments & Noitify Customer
    By Brent in forum Managing Customers and Orders
    Replies: 4
    Last Post: 16 Oct 2013, 07:57 PM
  2. v151 How can I remove all these tables from my product descriptions?
    By DannyVarley in forum General Questions
    Replies: 2
    Last Post: 12 Jul 2013, 02:38 PM
  3. How do I update all products to 'Product Priced by Attributes'
    By kcb410 in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 4 Aug 2009, 04:45 PM
  4. Replies: 2
    Last Post: 8 Jan 2009, 01:00 PM
  5. Replies: 10
    Last Post: 26 Oct 2006, 11:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR