Results 1 to 8 of 8

Threaded View

  1. #5
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Howto Add class=selected to curent product image in sidebox when on product info

    Try this ...
    (And of course you'll still need to add your .selectedImg selector to your stylesheet.)
    Code:
    <?php
    /**
     * Product Listing Sidebox
     *
     */
    
      $content = '';
      $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
        
        $prolist_query = "select 
    
                products.products_image, products_description.products_name, products_to_categories.*, categories_description.categories_id
                
                from products, products_description, products_to_categories, categories_description
                
                where categories_description.categories_id = '$current_category_id'
                and categories_description.categories_id = products_to_categories.categories_id
                and products_description.products_id = products_to_categories.products_id
                and products.products_id = products_description.products_id
                
                order by products_description.products_name
                ";
        
            $prolist = $db->Execute($prolist_query);
            
         while (!$prolist->EOF) {
           $classHref = ($prolist->fields['products_id'] == $_GET['products_id']) ? ' class="selectedImg"' : '';
           $classImg = ($prolist->fields['products_id'] == $_GET['products_id']) ? ' selectedImg' : '';
           $content .=  '<a' . $classHref . ' href="' . zen_href_link(zen_get_info_page($prolist->fields['products_id']), ($_GET['cPath'] > 0 ? 'cPath=' . $_GET['cPath'] . '&' : '') . 'products_id=' . $prolist->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $prolist->fields['products_image'], $prolist->fields['products_name'],SMALL_IMAGE_WIDTH*1.2, SMALL_IMAGE_HEIGHT*1.2, 'class="listingProductImage' . $classImg . ' "') . '</a>';
           $prolist->MoveNext();
       };
        
      $content .= '</div>';
    Last edited by DrByte; 30 Jun 2013 at 03:20 PM. Reason: fixed typo
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Replies: 3
    Last Post: 15 May 2013, 06:00 PM
  2. Blank page when product selected from sidebox
    By PK_Lisa in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 4 Nov 2011, 04:46 AM
  3. Blank page when product selected from sidebox
    By PK_Lisa in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 3 Nov 2011, 04:26 AM
  4. Change product image when attribute is selected
    By webstar59 in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 24 Aug 2011, 07:39 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