Results 1 to 8 of 8
  1. #1
    Join Date
    May 2009
    Posts
    413
    Plugin Contributions
    0

    Default Adjust Featured Sidebox Layout to Match Bestsellers Sidebox Layout

    Hi,

    Would it be possible to adjust the layout of the featured sidebox to match the layout of the bestsellers sidebox?

    I'd like my featured sidebox to display a simple list of links to featured products, with no images or prices - just like the contents of the bestsellers sidebox, if possible.

    Any help is much appreciated.

    Thanks

  2. #2
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,024
    Plugin Contributions
    3

    Default Re: Adjust Featured Sidebox Layout to Match Bestsellers Sidebox Layout

    You could edit includes/templates/template_default/sideboxes/tpl_featured.php to remove the image and price and save the edited file to your custom template folder. Can't help with adding the numeration (1. 2. etc.)

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Adjust Featured Sidebox Layout to Match Bestsellers Sidebox Layout

    For the numeration, you would need to change the series of divs output to an ordered list.
    PHP Code:
     * @version $Idtpl_featured.php 18698 2011-05-04 14:50:06Z wilt $
     */
      
    $content "";
      
    $content .= '<div class="sideBoxContent centeredContent">';
      
    $featured_box_counter 0;
      while (!
    $random_featured_product->EOF) {
        
    $featured_box_counter++;
        
    $featured_box_price zen_get_products_display_price($random_featured_product->fields['products_id']);
        
    $content .= "\n" '  <div class="sideBoxContentItem">';
        
    $content .=  '<a href="' zen_href_link(zen_get_info_page($random_featured_product->fields["products_id"]), 'cPath=' zen_get_generated_category_path_rev($random_featured_product->fields["master_categories_id"]) . '&products_id=' $random_featured_product->fields["products_id"]) . '">' zen_image(DIR_WS_IMAGES $random_featured_product->fields['products_image'], $random_featured_product->fields['products_name'], SMALL_IMAGE_WIDTHSMALL_IMAGE_HEIGHT);
        
    $content .= '<br />' $random_featured_product->fields['products_name'] . '</a>';
        
    $content .= '<div>' $featured_box_price '</div>';
        
    $content .= '</div>';
        
    $random_featured_product->MoveNextRandom();
      }
      
    $content .= '</div>' "\n"
    PHP Code:
     * @version $Idtpl_featured.php 18698 2011-05-04 14:50:06Z wilt $   change to ordered list - gjh42  2013-04-13
     
    */
      
    $content "";
      
    $content .= '<div class="sideBoxContent centeredContent">';
      
    $content .= '<ol>';
      
    $featured_box_counter 0;
      while (!
    $random_featured_product->EOF) {
        
    $featured_box_counter++;
        
    $featured_box_price zen_get_products_display_price($random_featured_product->fields['products_id']);
        
    $content .= "\n" '  <li class="sideBoxContentItem">';
        
    $content .=  '<a href="' zen_href_link(zen_get_info_page($random_featured_product->fields["products_id"]), 'cPath=' zen_get_generated_category_path_rev($random_featured_product->fields["master_categories_id"]) . '&products_id=' $random_featured_product->fields["products_id"]) . '">' zen_image(DIR_WS_IMAGES $random_featured_product->fields['products_image'], $random_featured_product->fields['products_name'], SMALL_IMAGE_WIDTHSMALL_IMAGE_HEIGHT);
        
    $content .= '<br />' $random_featured_product->fields['products_name'] . '</a>';
        
    $content .= '<div>' $featured_box_price '</div>';
        
    $content .= '</li>';
        
    $random_featured_product->MoveNextRandom();
      }
      
    $content .= '</ol></div>' "\n"
    You can make the items have numbers simply by adding a rule .sideBoxContentItem {display: list-item; list-style-type: decimal;}, but the numbers will all be 0. without the actual <ol> structure.

  4. #4
    Join Date
    May 2009
    Posts
    413
    Plugin Contributions
    0

    Default Re: Adjust Featured Sidebox Layout to Match Bestsellers Sidebox Layout

    Thanks for the suggestions so far guys.

    Quote Originally Posted by stevesh View Post
    You could edit includes/templates/template_default/sideboxes/tpl_featured.php to remove the image and price and save the edited file to your custom template folder. Can't help with adding the numeration (1. 2. etc.)
    ...I'm not able to remove the image and price myself, I don't know my way around PHP enough

    I'm using the default includes/templates/template_default/sideboxes/tpl_featured.php file:

    PHP Code:
    <?php
    /**
     * Side Box Template
     *
     * @package templateSystem
     * @copyright Copyright 2003-2011 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: tpl_featured.php 18698 2011-05-04 14:50:06Z wilt $
     */
      
    $content "";
      
    $content .= '<div class="sideBoxContent centeredContent">';
      
    $featured_box_counter 0;
      while (!
    $random_featured_product->EOF) {
        
    $featured_box_counter++;
        
    $featured_box_price zen_get_products_display_price($random_featured_product->fields['products_id']);
        
    $content .= "\n" '  <div class="sideBoxContentItem">';
        
    $content .=  '<a href="' zen_href_link(zen_get_info_page($random_featured_product->fields["products_id"]), 'cPath=' zen_get_generated_category_path_rev($random_featured_product->fields["master_categories_id"]) . '&products_id=' $random_featured_product->fields["products_id"]) . '">' zen_image(DIR_WS_IMAGES $random_featured_product->fields['products_image'], $random_featured_product->fields['products_name'], SMALL_IMAGE_WIDTHSMALL_IMAGE_HEIGHT);
        
    $content .= '<br />' $random_featured_product->fields['products_name'] . '</a>';
        
    $content .= '<div>' $featured_box_price '</div>';
        
    $content .= '</div>';
        
    $random_featured_product->MoveNextRandom();
      }
      
    $content .= '</div>' "\n";
    Would it be easier copy the contents of the includes/templates/template_default/sideboxes/tpl_best_sellers.php file (below), and edit it to show featured products instead? Then take that edited code and place it in the tpl_featured.php file (I have no idea how easy or hard this would be - apologies if it's a ridiculous idea!)

    PHP Code:
    <?php
    /**
     * Side Box Template
     *
     * @package templateSystem
     * @copyright Copyright 2003-2005 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: tpl_best_sellers.php 2982 2006-02-07 07:56:41Z birdbrain $
     */
      
    $content '';
      
    $content .= '<div id="' str_replace('_''-'$box_id 'Content') . '" class="sideBoxContent">' "\n";
      
    $content .= '<div class="wrapper">' "\n" '<ol>' "\n";
      for (
    $i=1$i<=sizeof($bestsellers_list); $i++) {
        
    $content .= '<li><a href="' zen_href_link(zen_get_info_page($bestsellers_list[$i]['id']), 'products_id=' $bestsellers_list[$i]['id']) . '">' zen_trunc_string($bestsellers_list[$i]['name'], BEST_SELLERS_TRUNCATEBEST_SELLERS_TRUNCATE_MORE) . '</a></li>' "\n";
      }
      
    $content .= '</ol>' "\n";
      
    $content .= '</div>' "\n";
      
    $content .= '</div>';
    ?>
    Thanks

  5. #5
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Adjust Featured Sidebox Layout to Match Bestsellers Sidebox Layout

    Removing the price and image is just a matter of commenting out a few lines:
    PHP Code:
    /*
    ...
     * @version $Id: tpl_featured.php 18698 2011-05-04 14:50:06Z wilt $   change to ordered list, remove price, image - gjh42  2013-04-11
     */
      
    $content "";
      
    $content .= '<div class="sideBoxContent centeredContent">';
      
    $content .= '<ol>';
      
    $featured_box_counter 0;
      while (!
    $random_featured_product->EOF) {
        
    $featured_box_counter++;
        
    //$featured_box_price = zen_get_products_display_price($random_featured_product->fields['products_id']);
        
    $content .= "\n" '  <li class="sideBoxContentItem">';
        
    $content .=  '<a href="' zen_href_link(zen_get_info_page($random_featured_product->fields["products_id"]), 'cPath=' zen_get_generated_category_path_rev($random_featured_product->fields["master_categories_id"]) . '&products_id=' $random_featured_product->fields["products_id"]) . '">' /*. zen_image(DIR_WS_IMAGES . $random_featured_product->fields['products_image'], $random_featured_product->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)*/;
        
    $content .= '<br />' $random_featured_product->fields['products_name'] . '</a>';
        
    //$content .= '<div>' . $featured_box_price . '</div>';
        
    $content .= '</li>';
        
    $random_featured_product->MoveNextRandom();
      }
      
    $content .= '</ol></div>' "\n"

  6. #6
    Join Date
    May 2009
    Posts
    413
    Plugin Contributions
    0

    Default Re: Adjust Featured Sidebox Layout to Match Bestsellers Sidebox Layout

    Hi Glenn,

    Thanks for the response.

    I'm getting "PHP Parse error: syntax error, unexpected ';' \includes\templates\my_template\sideboxes\tpl_featured.php on line 19"

  7. #7
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Adjust Featured Sidebox Layout to Match Bestsellers Sidebox Layout

    That's odd... Line 19 in the edited file should be the long line with the <a href... and I can't find any syntax error in the way I commented out the image code there. Is that line 19 for you? Post what you have so I can compare. Did you copy/paste the code from my post?

    The two $featured_box_counter lines can be deleted, as they are not used for anything here or elsewhere in stock v1.5.1. You can also delete the price div line, and the whole /*. zen_image(... _HEIGHT)*/ commented section, to clean up the working copy of the file.
    Do you still get the error after this?

  8. #8
    Join Date
    May 2009
    Posts
    413
    Plugin Contributions
    0

    Default Re: Adjust Featured Sidebox Layout to Match Bestsellers Sidebox Layout

    Quote Originally Posted by gjh42 View Post
    That's odd... Line 19 in the edited file should be the long line with the <a href... and I can't find any syntax error in the way I commented out the image code there. Is that line 19 for you? Post what you have so I can compare. Did you copy/paste the code from my post?

    The two $featured_box_counter lines can be deleted, as they are not used for anything here or elsewhere in stock v1.5.1. You can also delete the price div line, and the whole /*. zen_image(... _HEIGHT)*/ commented section, to clean up the working copy of the file.
    Do you still get the error after this?
    Hi Glenn,

    Deleting the lines as you suggested, rather than commenting out, seems to of worked. I must of made a mistake when editing the file initially. Everything looks good my end now.

    Thanks for your help

 

 

Similar Threads

  1. v139h Longer Bestsellers sidebox - jScroller Sidebox Package
    By Maynards in forum All Other Contributions/Addons
    Replies: 6
    Last Post: 12 Feb 2012, 07:26 PM
  2. Sidebox Layout Info
    By dw08gm in forum Basic Configuration
    Replies: 2
    Last Post: 1 Apr 2010, 03:34 PM
  3. sidebox layout problem
    By Jerry5763837 in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 24 Mar 2009, 02:44 AM
  4. categories sidebox layout
    By ivanc in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 19 Dec 2008, 06:45 AM
  5. Sidebox / Layout BG colour
    By tom2u in forum Basic Configuration
    Replies: 1
    Last Post: 18 Jul 2007, 04:55 PM

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