Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Multiple Descriptions

    I'm in need of a method so that I can write multiple descriptions for each product, and have them placed in various areas throughout the shopping cart.

    For example, on the page where all products are listed, I would like a small one-line description to show (of certain content - custom-written. not a truncated version of the regular one.)

    Then, when you click on the product to view the details, I would like to have specifics on the item shown (size, weight, type, etc.) in a list. This would be the second description area. The third description area would be a custom-written, more detailed version of the first (shown on the products listing page).

    It would be *great* If I could have the three fields set up in the admin area, under the products section, so I could just enter the necessary text in each field, and then write the code in the products templates as I need them called in.

    I can't find an already-created contribution for this, and I don't even know if one is needed. Is there a way to do this - have 3 description fields instead of one? I also use EasyPopulate, so I'd like to be able to export the fields, as well.

    If there *isn't* a ready-made way to do this, and there's no contribution done, then I'm willing to give it a shot myself. I would imagine it would require me to create two more tables in then ZenCart database, and then call in the data in the templates - both in the admin section as well as where I want them to appear in my template files.

    The problem is, I'm not sure *where* I would need to add them in my template files. My line of thought is that I could copy the current description table in the database and rename them, so I have three. But I wasn't sure what admin files I'd need to edit to get them to connect. I also wasn't sure if, just by doing this one thing, that it would populate as it should throughout (meaning, it'll work like any other field, or will I have to go into tons of scripting to make it work sitewide)

    If anyone has any suggestions/corrections for me, I'd appreciate it.

    And if it *does* work, I'd love to submit it as a contribution.

  2. #2
    Join Date
    Jun 2005
    Location
    Cheney WA
    Posts
    1,134
    Plugin Contributions
    0

    Default Re: Multiple Descriptions

    Ok, I have to try and clear a couple of things up here.

    You want to change the layout by adding fields.

    Would just using paragraphs, seperated with white space and a divider line not do the same thing without adding fields? Or do you want this on seperate pages?

    Why so much duplication? It seems confusing to me, and I think the search engines will consider all the dupliction as keyword spamming, but hopefully someone else will pipe in about that.

    Can you layout an expample in a html editor?

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Multiple Descriptions

    You can achieve this using HTML class tags in your description, and stylesheet declarations that allow different parts to display in different locations.

    First you need to allow HTML to function on the product listing page. Edit /includes/modules/your_template/product_listing.php to comment out zen_clean_html in two places around lines 98 & 100, as explained in this thread. From what you are describing, I think you would also need to do a similar thing in products_all_listing.php (not sure of the filename) to allow HTML on the all products page.

    Write all of your descriptions in the product editing textbox, and tag the all text with <span class="allOnlyDesc"> text text text </span>.
    Then tag the listing text with <span class="listingOnlyDesc"> text text text </span>, and the info text with <span class="infoOnlyDesc"> text text text </span>.

    Now add the following to your stylesheet:
    Code:
    #allProductsDefault .listingOnlyDesc {
        display: none;
        }
    #allProductsDefault .infoOnlyDesc {
        display: none;
        }
    #indexProductList .allOnlyDesc {
        display: none;
        }
    #indexProductList .infoOnlyDesc {
        display: none;
        }
    #productGeneral .listingOnlyDesc {
        display: none;
        }
    #productGeneral .allOnlyDesc {
        display: none;
        }
    This will suppress the other sections in each area and allow only the desired text to display.

    I haven't tested this exact configuration, so some names may need to be changed to function properly. The general principle is tested and proven to work.

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Multiple Descriptions

    It is probably also necessary to set the product listing description to allow a larger number of characters than you are ever likely to use (Configuration > Product Listing), so HTML tags don't get truncated. That would be bad. I set mine to 2000.

    The all products listing doesn't currently have a switch for this. There was a recent discussion about it, and Ajeh provided instructions for setting the length desired, and said a switch would be available in the next version.

  5. #5
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Re: Multiple Descriptions

    Actually, no, I've done it using the stylesheet before, It requires a lot of absolute positioning and it's a headache to edit in different browsers ::coughIEcough::

    And no, it's not *duplicate* content - it's *different* content.

    Basically, the problem is like so (and I'll set it out as best I can here) - I've done it this way before, and as I said, it's a total headache to do.

    We want 3 *different* descriptions for each product. The products listing page would have a tiny, short description:

    [image here]
    Title of Product
    snippet of "cute" description

    Then on the product detail page:

    Title here
    [image here]
    Specific details, such as weight of product, sizes available, color, etc.
    products price
    add to cart box
    more descriptive and "flourishy" description here

    Now, I *know* I could use CSS and HTML to lay it out something like so in the "description" area of the products:

    <p class="specifics">
    Specific details, such as weight of product, sizes available, color, etc.
    </p>

    <p class="descriptive">
    more descriptive and "flourishy" description here
    </p>

    And then use CSS to set margins and positioning so that the classes are separated with the price and quantity in the middle of the two sections. but I don't want to do that. Like I said, I've done it before, and successfully - but it's a lot of extra work that's really not necessary. This also seems to be something my clients want *a lot* - I haven't had one yet who didn't want a setup similar to this, so using the CSS trick is just way too time-consuming. (Yes, I've also done hiding, display:none, and stuff like that for other variations on the same theme)

    If I had 3 (or more/less, but this site needs 3 - the last site I did could have just used 2) different fields for descriptive text, then I could place them quite easily, as needed, without any need to use absolute positioning and fudging with margins, floats and the like. It would be *much* quicker if I had this ability to add (or not to add) extra descriptive text to the product, and just call it in as I need it.

    Again, this isn't spammy. It's text that describes the product an a couple of different ways. I could do this exact thing on a static site, and it wouldn't be considered "spammy" content. It's just a method of making the content text flow a little differently, and allowing it to be broken up. That's all.

    So if there's a better way than hacking to get a couple of extra description fields, that would be great to know :)

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Multiple Descriptions

    Ok, I didn't get from your OP exactly what it was that you wanted. The two sections of description on the product info page separated by other stuff would be best done with two different fields. The capsule description on the listing page could easily be handled by the method above. And you didn't actually want the all products page at all.

  7. #7
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Re: Multiple Descriptions

    Right - I agree that the "capsule description" (on the product listing page) could be handled by the "display:none;" method - that's definitely doable. But I still need the separation on the product detail page - which (like you said ;) ) would be great if I could have the additional field.

    I've actually been playing with this, and I've gotten a bit of it to work - I can get the fields to show up in the admin panel, but I'm having an issue getting the information intered into the new form fields to pass to the new database fields I made for them.

    Basically, I went into my database and went into the "zen_products_description" table. I added two new fields, and set them up exactly like the original "products_description" field (products_description2 and products_description3). I've gotten the fields - like I said - to show up in the admin panel, no problem. But I'm having an issue getting any input placed in the two new form fields to pass to the database fields. I'm working on admin/functions/general.php, and trying to get this section to get coded properly to do 3 fields at once:

    Code:
      function zen_get_products_description($product_id, $language_id) {
        global $db;
        $product = $db->Execute("select products_description 
                                 from " . TABLE_PRODUCTS_DESCRIPTION . "
                                 where products_id = '" . (int)$product_id . "'
                                 and language_id = '" . (int)$language_id . "'");
    
        return $product->fields['products_description'];
    
    }
    This is on a localhost server, by the way, and I'm just "playing" - so if I screw anything up majorly, it won't be a big deal ;) I'm not that great at MySQL stuff, so what I've tried is all "trial and error" - but if there's any clue how to get the 3 form fields to pass the information to the proper database fields, that would rock. I htink I could figure out the rest from there - I just need to get the info into the database.

  8. #8
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Re: Multiple Descriptions

    Just wanted to update - I did it! (Call me a nerd, but I'm so proud of myself!) I found this tutorial and used it as a base for what I was doing. So I was thinking correctly, but I was taking it a little too far. (By the way, the above code was correct - but it's what *gets* the value from the new database field - not *posts* it - my bad!)

    Anyway, I'm so excited about this thing that I plan on working out the kinks and posting it on my site. I may be able to make a contribution out of it, but I don't think I'm that good. But thanks for the assistance, all :)

  9. #9
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Multiple Descriptions

    Glad you made this work. If you can package it into a contribution, I'm sure a lot of people would thank you. Someone else just asked today about doing this.

    For those who don't want to get into building new database tables and files, there is a way to use the CSS method above for separate description blocks on one page without the hassle of trying to use absolute positioning on dynamic elements.

    Enter all the different parts you want to display, with <span id=productDescList>text text text</span><span id=productDesc1>text text text</span><span id=productDesc2>text text text</span> tags around each section.
    Put the short description for listing pages in productDescList, and blocks for the info page in 1, 2, etc.

    Copy the product description block in tpl_product_info_display to all the locations where you want to display a section of text, and give each block (including the original) a separate id.
    PHP Code:
     <!--bof Product description -->
    <?php if ($products_description != '') { ?>
    <div id="productDescription1" class="biggerText productGeneral"><?php echo stripslashes($products_description); ?></div>
    <?php ?>
    <!--eof Product description -->
    <br class="clearBoth" />
    Give any desired styling to each description block.
    In your stylesheet, find #productDescription and change it to #productDescription1. Below that declaration, add

    #productDescription2 {your desired styling} etc.

    Next, turn off all display of productDesc1 and productDesc2 etc., and #productDescList in the product info page, and turn them on again selectively.

    Code:
    #productGeneral #productDescList, #productDesc1, #productDesc2 { display: none }
    
    #productDescription1 #productDesc1 { display: block; } //or inline;
    
    #productDescription2 #productDesc2 { display: block; }
    The desired parts of the description will display in their respective locations.


    Disclaimer: I haven't tested this implementation yet, so if anything doesn't work as expected, ask and we'll sort it out.

  10. #10
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Multiple Descriptions

    PS - Remember, you will also need to enable HTML in product listing pages (& all, featured & new pages) as mentioned in posts #3 & 4 above.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Multiple descriptions for one product
    By rapro in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 8 May 2010, 06:48 AM
  2. Replies: 1
    Last Post: 20 Feb 2009, 11:44 PM
  3. Can a product have multiple descriptions and prices
    By nuroweb in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 4 Mar 2008, 06:04 PM
  4. Multiple Image Title/Descriptions
    By monkeyjr47906 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 20 Dec 2007, 08:03 PM
  5. Editing Product descriptions on multiple items
    By 5869 in forum General Questions
    Replies: 0
    Last Post: 1 Nov 2007, 07:00 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