Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2012
    Posts
    106
    Plugin Contributions
    0

    Default Customer ability to filter inventory stock

    I have our store set up to allow for customers to place back orders so I have the stock set to show even if out of stock. What I need is to create a module that will allow customer to be able to choose if they want to see all products or ones in stock only. I have looked and asked and there is no contribution or post that will allow this so here I am, looking for help.

    I am more or less trying to duplicate (in a new file) the "product_listing_alpha_sorter" php file in the shop/includes/modules folder and named the new file "product_listing_stock_sorter". My problem is I need help editing the file to look for stock count and not create alpha characters. The drop down menu will appear to the right of the alpha sorter in the "tpl_index_product_list" file in my template.

    Here is the file:
    PHP Code:
    <?php
    /**
     * product_listing_alpha_sorter module
     *
     * @package modules
     * @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: product_listing_alpha_sorter.php 4330 2006-08-31 17:10:26Z ajeh $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die(
    'Illegal Access');
    }

    // build alpha sorter dropdown
      
    if (PRODUCT_LIST_ALPHA_SORTER == 'true') {
        if ((int)
    $_GET['alpha_filter_id'] == 0) {
          
    $letters_list[] = array('id' => '0''text' => TEXT_PRODUCTS_LISTING_ALPHA_SORTER_NAMES);
        } else {
          
    $letters_list[] = array('id' => '0''text' => TEXT_PRODUCTS_LISTING_ALPHA_SORTER_NAMES_RESET);
        }
        for (
    $i=65$i<91$i++) {
          
    $letters_list[] = array('id' => sprintf('%02d'$i), 'text' => chr($i) );
        }
        for (
    $i=48$i<58$i++) {
          
    $letters_list[] = array('id' => sprintf('%02d'$i), 'text' => chr($i) );
        }
        if (
    TEXT_PRODUCTS_LISTING_ALPHA_SORTER != '') {
          echo 
    '<label class="inputLabel">' TEXT_PRODUCTS_LISTING_ALPHA_SORTER '</label>' zen_draw_pull_down_menu('alpha_filter_id'$letters_list, (isset($_GET['alpha_filter_id']) ? $_GET['alpha_filter_id'] : ''), 'onchange="this.form.submit()"');
        } else {
          echo 
    zen_draw_pull_down_menu('alpha_filter_id'$letters_list, (isset($_GET['alpha_filter_id']) ? $_GET['alpha_filter_id'] : ''), 'onchange="this.form.submit()"');
        }
      }
    ?>
    Can someone help me with this?

    This would make for a great contribution if we can come together as a community to build it.

    Thanks,

    Clint

  2. #2
    Join Date
    Aug 2012
    Posts
    106
    Plugin Contributions
    0

    Default Re: Customer ability to filter inventory stock

    From english.php I have added:
    PHP Code:
    // extra product listing stock sorter    
      
    define('TEXT_PRODUCTS_LISTING_STOCK_SORTER''');
      
    define('TEXT_PRODUCTS_LISTING_STOCK_SORTER_NAMES''Items starting with ...');
      
    define('TEXT_PRODUCTS_LISTING_STOCK_SORTER_NAMES_RESET''-- Reset --'); 
    In tpl_index_product_list.php I have already listed:
    PHP Code:
      // draw stock sorter
      
    require(DIR_WS_MODULES zen_get_module_directory(FILENAME_PRODUCT_LISTING_STOCK_SORTER)); 

 

 

Similar Threads

  1. v154 Ability to Check Out with 0 Units (stock)
    By DanMickle in forum Basic Configuration
    Replies: 15
    Last Post: 1 Sep 2015, 04:43 AM
  2. v151 Inventory Stock by Attributes
    By Kevin205 in forum General Questions
    Replies: 0
    Last Post: 6 Jul 2013, 04:53 PM
  3. lost ability to delete customer please help
    By KPKev in forum General Questions
    Replies: 9
    Last Post: 18 Nov 2010, 10:41 PM
  4. Ability to update stock levels per attribute via live data feed?
    By Stevis2002 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 20 Oct 2010, 03:58 PM
  5. Ability for customer to enter custom shipping price?
    By jesselperry in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 18 Dec 2009, 01:48 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