Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2009
    Posts
    37
    Plugin Contributions
    0

    Default Making the categories div clickable

    I am trying to make the category links in the center of the page to be wrapped around the categoryListBoxContents div.

    The files that I am editing are:
    templates/[my template]/templates/tpl_columnar_display.php
    /modules/[my template]/category_row.php

    in category_row.php line 32:
    Code:
        $cPath_new = zen_get_path($categories->fields['categories_id']);
    
        // strip out 0_ from top level cats
        $cPath_new = str_replace('=0_', '=', $cPath_new);
    
        //    $categories->fields['products_name'] = zen_get_products_name($categories->fields['products_id']);
    
        $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>');
    in tpl_columnar_display.php line 30:
    Code:
        for($col=0;$col<sizeof($list_box_contents[$row]);$col++) {
          $r_params = "";
          if (isset($list_box_contents[$row][$col]['params'])) $r_params .= ' ' . (string)$list_box_contents[$row][$col]['params'];
         if (isset($list_box_contents[$row][$col]['text'])) {
    ?>
        <?php echo '<div' . $r_params . '>' . $list_box_contents[$row][$col]['text'] .  '</div>' . "\n"; ?>
    I would appreciate any help in making this work, what I tried to do messed up the links and in the home page all the categories pointed to one category...

    Thanks in advance!
    Eran

  2. #2
    Join Date
    Jan 2009
    Posts
    37
    Plugin Contributions
    0

    Default Re: Making the categories div clickable

    Any idea anyone???

  3. #3
    Join Date
    Jun 2014
    Posts
    9
    Plugin Contributions
    0

    Default Re: Making the categories div clickable

    Hi there,

    here is a way to do that:

    in category_row.php line 39
    Code:
    $list_box_contents[$row][$col] = array('params' => 'class="categoryListBoxContents"' . ' ' . 'style="width:' . $col_width . '%;"',
    change it to

    Code:
    $list_box_contents[$row][$col] = array('params' => 'class="categoryListBoxContents"' . 'onclick=location.href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '" ' . 'style="width:' . $col_width . '%;cursor: pointer"',
    thats it! :)

    not the most pretty solution but it works. The "onclick=location.href=" gives the link to the <div> and the "cursor: pointer" changes the mousecursor to a hand if you hover over the <div>

  4. #4
    Join Date
    Jan 2009
    Posts
    37
    Plugin Contributions
    0

    Default Re: Making the categories div clickable

    I can't believe that I saw this just now!
    I guess that I must check that I follow the thread to make sure that I receive the email notifications once replies are posted.

    Nice solution. Didn't find yet a solution to do the same for the product links on product_listing pages.

 

 

Similar Threads

  1. Making entire productListing div clickable
    By pricediscrimination in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 3 Mar 2015, 04:44 PM
  2. Adding extra Div on Categories page
    By lightup in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 27 Nov 2010, 07:01 PM
  3. making the images bigger in categories
    By itsDVDtime in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 10 Nov 2010, 04:40 AM
  4. Making the header clickable
    By Elverdugo0 in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 26 Jun 2009, 09:08 AM

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