Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Jul 2011
    Posts
    21
    Plugin Contributions
    0

    help question Product description template?

    So, I've just installed the "Tabbed Products Pro" mod ( http://www.zen-cart.com/downloads.php?do=file&id=646 ).

    To make things easier, I'm trying to add a product description "template", so when I add a new product, the product description box in the admin area is partially filled with a "template" ( i.e, tables with information in ) which then shows in front end.

    I've already commented out the zen_clean_html in /product_listing.php

    Does anyone know how I can achieve what I am trying to do?

    Regards

    Jake

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

    Default Re: Product description template?

    The product description is stored in the database, so to have a new product automatically populate its description with your template, you would have to write code that would see if the description field for the product being displayed is empty and if so enter the template HTML in the textarea.

    If you are not comfortable doing that, the easiest method would be to store the template code in notepad or somewhere quickly accessible, and paste it into the description of each new product.

  3. #3
    Join Date
    Jul 2011
    Posts
    21
    Plugin Contributions
    0

    Default Re: Product description template?

    Thanks for the reply.

    I realise the easiest option would be just to copy and paste, but that'd be too easy lol

    I don't think the coding is beyond me, so will give it a go.

    The way I understand it;
    "start script"
    Connect to mySQL database
    check description field using "if" command
    if nothing there, "echo"? template code I want
    "end script"

    Now, I know that's very basic, but any idea's if I'm missing anything major? ( PHP isn't my strongest point, but I have a little experience )


  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,877
    Plugin Contributions
    96

    Default Re: Product description template?

    Another possibility ... you can use the built-in Zen Cart "Copy/Duplicate Product" function. Once you've got a product with your "template", when you're going to create a new product you:
    1. Click Catalog->Categories/Products and click through the categories until you are displaying a list of products (one of which is your "template").
    2. Click the dark blue icon with a C in it (Copy to) that is associated with the "template" product
    3. Choose the category in which the new product should be created
    4. Choose "Duplicate Product"
    5. If the "template" has attributes, you probably want to copy them too!
    6. Click the "Copy" button

    You now have a (disabled) new product in the selected category that looks just like your template.

  5. #5
    Join Date
    Jul 2011
    Posts
    21
    Plugin Contributions
    0

    Default Re: Product description template?

    Code:
    <?php
    $con=mysqli_connect(host,username,password,dbname);;
    // Check connection
    if (mysqli_connect_errno())
      {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
      }
    
    $result = mysqli_query($con,"SELECT * FROM zen_products_description")
    WHERE products_description='NULL'");
    
    echo "<table border='0'>
    <tr>
    <th>Origin</th>
    <th>Suitability</th>
    </tr>";
    
    while($row = mysqli_fetch_array($result))
      {
      echo "<tr>";
      echo "<td>" . $row[''] . "</td>";
      echo "<td>" . $row[''] . "</td>";
      echo "</tr>";
      }
    echo "</table>";
    
    mysqli_close($con);
    ?>
    That's what I have so far. Of course the red will be edited with my info.

    Now, I guess the major question is, will that work or am I missing something?

    ( Should create blank "cells" under, "origin" & "Suitability" where I will add that info in the add product page description )

  6. #6
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Re: Product description template?

    Quote Originally Posted by lat9 View Post
    Another possibility ... you can use the built-in Zen Cart "Copy/Duplicate Product" function. Once you've got a product with your "template", when you're going to create a new product you:
    1. Click Catalog->Categories/Products and click through the categories until you are displaying a list of products (one of which is your "template").
    2. Click the dark blue icon with a C in it (Copy to) that is associated with the "template" product
    3. Choose the category in which the new product should be created
    4. Choose "Duplicate Product"
    5. If the "template" has attributes, you probably want to copy them too!
    6. Click the "Copy" button

    You now have a (disabled) new product in the selected category that looks just like your template.
    THIS was going to be my suggestion and it's EXACTLY how my clients have created products "templates"
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

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

    Default Re: Product description template?

    It has been so long since I did it that I forgot, but I did exactly that too, in making product listings for medieval coin reproductions. All of the info wants to be in the same format, and the template makes it easy and quick.

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

    Default Re: Product description template?

    If you did want to code it in, there is no need to query the database independently. The product description is among the info retrieved from the db in building the page, and you can just test the value of the appropriate retrieved field and proceed from there. It may be as simple as updating that object/array element with your template code if it is blank, before letting the page proceed to display.

 

 

Similar Threads

  1. Replies: 3
    Last Post: 10 Aug 2011, 06:21 AM
  2. Lite Red 1.1 Template not showind product description
    By bargaindropper in forum Addon Templates
    Replies: 3
    Last Post: 30 May 2010, 09:58 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