Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Oct 2004
    Posts
    1,045
    Plugin Contributions
    0

    Default Is there any fast way to update text alignment for ALL product descriptions???

    I used to have all of my product descriptions centered, but now I'm upgrading, and the product info page has a different layout. I like the new layout better, but it doesn't look good with the centered text. I want to change them to justified, but I have over 500 products and it will take forever! Is there any kind of query I could execute in the database to do this?

    TIA!
    Danielle

  2. #2
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Is there any fast way to update text alignment for ALL product descriptions???

    Danielle

    Are you using version 1.3.0.2 or 1.3.5?

    Do you have an over-ride file for your tpl_product_info_display.php file?

    These questions are because you have a div with inline CSS that isn't usually present that is forcing your text to be centrally aligned. If we can track down the source and replace the inline CSS with a class, then you can control the alignment through your stylesheet.

    (I'm just hoping that the div isn't a part of every one of your database entries - though even then a quick script could strip them all out)
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  3. #3
    Join Date
    Oct 2004
    Posts
    1,045
    Plugin Contributions
    0

    Default Re: Is there any fast way to update text alignment for ALL product descriptions???

    Hi, I am using 1.3.5. I do have an override for that file, but only because I added the cross-sell mod. Unfortunately I've been setting the alignment to centered for each product as I've been adding it

    What you said about a quick script that could strip that out is exactly what I'm looking for! I'm just not sure how to do it
    Danielle

  4. #4
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Is there any fast way to update text alignment for ALL product descriptions???

    I started to think about how to construct a script and realised that there is a much easier way to correct this.

    Step 1: Do a complete backup of your database by your normal method

    Step 2: use phpMyAdmin to export your product_description table only to a file, making sure that you tick the "add drop table" and "add of not exists" boxes

    Step 3: open the resulting file in a text editor and use the editor's search & replace facility to replace all instances of <div style="text-align: center;"> with <div class="description">

    Step 4: re-import the table via phpMyAdmin

    Step 5: add .description {text-align:left} to your stylesheet
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  5. #5
    Join Date
    Oct 2004
    Posts
    1,045
    Plugin Contributions
    0

    Default Re: Is there any fast way to update text alignment for ALL product descriptions???

    GENIUS! You are a genius! It worked beautifully, thank you!

    Danielle

  6. #6
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Is there any fast way to update text alignment for ALL product descriptions???

    I'm glad that worked for you. However this was the quick and dirty fix which still leaves you having to add <div class="description"> and a </div> to the product description for each new product.

    Now that you've gotten the hang of this approach, you might wish to consider stripping these tags out of your database completely as you can easily attach the CSS styling you want for the description to the #productDescription ID that Zen Cart already inserts for you.

    I didn't suggest this originally because of the added complication of also striping out the </div> tags but upon reflection I don't think that would be any more difficult than what you've already done and I should have suggested it before.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  7. #7
    Join Date
    Oct 2004
    Posts
    1,045
    Plugin Contributions
    0

    Default Re: Is there any fast way to update text alignment for ALL product descriptions???

    In new products that I add, wouldn't I just choose the alignment option that I want in the HTML editor?

    If that won't work, what you're basically saying is to go into that same table and remove every instance of <div class="description"> as well as </div>? I'm not sure how well it will work for the </div>, I wonder if that tag is used anywhere else in the product description besides just the alignment?
    Danielle

  8. #8
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Is there any fast way to update text alignment for ALL product descriptions???

    Ahh. That's how this inline styling got into your database. Yes it will work, but each time you hit a function like that in the HTML editor you are inserting unnecessary and difficult to change code into your database for each individual product and re-creating the problem that you started with. It's much better to use the CSS IDs and classes that Zen Cart's php gives you and control the look of your product layouts from a single place in the stylesheet.

    The </div> is the closing tag for the <div class="description"> tag. They operate as a pair and must be there or not together. If you took out the <div class="description"> but left the </div>, the latter would close an earlier FIV with potentially catastrophic consequences.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  9. #9
    Join Date
    Oct 2004
    Posts
    1,045
    Plugin Contributions
    0

    Default Re: Is there any fast way to update text alignment for ALL product descriptions???

    Alrighty, I've stripped all the div tags and justified the products description using the stylesheet. Thanks SO much for all your help

    In case anyone else is trying this, here is what I added to my stylesheet after I'd stripped all the div tags out:

    #productDescription {text-align:justify;}
    Danielle

  10. #10
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Is there any fast way to update text alignment for ALL product descriptions???

    Way to go, Danielle. So glad you bit the bullet and this will not only make it easier to change them again should you wish in future, but also eliminate the risk of forgetting to hit the justify key when entering a product description.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v139h Is there any way to batch all products types to documents?
    By gotyed in forum General Questions
    Replies: 5
    Last Post: 9 Mar 2012, 05:50 PM
  2. Is there any way to clean Sales Maker Specials from old item fast?
    By DazAna in forum Setting Up Specials and SaleMaker
    Replies: 0
    Last Post: 31 May 2011, 07:34 PM
  3. Is there any way to add all my produts at one time
    By randbcen in forum General Questions
    Replies: 2
    Last Post: 26 Mar 2009, 09:56 AM
  4. 3 for $12 is there ANY WAY... HELP
    By MichaelUnderduck in forum General Questions
    Replies: 2
    Last Post: 28 Oct 2006, 09:13 PM
  5. Is there ANY way to fix the zenid problems ONCE AND FOR ALL?
    By ChristinaB in forum General Questions
    Replies: 2
    Last Post: 14 Jul 2006, 09:02 PM

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