Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

"in-stock" only filter - problem


Guest

Recommended Posts

Hi.

 

Second time here today and related.

 

I installed teh In-stock only filter contribution, but it doesn't work ok everywhere.

 

It shows when checked in stock products for Categories but not subcategories, and when I put it in specials.php I get an error about an extra {.

 

It may have to do with the new version of osc or a conflict with other contributions I installed.

 

See here the In stock filter for categories and... no filter for subcategories

 

In addition, the Manufacturers filter doesn't display right in categories - and also missing in subcategories...

 

Thank you.

Link to comment
Share on other sites

Well, I've worked a bit on this and I managed to have the In Stock check box moved.

 

The thing is that it doesn't seem to work together with Manufacturers filter...

Either one or the other works.

The error I get on the bottom of the browser is Error on page:

 

'this.form' is null or not an object

line 406

char 1

 

This is the code from index.php :

 

// optional Product List Filter

if (PRODUCT_LIST_FILTER > 0) {

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

/** original **/ //$filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name";

 

/** show-soldout-v1.0 **/ $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name";

} else {

/** original **/ //$filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name";

 

/** show-soldout-v1.0 **/ $filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name";

}

$filterlist_query = tep_db_query($filterlist_sql);

if (tep_db_num_rows($filterlist_query) > 1) {

echo ' <td align="center" class="main">' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . TEXT_SHOW . ' ';

 

 

 

 

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']);

$options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES));

} else {

echo tep_draw_hidden_field('cPath', $cPath);

$options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS));

}

 

 

echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']);

while ($filterlist = tep_db_fetch_array($filterlist_query)) {

$options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']);

 

}

echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"');

echo tep_hide_session_id() . '</form></td> </td>' . "\n";

 

 

Line 406: echo tep_draw_checkbox_field('instock', 1, false, 'onClick="this.form.submit()"') . HEADER_INSTOCK . '</form></td>' . "\n";

 

}

}

 

 

If I move this:

echo tep_draw_checkbox_field('instock', 1, false, 'onClick="this.form.submit()"') . HEADER_INSTOCK . '</form></td>' . "\n";

 

above this:

 

echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']);

 

manufacturers filter doesn't work.

 

If I leave it as above, the in sytock filter doesn't work....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...