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

<?xml version="1.0"?>
<desc>
  <shortdesc>something</shortdesc>
  <longdesc>something else</longdesc>
</desc>

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 <!-- end shortdesc --> long desc here

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

$desc = explode('<!-- end shortdesc -->', $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.

Enjoy this Article ? Bookmark and Share     Follow Us 
  1. Tee says:

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

  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.

  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?

  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!

  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?

    • 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

  1. There are no trackbacks for this post yet.

Leave a Reply

We care about your Privacy. Copyright © 2009 RubikIntegration. Powered by Zen Cart and Wordpress