Page 33 of 33 FirstFirst ... 23313233
Results 321 to 327 of 327
  1. #321
    Join Date
    Sep 2012
    Location
    West Jefferson, NC
    Posts
    382
    Plugin Contributions
    0

    Default Re: Using one single listing template

    Thanks for the warning and info.

  2. #322
    Join Date
    Jan 2015
    Location
    United Kingdom
    Posts
    30
    Plugin Contributions
    0

    Default Re: Using one single listing template

    Hi, I know this thread is quite old but I thought I would try my luck anyway and hope that somebody out there would be generous enough to offer a helping hand with a little problem I am having.

    I have installed the 'Single Listing Module' and pretty much have everything working as intended with the exception of one thing. The 'Sort by' dropdown menu that appears on my 'Specials' page does not seem to respond when changed. I am stuck with displaying the most recent special offers only. Whilst I would like to keep the Specials appearing from 'New to Old' as default, it would be nice to give customers the choice of changing the option to improve utility.

    I have seen the posts earlier in this thread and tried some of the suggestions based on the files:

    /includes/modules/pages/specials/header_php.php
    /includes/modules/pages/specials/main_template_vars.php


    But they do not seem to do anything to resolve the issue, if anything it made matters worse and I had to revert it back.
    I am not big on PHP so I am really hoping there will be a kind soul out there somewhere that would kindly help me get this working again.

    Here is the code from my header_php.php:

    <?php
    /** Single Listing template mod v1.8
    * Specials header_php.php
    *
    * @package page
    * @copyright Copyright 2003-2006 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: header_php.php 3000 2006-02-09 21:11:37Z wilt $
    */

    require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
    $breadcrumb->add(NAVBAR_TITLE);
    //lines25-71 moved to main_template_vars
    //bof Single Listing Template
    if (MAX_DISPLAY_SPECIAL_PRODUCTS > 0 ) {
    $disp_order_default = PRODUCT_ALL_LIST_SORT_DEFAULT;
    require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_LISTING_DISPLAY_ORDER));
    $order_by = isset($order_by) ? $order_by : 'ORDER BY s.specials_date_added DESC';
    if (MAX_DISPLAY_SPECIAL_PRODUCTS > 0 ) {
    $listing_sql = "SELECT p.products_id, p.products_image, pd.products_name,
    p.master_categories_id, m.manufacturers_name, p.products_model, p.products_quantity, p.products_weight
    FROM (" . TABLE_PRODUCTS . " p
    LEFT JOIN " . TABLE_SPECIALS . " s on p.products_id = s.products_id
    LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id
    LEFT JOIN " . TABLE_MANUFACTURERS . " m ON (p.manufacturers_id = m.manufacturers_id))
    WHERE p.products_id = s.products_id and p.products_id = pd.products_id and p.products_status = '1'
    AND s.status = 1
    AND pd.language_id = :languagesID
    ORDER BY s.specials_date_added DESC";

    $listing_sql = $db->bindVars($listing_sql, ':languagesID', $_SESSION['languages_id'], 'integer');
    //check to see if we are in normal mode ... not showcase, not maintenance, etc
    $show_submit = zen_run_normal();

    $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
    'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
    'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
    'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
    'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
    'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
    'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE);

    /* ,
    'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);
    */
    asort($define_list);
    reset($define_list);
    $column_list = array();
    foreach ($define_list as $key => $value)
    {
    if ($value > 0) $column_list[] = $key;
    }
    }
    }//eof Single Listing Template
    ?>


    And here is my code from main_template_vars.php:

    <?php
    /**Single Listing Template mod v1.8
    * Specials
    *
    * @package page
    * @copyright Copyright 2003-2007 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: main_template_vars.php 6912 2007-09-02 02:23:45Z drbyte $
    */

    if (MAX_DISPLAY_SPECIAL_PRODUCTS > 0 ) {
    $specials_query_raw = "SELECT p.products_id, p.products_image, pd.products_name,
    p.master_categories_id
    FROM (" . TABLE_PRODUCTS . " p
    LEFT JOIN " . TABLE_SPECIALS . " s on p.products_id = s.products_id
    LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
    WHERE p.products_id = s.products_id and p.products_id = pd.products_id and p.products_status = '1'
    AND s.status = 1
    AND pd.language_id = :languagesID
    ORDER BY s.specials_date_added DESC";

    $specials_query_raw = $db->bindVars($specials_query_raw, ':languagesID', $_SESSION['languages_id'], 'integer');
    $specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);
    $specials = $db->Execute($specials_split->sql_query);
    $row = 0;
    $col = 0;
    $list_box_contents = array();
    $title = '';

    $num_products_count = $specials->RecordCount();
    if ($num_products_count) {
    if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS==0 ) {
    $col_width = floor(100/$num_products_count);
    } else {
    $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS);
    }

    $list_box_contents = array();
    while (!$specials->EOF) {

    $products_price = zen_get_products_display_price($specials->fields['products_id']);
    $specials->fields['products_name'] = zen_get_products_name($specials->fields['products_id']);
    $list_box_contents[$row][$col] = array('params' => 'class="specialsListBoxContents"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => '<a href="' . zen_href_link(zen_get_info_page($specials->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($specials->fields['master_categories_id']) . '&products_id=' . $specials->fields['products_id']) . '">' . (($specials->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : zen_image(DIR_WS_IMAGES . $specials->fields['products_image'], $specials->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>') . '<br /><a href="' . zen_href_link(zen_get_info_page($specials->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($specials->fields['master_categories_id']) . '&products_id=' . $specials->fields['products_id']) . '">' . $specials->fields['products_name'] . '</a><br />' . $products_price);
    $col ++;
    if ($col > (SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS - 1)) {
    $col = 0;
    $row ++;
    }
    $specials->MoveNext();
    }
    require($template->get_template_dir('tpl_specials_default.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_specials_default.php');
    }
    }
    ?>


    I really hope there is something simply in there that somebody can point out to me, because I just don't have the know how to see it.

    My site uses Zen Cart version 1.3.9f if that would make any difference and you can find the link to my website here:
    http://www.anglerscorner.co.uk

    Thank s in advance :)

  3. #323
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,571
    Plugin Contributions
    30

    Default Re: Using one single listing template

    I don't think you are being ignored, it's just unlikely anyone is really in a position to help, as it needs some investigation and given the old mod and your shop being old code I would re-iterate my post #320 (remove the mod, upgrade your shop and re-do the templates) as this code is unsupported.
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  4. #324
    Join Date
    Sep 2012
    Location
    West Jefferson, NC
    Posts
    382
    Plugin Contributions
    0

    Default Re: Using one single listing template

    Here is how I converted to a consistent layout...my 2 cents worth.

    This code also provides a way to search and display products by price range, in addition to all, new, and featured products for the current category that is displayed!

    This relies on using the native search capabilities in Zencart...displaying the various listing into the search page result listing.

    I replaced the all_products, new, and featured links (everywhere you use them) with the advanced search links.

    The advanced search can be used to build links for all and new products...easy enough.

    To deal with featured products, I had to put the phrase "Featured Product" at the beginning of all of my product descriptions. Now, advanced search has a way to located by using the phase "Featured Product" as the key word. I'm sure there are many creative ways to do this...

    If you are using breadcrumbs, you will have to edit your breadcrumb file.

    Around line 35 of includes/init_includes/overrides/init_add_crumbs.php, replace existing code with:

    PHP Code:
    /*MIKE ADDED - HIDES CRUMB TRAIL WHEN HOME PAGE IS SET TO A CATEGORY*/
    $myCurrentPage =  $_SERVER['REQUEST_URI'];
    if(
    strpos($myCurrentPage'cPath') !== false) {
    /*END - CLOSING BRACKET AT THE BOTTOM*/
        
    if (isset($cPath_array) && isset($cPath)) {
          for (
    $i=0$n=sizeof($cPath_array); $i<$n$i++) {
            
    $categories_query "select categories_name
                                   from " 
    TABLE_CATEGORIES_DESCRIPTION "
                                   where categories_id = '" 
    . (int)$cPath_array[$i] . "'
                                   and language_id = '" 
    . (int)$_SESSION['languages_id'] . "'";

            
    $categories $db->Execute($categories_query);
        
    //echo 'I SEE ' . (int)$cPath_array[$i] . '<br>';
            
    if ($categories->RecordCount() > 0) {
              
    $breadcrumb->add($categories->fields['categories_name'], zen_href_link(FILENAME_DEFAULT'cPath=' implode('_'array_slice($cPath_array0, ($i+1)))));
            } elseif(
    SHOW_CATEGORIES_ALWAYS == 0) {
              
    // if invalid, set the robots noindex/nofollow for this page
              
    $robotsNoIndex true;
              break;
            }
          }
        }
    }
    /*MIKE - SEE LINE 35-38*/ 
    Your new products link will become outdated if you do not include some sort of date function in your link.

    Around line 118 of YOUR_TEMPLATE/tpl_main_page.php insert this code:

    HTML Code:
    /*MIKE ADDED - HIDES CRUMB TRAIL WHEN HOME PAGE IS SET TO A CATEGORY*/
    $myCurrentPage =  $_SERVER['REQUEST_URI'];
    //echo $category_id." This is the category id";
    if(strpos($myCurrentPage, 'cPath') !== false and strpos($myCurrentPage, 'products_id') == false) { 
    
    $pos = strrpos($cPath, "_");
    /*echo $pos." Characters to remove from cPath to get current category";*/
    	if(strrpos($cPath, "_") == false) {
    		$myCategory = $cPath;
    	}else {
    		$myCategory = substr($cPath, $pos + 1);    // returns "ef"
    	/*echo $myCategory." = myCategory";*/
    	}
    
    ?> 
    
    <div id="searchCategories">
    <ul>
    <li>
    <a href="index.php?main_page=advanced_search_result&keyword=+&search_in_description=1&categories_id=<?php echo $myCategory; ?>&inc_subcat=1&manufacturers_id=&pfrom=0&pto=1000000&dfrom=&dto=&x=36&y=10">All Products</a>
    </li>
    <li>
    <a href="index.php?main_page=advanced_search_result&keyword=%22Featured+Product%22&search_in_description=1&categories_id=<?php echo $myCategory; ?>&inc_subcat=1&manufacturers_id=&pfrom=&pto=&dfrom=&dto=&x=36&y=10">Best Deals</a>
    </li>
    
    </li><li>
    <a href="index.php?main_page=advanced_search_result&keyword=+&search_in_description=1&categories_id=
    <?php echo $myCategory; ?>&inc_subcat=1&manufacturers_id=&pfrom=0&pto=10000000&dfrom=
    <?php $date = date('m/d/Y');
    $newdate = strtotime ( '-6 month' , strtotime ( $date ) ) ;
    $newdate = date ( 'm/d/Y' , $newdate );
    echo $newdate; ?>
    &dto=&x=36&y=10">New</a>
    <li>
    <a href="index.php?main_page=advanced_search_result&keyword=+&search_in_description=1&categories_id=<?php echo $myCategory; ?>&inc_subcat=1&manufacturers_id=&pfrom=0&pto=25&dfrom=&dto=&x=36&y=10">$0 - $25</a>
    </li>
    <li>
    <a href="index.php?main_page=advanced_search_result&keyword=+&search_in_description=1&categories_id=<?php echo $myCategory; ?>&inc_subcat=1&manufacturers_id=&pfrom=25&pto=50&dfrom=&dto=&x=36&y=10">$25 - $50</a>
    </li>
    <li>
    <a href="index.php?main_page=advanced_search_result&keyword=+&search_in_description=1&categories_id=<?php echo $myCategory; ?>&inc_subcat=1&manufacturers_id=&pfrom=50&pto=75&dfrom=&dto=&x=36&y=10">$50 - $75</a>
    </li>
    <li>
    <a href="index.php?main_page=advanced_search_result&keyword=+&search_in_description=1&categories_id=<?php echo $myCategory; ?>&inc_subcat=1&manufacturers_id=&pfrom=75&pto=100&dfrom=&dto=&x=36&y=10">$75 - $100</a>
    </li>
    </ul>
    </div>
    Apply these same concepts where ever you have links for all, new, and featured and you will have listings that all look the same.

    Hope this helps someone.
    Last edited by mikeel100; 24 Nov 2015 at 08:40 PM. Reason: tags

  5. #325
    Join Date
    Sep 2012
    Location
    West Jefferson, NC
    Posts
    382
    Plugin Contributions
    0

    Default Re: Using one single listing template

    I updated the code to make searches even more intelligent...
    - changed date criteria to match the Zencart global time limit for new products
    - added a reset(in case the user gets stuck in a loop:))
    - enabled the searches to be done from, home, featured, new, manufacturers, and any other page that may show(except specials).

    Find this in /YOUR TEMPLATE/templates/common/tpl_main_page.php:

    Code:
        <div id="bannerThree" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
    <?php
        }
      }
    ?>
    ...and paste the code below into your document.

    Code:
    <?php
    //MIKE ADDED CATEGORY SEARCH CRITERIEA
    
    $myCurrentPage =  $_SERVER['REQUEST_URI'];
    //echo $myCurrentPage . ' - myCurrentPage<br>';
    
    //if(strpos($myCurrentPage, '_') == !false) { 
    //KEY WORD 
    	if (strripos($myCurrentPage, 'Free')) {
    		$myKeyword = '%22Free+Shipping%22';
    	} elseif (strripos ($myCurrentPage, 'Featured')) {
    		$myKeyword = '%22Featured+Product%22';
    	} else {
    		$myKeyword = '+';
    	}
    //DATE STUFF
    	$date = date('m/d/Y');
    	$newdate = strtotime ( '-' . SHOW_NEW_PRODUCTS_LIMIT . ' day' , strtotime ( $date ) ) ;
    	$newdate = date ( 'm/d/Y' , $newdate );
    
    	if (strpos($myCurrentPage, "$date") !== false) {
    		$date_to = "$date";
    		$date_from = "$newdate";
    	} else {
    		$date_to = '';
    		$date_from = '';
    	}
    //CATEGORY
    	$pos = strrpos($cPath, "_");
    	if(strrpos($cPath, "_") == false) {
    		$myCategory = $cPath;
    	}else {
    		$myCategory = substr($cPath, $pos + 1);    // returns "ef"
    	}
    
    	if(!is_numeric($myCategory)) {
    		$myCategory = substr($myCurrentPage, strpos($myCurrentPage, 'categories_id=') + strlen('categories_id='));
    		if (strstr ($myCategory,'&inc_subcat',TRUE) != FALSE) {
    			$myCategory = strstr ($myCategory,'&inc_subcat',TRUE);
    		} else {
    			$myCategory = '';
    		}	
    	}
    //PRICE FROM & TO
    	$priced_from = substr($myCurrentPage, strpos($myCurrentPage, 'pfrom=') + strlen('pfrom='));
    	if (strstr ($priced_from,'&pto',TRUE) != FALSE) {
    		$priced_from = strstr ($priced_from,'&pto',TRUE);
    	} else {
    		$priced_from = '';
    	}	
    
    	$priced_to = substr($myCurrentPage, strpos($myCurrentPage, 'pto=') + strlen('pto='));
    	if (strstr ($priced_to,'&dfrom',TRUE) != FALSE) {
    		$priced_to = strstr ($priced_to,'&dfrom',TRUE);
    	} else {
    		$priced_to = '';
    	}
    //RESET
    	if(is_numeric($manufacturers_id)) {
    		$reset = "<a href='index.php?main_page=index&manufacturers_id={$manufacturers_id}'>--Reset--</a>";
    	} else {
    		$reset = "<a href='index.php?main_page=index&cPath={$myCategory}'>--Reset--</a>";
    	}
    	
    ?> 
    
    <div id="searchCategories">
    <ul>
    <li>
    <a href="index.php?main_page=advanced_search_result&keyword=+&search_in_description=1&categories_id=<?php echo $myCategory; ?>&inc_subcat=1&manufacturers_id=<?php echo $manufacturers_id; ?>&pfrom=0&pto=1000000&dfrom=<?php echo $date_from; ?>&dto=<?php echo $date_to; ?>">All Products</a>
    </li>
    <li>
    <a href="index.php?main_page=advanced_search_result&keyword=%22Featured+Product%22&search_in_description=1&categories_id=<?php echo $myCategory; ?>&inc_subcat=1&manufacturers_id=<?php echo $manufacturers_id; ?>&pfrom=<?php echo $priced_from; ?>&pto=<?php echo $priced_to; ?>&dfrom=<?php echo $date_from; ?>&dto=<?php echo $date_to; ?>">Best Deals</a>
    </li>
    <li>
    <a href="index.php?main_page=advanced_search_result&keyword=%22Free+Shipping%22&search_in_description=1&categories_id=<?php echo $myCategory; ?>&inc_subcat=1&manufacturers_id=<?php echo $manufacturers_id; ?>&pfrom=<?php echo $priced_from; ?>&pto=<?php echo $priced_to; ?>&dfrom=<?php echo $date_from; ?>&dto=<?php echo $date_to; ?>">Free Shipping</a>
    </li>
    <li>
    <a href="index.php?main_page=advanced_search_result&keyword=<?php echo $myKeyword; ?>&search_in_description=1&categories_id=<?php echo $myCategory; ?>&inc_subcat=1&manufacturers_id=<?php echo $manufacturers_id; ?>&pfrom=<?php echo $priced_from; ?>&pto=<?php echo $priced_to; ?>&dfrom=<?php echo $newdate; ?>&dto=<?php echo $date; ?>">New</a>
    </li>
    <li>
    <a href="index.php?main_page=advanced_search_result&keyword=<?php echo $myKeyword; ?>&search_in_description=1&categories_id=<?php echo $myCategory; ?>&inc_subcat=1&manufacturers_id=<?php echo $manufacturers_id; ?>&pfrom=0&pto=25&dfrom=<?php echo $date_from; ?>&dto=<?php echo $date_to; ?>">$0 - $25</a>
    </li>
    <li>
    <a href="index.php?main_page=advanced_search_result&keyword=<?php echo $myKeyword; ?>&search_in_description=1&categories_id=<?php echo $myCategory; ?>&inc_subcat=1&manufacturers_id=<?php echo $manufacturers_id; ?>&pfrom=25&pto=50&dfrom=<?php echo $date_from; ?>&dto=<?php echo $date_to; ?>">$25 - $50</a>
    </li>
    <li>
    <a href="index.php?main_page=advanced_search_result&keyword=<?php echo $myKeyword; ?>&search_in_description=1&categories_id=<?php echo $myCategory; ?>&inc_subcat=1&manufacturers_id=<?php echo $manufacturers_id; ?>&pfrom=50&pto=75&dfrom=<?php echo $date_from; ?>&dto=<?php echo $date_to; ?>">$50 - $75</a>
    </li>
    <li>
    <a href="index.php?main_page=advanced_search_result&keyword=<?php echo $myKeyword; ?>&search_in_description=1&categories_id=<?php echo $myCategory; ?>&inc_subcat=1&manufacturers_id=<?php echo $manufacturers_id; ?>&pfrom=75&pto=100&dfrom=<?php echo $date_from; ?>&dto=<?php echo $date_to; ?>">$75 - $100</a>
    </li>
    
    <li>
    <?php echo $reset; ?>
    </li>
    </ul>
    </div>
    <?php //} /*END MIKE*/?>
    Turn off all links to the native zencart links for All, Featured, and New.

    Now all of your listings will look like your product page listing!

  6. #326
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,399
    Plugin Contributions
    87

    Default Re: Using one single listing template

    You can also use the (currently supported) SNAF (Specials,New,All,Featured) plugin which also uses a single formatting template for those listings as well as the products' listings.

  7. #327
    Join Date
    Sep 2012
    Location
    West Jefferson, NC
    Posts
    382
    Plugin Contributions
    0

    Default Re: Using one single listing template

    Quote Originally Posted by lat9 View Post
    You can also use the (currently supported) SNAF (Specials,New,All,Featured) plugin which also uses a single formatting template for those listings as well as the products' listings.
    Thanks for the tip! I'll check it out.

 

 
Page 33 of 33 FirstFirst ... 23313233

Similar Threads

  1. Single Listing Template
    By AnglersCorner in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 24 Mar 2015, 01:55 PM
  2. single listing template addon - grid layout for products
    By noyloza in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 14 Nov 2012, 03:45 PM
  3. Column Grid / Single Listing Template Alternative
    By niccol in forum All Other Contributions/Addons
    Replies: 74
    Last Post: 9 Jul 2012, 01:25 PM
  4. Single Listing Template problem
    By gqq0404 in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 15 Nov 2010, 08:57 PM
  5. Transfer of one single category from one Zen database to another
    By MeltDown in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 14 Oct 2008, 07:07 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