Short Description for Zencart products – A simpler alternative

ONCE upon a time not so long ago, one partner wanted to display a “short description” for the product, which is totally different from the description used in the product page. There are several good reasons for that:

  1. By default Zencart can help you to display the first X characters, however this cannot help you to give the customers a good summary of the product (good for customers)
  2. Using a customized short description can let you craft your own keyword-rich description on the listing page (good for seo, if you don’t overdo it)


So I took a look around and notice there is one module that can do it:

http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=271

This approach has 2 major drawbacks, however

  1. It is more complicated than it should be
  2. It is not included in search (unless you edit the search code)

So we came up with another method which is way easier than that: what if we put both the short description AND the normal description in one field, and later we split them when we display on the front end? Now there is no need for additional field and no need to edit search code.

Obviously there are multiple options for you to choose, if you want a complete solution you can use xml for example, so you can put this into your description

version="1.0"?>
>

  >something>
  >something else>
>

Then you will have to parse this xml string before you display on the front end of course.

Alternatively, you can choose to use json, etc… However, if you want to keep it as simple as possible and you don’t have many additional field anyway (just the short description for example), the perhaps this is the easiest:

You can put this in your desc:

short desc bla blah long desc here

Then on your front end, you just have to “explode” the $products_description like this:

$desc = explode('', $products_description);
// now $desc[0] will contain the short description; $desc[1] will contain the short description

Hopefully this tip will help you

No related posts.

9 Responses to “Short Description for Zencart products – A simpler alternative”

  1. Tee says:

    Hello, for the XML method. How do I “parse this xml string” to display it? Any reference? Thank you.

    Reply
  2. Tee says:

    Thanks for the info. I will try to read the reference. As I do not know php and xml, maybe need a long time to find out what I want.

    Reply
  3. Tee says:

    Hello, thanks a lot, now I am able to create a short description by using xml. If in my long description, there are pictures to show, how do i achieve this?

    Reply
    • admin says:

      You will just simply use the image tag like normal, but please take a look at this first:
      http://www.w3schools.com/XML/xml_cdata.asp

      Since you will use html tags inside your xml node, you need to use cdata

      Reply
  4. Tee says:

    Hi, thanks for all the help. I will use the easiest method first by “explode” the description, later then figure out how to use the xml method. Thanks a lot!

    Reply
  5. Diane says:

    I am trying to apply this short description functionality to my product description. I have long product descriptions and I’m looking at either adding a “more info”feature or what you have suggested above. However, I am new to .php and zen cart and I am not sure where to ““explode” the $products_description like this”. Which file in my zen cart would I have to edit to make this work?

    Reply
    • admin says:

      If you are new to it, perhaps editing the php files is something you should avoid, but anyhow the file you should edit is tpl_product_info_default.php

      Reply
  6. sparrowce says:

    I’m not finding the ‘tpl_product_info_default.php’ file, am finding similar ones, such as ‘tpl_products_all_default.php’ (using Bookshelf template) and would like to modify file and implement this method, as am getting errors in the short description module, and fixing one error seems to break something else so am very hesitant to keep making changes. Could anyone please supply the complete path for the file we are to edit for the json method to work. Thank you very much.

    Reply

Leave a Reply