Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Aug 2004
    Location
    New York City
    Posts
    7,174
    Plugin Contributions
    0

    Default subcategory description

    Once again, I'm experimenting with Zen Cart as CMS. I want to set up subcategories so that the subcategory description is an extract or blurb from a document (which will be the only "product" in the subcategory). Is that possible?

    Here's what I'm trying to accomplish:

    Category = author1 name
    subcategory 1 = story 1 title
    subcategory 1 description = this is a story about blah blah blah
    only product in subcategory 1 is story 1

    When someone selects author1, I'd like them to see
    Story 1 title
    this is a story about blah blah blah
    Mary Ellen
    I came; I saw; I Zenned
    Taking over the world... one website at a time
    Make sure brain is engaged before putting mouth in gear... or fingers to keyboard.

    Holzheimer
    Fan Odyssey

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: subcategory description

    The module category_row.php displays the categories_name and categories_image ...

    Two functions exist in the functions_lookups.php that you can use:
    PHP Code:
    /*
     * Find category name from ID, in indicated language
     */
      
    function zen_get_category_name($category_id$fn_language_id) { 
    and then a more generic one:
    PHP Code:
      function zen_categories_lookup($categories_id$what_field 'categories_name'$language '') { 
    These can grab the categories_description for you ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Aug 2004
    Location
    New York City
    Posts
    7,174
    Plugin Contributions
    0

    Default Re: subcategory description

    Very cool! When I get some time, I'll have to tinker with it.
    Mary Ellen
    I came; I saw; I Zenned
    Taking over the world... one website at a time
    Make sure brain is engaged before putting mouth in gear... or fingers to keyboard.

    Holzheimer
    Fan Odyssey

  4. #4
    Join Date
    Aug 2004
    Location
    New York City
    Posts
    7,174
    Plugin Contributions
    0

    Default Re: subcategory description

    Quote Originally Posted by Ajeh View Post
    The module category_row.php displays the categories_name and categories_image ...

    Two functions exist in the functions_lookups.php that you can use:
    PHP Code:
    /*
     * Find category name from ID, in indicated language
     */
      
    function zen_get_category_name($category_id$fn_language_id) { 
    and then a more generic one:
    PHP Code:
      function zen_categories_lookup($categories_id$what_field 'categories_name'$language '') { 
    These can grab the categories_description for you ...
    So I would have to mod both files to get the results I want. My php is shaky, but I think I can get this figured out. I'm going to see what I can do.
    Mary Ellen
    I came; I saw; I Zenned
    Taking over the world... one website at a time
    Make sure brain is engaged before putting mouth in gear... or fingers to keyboard.

    Holzheimer
    Fan Odyssey

  5. #5
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: subcategory description

    No, you just need to grab the categories_description to add to the categories_row.php ...

    You can use either function to get the data ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  6. #6
    Join Date
    Aug 2004
    Location
    New York City
    Posts
    7,174
    Plugin Contributions
    0

    Default Re: subcategory description

    I realized that after I posted. I shouldn't try to think that hard that late at night.
    Mary Ellen
    I came; I saw; I Zenned
    Taking over the world... one website at a time
    Make sure brain is engaged before putting mouth in gear... or fingers to keyboard.

    Holzheimer
    Fan Odyssey

  7. #7
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: subcategory description

    I try not thinking too hard at all ... it hurts the brain ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  8. #8
    Join Date
    Aug 2004
    Location
    New York City
    Posts
    7,174
    Plugin Contributions
    0

    Default Re: subcategory description

    I've been looking at this and I'm confused. I suppose it's because I don't use php enough.

    I had changed category_row.php to remove the display of the image because there are no product images, but what is the part in red doing?

    Code:
        $list_box_contents[$row][$col] = array('params' => 'class="categoryListBoxContents"' . ' ' . 'style="width:' . $col_width . '%;"',
    //                                           'text' => '<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . zen_image(DIR_WS_IMAGES . $categories->fields['categories_image'], $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br />' . $categories->fields['categories_name'] . '</a>' . '<br />' . $categories->fields['categories_description']
                                               'text' => '<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $categories->fields['categories_name'] . '</a>' . '<br />' . $categories->fields['categories_description']
    I know this is going to get tricky since I only want the subcategory descriptions to display, but I think I can write the correct IF statement for that.
    Mary Ellen
    I came; I saw; I Zenned
    Taking over the world... one website at a time
    Make sure brain is engaged before putting mouth in gear... or fingers to keyboard.

    Holzheimer
    Fan Odyssey

  9. #9
    Join Date
    Aug 2004
    Location
    New York City
    Posts
    7,174
    Plugin Contributions
    0

    Default Re: subcategory description

    It looks like I added that line in red.

    I think I see what I need to do now...
    Mary Ellen
    I came; I saw; I Zenned
    Taking over the world... one website at a time
    Make sure brain is engaged before putting mouth in gear... or fingers to keyboard.

    Holzheimer
    Fan Odyssey

  10. #10
    Join Date
    Aug 2004
    Location
    New York City
    Posts
    7,174
    Plugin Contributions
    0

    Default Re: subcategory description



    Got it!

    functions_lookups.php has a function for the category description. All I had to do was add the line in blue to take advantage of the existing function, so that my original addition to the code actually had something to display (see red code). The '1' is the language code since the site is only in one language.

    Code:
     $categories->fields['categories_description'] = zen_get_category_description($categories->fields['categories_id'], '1');   
        $list_box_contents[$row][$col] = array('params' => 'class="categoryListBoxContents"' . ' ' . 'style="width:' . $col_width . '%;"',
    //                                           'text' => '<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . zen_image(DIR_WS_IMAGES . $categories->fields['categories_image'], $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br />' . $categories->fields['categories_name'] . '</a>' . '<br />' . $categories->fields['categories_description']
                                               'text' => '<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $categories->fields['categories_name'] . '</a>' . '<br />' . $categories->fields['categories_description']
    Mary Ellen
    I came; I saw; I Zenned
    Taking over the world... one website at a time
    Make sure brain is engaged before putting mouth in gear... or fingers to keyboard.

    Holzheimer
    Fan Odyssey

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v151 Display Subcategory Description - depth issue
    By simon1066 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 8 Nov 2013, 09:32 AM
  2. subcategory pictures on product description
    By bmpt in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 1 May 2009, 07:41 PM
  3. display subcategory description
    By afo in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 30 Jul 2008, 07:07 PM
  4. A way to have a subcategory description pop-up?
    By magneteye in forum General Questions
    Replies: 2
    Last Post: 29 Apr 2008, 05:21 PM
  5. subcategory description layout - stuck in code
    By LittleR in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 31 Oct 2007, 03:01 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