Jump to content
Sign in to follow this  
straider

Browse by Categories

Recommended Posts

That worked! Thanks for that code!!

 

BTW, if I may suggest another idea for version 2.6:

Include a readme file, which will tell people exaclty what lines of code have to be removed, and what has to come instead of them. Telling them the line numbers on the stock file is also needed.

 

This will make it easier for users to remove the contribution if they so choose, and it might also help track back problems people have while installing it.

 

-Ethan, he who broke the code of this forum, and opened a new table row. :)

Share this post


Link to post
Share on other sites

Hi every one!

 

 

I was wondering:

 

Is it possible to modify this contribution to show the subcatagories in the same way that the main categories are shown... ie with the image and text in bold?

 

Also,

Is it possible to modify it to display Manufacturers in a similar way to this contribution? Perhaps in a seperate box?

 

Thanks heaps!

 

This is a great contribution and thank the authors very much for developing it! You can see it in action at my webiste here:

http://www.imtechnology.com.au

 

Thanks again for developing it! :D

Share this post


Link to post
Share on other sites

inquisitivemind,

 

It's possible (and easy) to change this module to display sub-category links as images instead of text. The small problem to address here is how it should look like: images on the right of the category icon in one column, images below the category icon in several columns, ...

 

To address this new layout, a new configuration setting is required: how many columns per row should be used to display sub-category icons?

 

Another issue is where to position the category and sub-categories captions: below the image or on the left or on the right side of the image? This again, if it's a desired feature, requires a new configuration setting: caption position relative to image.

 

Short answer: it's possible and really easy, if you're not too concerned with the appearance result. If you want to make it look good, then it's still possible although it requires more changes.

 

The first scenario is a matter of editing the SQL query for sub-categories, to include the image field, and lines of code where the sub-category link is built, to use the image as well. The second scenario requires database/table changes, code changes, debugging and testing. Takes longer, but nevertheless is possible. :)

 

Now, about a Browse by Manufacturers module. Well, that's an entirely new module, although the code can be based on Browse by Categories. Unfortunately, I'm still working on release 2.6, without much free time in my hands, and I cannot at the moment work on this. Maybe someone else is free and can deliver this new module, hopefully.

 

As soon as I finish v2.6, I can then start coding a Browse by Manufacturers. Maybe turn this whole contribuition in something like Browse by <something>. Not at the moment though. :(

 

But if you and others build a list of wish-features, taking into account the pending list of features for v2.6, I can code it faster and plan the release of new features ahead in time. Would be great to have translations done in other languages than English, Portuguese and French (thanks azer) as it would be great too to have a battery of tests ligned up to be executed on each new release. But bare in mind that I never planned this module to be used so much. Was just something nice I wanted to use. I'm really glad that many have pick it up and use it on their online shops. :)

 

Thanks.


Contributions:

. Browse by Categories

-----------------------------------------------------------

Jos? Carlos Monteiro - DoWeDo-IT

Share this post


Link to post
Share on other sites

Straider,

 

Thanks for your very quick response!

 

In regards to the subcategory images i was thinking that they could be just very small images to the left of the text link.

 

I was also wondering if the text links for the subcategories (when you select them to be below the main category) could be made to be centered rather than to the left. It looks a little strange on my website almost as though they are not actually part of the category (please not i haave turned off the images till next month as i am trying to conserve bandwidth)

 

In regards to the Manufacturers module... i'm sorry to say that i'm not too good at programing... i know the basics but thats about it. I will (probably tomorrow) try and have a go at it but doubt i'll get very far. I do however think that you idea about converting this module into a browse by <something> module is great and look forward to its development if you eventually have the time to do it. :rolleyes:

 

When is the expected release date of 2.6.... is it months away? or will it be released shortly?

 

Also, Do you have a current list of things which will / may be implemented in 2.6 already.... or shall i try to go through the entire 11 pages of this thread and compile it for you?

 

Thanks again for a great contribution!

Share this post


Link to post
Share on other sites

inquisitivemind,

 

The estimated release date for v2.6 doesn't exist. In terms of code is a quick code patch and fixes, but in terms of free time I cannot know. If you want to follow the progress of v2.6, please read these posts:

http://forums.oscommerce.com/index.php?sho...ndpost&p=357261

http://forums.oscommerce.com/index.php?sho...ndpost&p=357806

http://forums.oscommerce.com/index.php?sho...ndpost&p=357815

http://forums.oscommerce.com/index.php?sho...ndpost&p=358139

 

What you're asking is for yet another new layout. And all these layouts should be great, as I've seen how some people apply the module to their online shops.

 

And the code for the manufacturers module, although should be simpler than categories (you don't have sub-manufacturers, for instance), is at present time outside the scope of this contribution. In terms of dates, again, the new v2.5 can be released next week or not. If I find enough free time to apply on coding it, than it's a matter of days, but if not then I can't forecast a release date. If anyone wants to pitch in, please feel free to do so. Thanks... :)


Contributions:

. Browse by Categories

-----------------------------------------------------------

Jos? Carlos Monteiro - DoWeDo-IT

Share this post


Link to post
Share on other sites

Hi All,

 

First like to say thanks for the great mod - it's really a great enhancement over the default osC layout!

 

I have a very slight problem that I can't seem to get to the bottom of - when using BBC with Sub-Category Link Mode set to "off" - I get a suprious table row underneath the main boxes -

 

  </tr>

// begin here

 <tr>
 </tr>

// end here

</table>
</td>
 </tr>
</table>
<!-- browse_categories_eof !-->

 

Can anyone think of a reason why? Obviously it's not critial - just shows a annoying line I'd like to remove...

 

Thanks

Share this post


Link to post
Share on other sites

RicherD,

 

Which version of BBC are you using?

 

Do you have an online site where I can get a hold of the source viewed by the browser, so I can try to pin-point the cause of that bug? Do you have the setting BRWCAT_SUBCAT_MODE set to bottom or right? Does it happen on the last category of can it happen at any category?

 

I think it's because of passing   to the text argument, when BRWCAT_SUBCAT_MODE matches 'off', in lines such as this one:

'text'   => ($sub_category_links == '' && BRWCAT_SUBCAT_MODE != 'off') ? ' ' : $sub_category_links);

 

A quick fix could be testing the value of the setting BRWCAT_SUBCAT_MODE before filling in the $content_box_contents[<row_number>][<column_number>]. Bare in mind that I'm not sure if this will cause a table layout disruption, and I'm also not sure about the cause of the problem.

 

Thanks.


Contributions:

. Browse by Categories

-----------------------------------------------------------

Jos? Carlos Monteiro - DoWeDo-IT

Share this post


Link to post
Share on other sites

Straider,

 

Thanks for your speedy response - I've managed to remove the extra <TR>'s by commenting out the code you highlighted. On the site I'm using BBC 2.5, with icons set to "Image with Caption" and Sub Category links "off" - it's just a list of category images essentially.

 

Seems the problem area was around:

 

if ($arr_sub_category_mode[0] == 'right') {
<SNIPPED>
} else {
$content_box_contents[$row + 1][$col] = array('align'  => 'left',
  'params' => 'class="smallText" valign="top" width="' . $table_cell_width . '"',
  'text'   => ($sub_category_links == '' && BRWCAT_SUBCAT_MODE != 'off') ? ' ' : $sub_category_links);

 

I guess as you pointed out passing the   triggers the new empty table row... I commented out those few lines and it works perfectly...

 

Thanks again!

 

:)

Share this post


Link to post
Share on other sites

Hi,

 

I seem to have found a little proplem with this contribution. It is excellent but for the problem below.

 

It seems that spiders are somehow creating there own categories. such as the one below:

 

http://www.imtechnology.com.au/category8_1...oduct_info.html

 

As you can see from the link the spiders must be visiting one page in a category then switching categories and adding the imfo to the bredcrumb trail or something like that.

 

In anycase the spiders are chewing up my bandwidth so i need to find a solution, in the mean time i have turned this contribution off.

 

I am using it differently to the suggested use... in that i had it in the footer of the page so that it will display on all pages. I did this to try and increase exposure of deeper categories for spiders but also users.

 

Any help would be greatly appreciated!!!

 

Thanks,

 

Edwin

Share this post


Link to post
Share on other sites

inquisitivemind,

 

I can't think of any reason or cause for such bug. The code can't create categories on-the-fly, what maybe is happening is that for some unknown reason it is building cPath in a wrong manner, but I can't figure out why.

 

I see (at this point) no reasons why including the module from the footer can trigger such a behavior. Can you try to pin-point the cause of the problem? For instance, including the module from the index.php/default.php still triggers the same behavior, or just when included from the footer.php?

 

Thanks.


Contributions:

. Browse by Categories

-----------------------------------------------------------

Jos? Carlos Monteiro - DoWeDo-IT

Share this post


Link to post
Share on other sites

Just a quick question - I installed Browse by Categories V2.5 which works fine...however I installed the modification to enable and disable product categories 1.4 (http://www.oscommerce.com/community/contributions,326) but this won't seem to work with the Browse by Categories page. The following error shows on the category page -

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/httpd/vhosts/mysite.com/httpdocs/catalog/includes/functions/database.php on line 99

 

The only thing difference seems to be in the catalog/index.php as some the code that needs to be changed for the Enable/Disable mod has been removed by the Browse by Categories Mod.

 

They both seem to work fine in all other parts of the site.

 

Just wondering if anyone else has used these two contributions together successfully! Otherwise I will have to remove one!

 

Thanks

Share this post


Link to post
Share on other sites

oakhill,

 

The code that is recommended to be commented out was used to output the default sub-category icons (know by all of us that use osCommerce). It may happen that some of that code is necessary for other contributions, such as the one you identified. As such, my suggestion is to post your index file changes/modifications, by each of the contributions, and I or others will try to help pin-point the problem and present a solution.

 

In the meantime, I'll download that contribution and do a fast analysis of the chages it does require.

 

I wish I could be more helpful, but at this point there's not much I can do.

 

Thanks.


Contributions:

. Browse by Categories

-----------------------------------------------------------

Jos? Carlos Monteiro - DoWeDo-IT

Share this post


Link to post
Share on other sites

oakhill,

 

Please, correct me if I'm wrong, but after reading the changes required by the contribution Enable/Disable Product Categories for the default.php/index.php I see no reasons why you shouldn't comment out the lines recommended by Browse by Categories. If you wish, try the following:

  • Don't comment out and check the shop pages. You should see everything fine, except that for sub-category pages you will see the icons presented twice. The first set of icons is from the code that should be commented out and the second set of icons, inside a content box, is shown by the Browse by Categories module.
  • Then, comment out the code. You should see the same pages, without any problems, except that on sub-category pages you will only see one set of icons now.

Since you say you have an SQL error, I suggest you first install just the Enable/Disable Categories contribution, fix everything so it runs smoothly and only then apply Browse by Categories.

 

I really can't see any reason why they both shouldn't work together. But if that are any incompatibilities, I'll try my best to fix them.

 

Hope this helps you out.


Contributions:

. Browse by Categories

-----------------------------------------------------------

Jos? Carlos Monteiro - DoWeDo-IT

Share this post


Link to post
Share on other sites

HI Straider

Thanks for the advice - I know have it working to some extent in that the error has gone! However, the effect of the enable/disable categories isn't carrying onto the Browse by Category area. Wjen I turn a category off in the admin area, it makes the category disappear in the category list on the left hand side box but it still appears in the browse by category box in the center. Have had a play around but my php skills are only beginner level so have had no success as yet! Here is my code for catalog/index.php

 

<?php

/*

$Id: index.php,v 1.1 2003/06/11 17:37:59 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

// the following cPath references come from application_top.php

$category_depth = 'top';

if (isset($cPath) && tep_not_null($cPath)) {

$categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

$cateqories_products = tep_db_fetch_array($categories_products_query);

if ($cateqories_products['total'] > 0) {

$category_depth = 'products'; // display products

} else {

$category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");

$category_parent = tep_db_fetch_array($category_parent_query);

if ($category_parent['total'] > 0) {

$category_depth = 'nested'; // navigate through the categories

} else {

$category_depth = 'products'; // category has no products, but display the 'no products' message

}

}

}

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

 

 

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="750" cellspacing="1" cellpadding="1" align="center">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<?php

if ($category_depth == 'nested') {

$category_query = tep_db_query("select cd.categories_name, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'");

$category = tep_db_fetch_array($category_query);

?>

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . $category['categories_image'], $category['categories_name'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<!-- DWD Contribution -> Remove: Browse by Categories v2.2. //-->

<!--

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

//-->

<!-- DWD Contribution End. //-->

<?php

//DWD Contribution - remove: Browse Categories

if (isset($cPath) && strpos('_', $cPath)) {

//check to see if there are deeper categories within the current category

$category_links = array_reverse($cPath_array);

for($i=0, $n=sizeof($category_links); $i<$n; $i++) {

$categories_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");

$categories = tep_db_fetch_array($categories_query);

if ($categories['total'] < 1) {

// do nothing, go through the loop

} else {

//$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");

// BOF Enable - Disable Categories Contribution--------------------------------------

/*

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");

*/

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_status = '1' and c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");

// EOF Enable - Disable Categories Contribution--------------------------------------

break; // we've found the deepest category the customer is in

}

}

} else {

//$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");

// BOF Enable - Disable Categories Contribution--------------------------------------

/*

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");

*/

//$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_status = '1' and c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");

// EOF Enable - Disable Categories Contribution--------------------------------------

 

}

 

$number_of_categories = tep_db_num_rows($categories_query);

 

$rows = 0;

while ($categories = tep_db_fetch_array($categories_query)) {

$rows++;

$cPath_new = tep_get_path($categories['categories_id']);

$width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';

echo ' <td align="center" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br>' . $categories['categories_name'] . '</a></td>' . "\n";

if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) {

echo ' </tr>' . "\n";

echo ' <tr>' . "\n";

}

}

 

//DWD Contribution end

// needed for the new products module shown below

$new_products_category_id = $current_category_id;

?>

<!--DWD Contribution - remove: Browse by Categories V2.2

</tr>

</table></td>

</tr>

//-->

<!--DWD Contibution End. //-->

 

<!--DWD Contibution -> Add: Browse by Categories v2.0. !-->

<tr>

<td><?php $browse_category_id = $current_category_id; include(DIR_WS_MODULES . FILENAME_BROWSE_CATEGORIES); ?></td>

</tr>

<!-- DWD Contribution End. !-->

 

</tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><?php include(DIR_WS_MODULES . FILENAME_FEATURED); ?></td>

</tr>

</table></td>

</tr>

</table></td>

<?php

} elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {

// create column list

$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);

 

$column_list = array();

reset($define_list);

while (list($key, $value) = each($define_list)) {

if ($value > 0) $column_list[] = $key;

}

 

$select_column_list = '';

 

for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {

switch ($column_list[$i]) {

case 'PRODUCT_LIST_MODEL':

$select_column_list .= 'p.products_model, ';

break;

case 'PRODUCT_LIST_NAME':

$select_column_list .= 'pd.products_name, ';

break;

case 'PRODUCT_LIST_MANUFACTURER':

$select_column_list .= 'm.manufacturers_name, ';

break;

case 'PRODUCT_LIST_QUANTITY':

$select_column_list .= 'p.products_quantity, ';

break;

case 'PRODUCT_LIST_IMAGE':

$select_column_list .= 'p.products_image, ';

break;

case 'PRODUCT_LIST_WEIGHT':

$select_column_list .= 'p.products_weight, ';

break;

}

}

 

// show the products of a specified manufacturer

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

if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {

// We are asked to show only a specific category

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";

} else {

// We show them all

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";

}

} else {

// show the products in a given categorie

if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {

// We are asked to show only specific catgeory

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

} else {

// We show them all

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

}

}

 

if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {

for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {

if ($column_list[$i] == 'PRODUCT_LIST_NAME') {

$HTTP_GET_VARS['sort'] = $i+1 . 'a';

$listing_sql .= " order by pd.products_name";

break;

}

}

} else {

$sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);

$sort_order = substr($HTTP_GET_VARS['sort'], 1);

$listing_sql .= ' order by ';

switch ($column_list[$sort_col-1]) {

case 'PRODUCT_LIST_MODEL':

$listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_NAME':

$listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : '');

break;

case 'PRODUCT_LIST_MANUFACTURER':

$listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_QUANTITY':

$listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_IMAGE':

$listing_sql .= "pd.products_name";

break;

case 'PRODUCT_LIST_WEIGHT':

$listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_PRICE':

$listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

}

}

?>

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<?php

// optional Product List Filter

if (PRODUCT_LIST_FILTER > 0) {

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

$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";

} else {

$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";

}

$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 '</form></td>' . "\n";

}

}

 

// Get the right image for the top-right

$image = DIR_WS_IMAGES . 'table_background_list.gif';

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

$image = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");

$image = tep_db_fetch_array($image);

$image = $image['manufacturers_image'];

} elseif ($current_category_id) {

$image = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

$image = tep_db_fetch_array($image);

$image = $image['categories_image'];

}

?>

<td align="right"><?php echo tep_image(DIR_WS_IMAGES . $image, HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td>

</tr>

</table></td>

<?php

} else { // default page

?>

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_default.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="main"><?php echo tep_customer_greeting(); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td class="main"><?php echo TEXT_MAIN; ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><?php include(DIR_WS_MODULES . FILENAME_FEATURED); ?></td>

</tr>

<?php

include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);

?>

</table></td>

</tr>

</table></td>

<?php

}

?>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

My oscommerce part of the site is not live and is not quite finished, but if it helps, you can visit the actual page at http://www.oakhillnailspa.com.au/catalog/i...?cPath=28_21_22 The catagory I have turned off is Beautiful Nails. It has disappeared from the list in the Category info box but is still listed in the middle area.

 

Hope you can find a solution! Thanks again for your help! :D

Share this post


Link to post
Share on other sites

Aloha all,

I cannot get this mod to run. Any help would be great!

Ok so far i have inserted the sql tbls and added the included mods and lang to correct folder. It shows up in my admin... so i selected the settings i want.

Now what do i do??

 

i know i have to do something to the index page. I copied the index.php that someone had added to this topic. but it didnt add the top category icons to the page.

 

Does anyone have the code for the index.php page??

 

Sorry, I dont know php at all but i can copy and paste very well:)

 

Mahalo all,

Bonnie

Share this post


Link to post
Share on other sites

oakhill,

I installed the enable/disable contribution a few weeks ago, over a very moded osC. I had to edit the code of all the contributions i had previously installed, but it's not too dificult. This will take some basic SQL understanding, and a lot of patience:

The enable/diasable contribution (from here on to be known as E/D), adds a column to the categories table, called categories_status. In all the queries you run, you have to make a condition on this column, as the E/D SQL statements would show.

any query you wish to edit, which already refers to TABLE_CATEGORIES is easy to fix. In it's WHERE clause, add the following condition:

c.categories_status = '1'

Most queries do in fact read from this table, among others, but if you encounter one that doesn't you will have to add the table to the FROM clause (from " . TABLE_CATEGORIES . " c, " ), and in the WHERE clause, use the code I gave you above, and link the table to any other tables by the common fields, usually being the categories_id (WHERE c.categories_id=cd.categories_id, for example)

 

This ought to fix all the problems you have in this matter.

 

-Ethan

Share this post


Link to post
Share on other sites

Thanks Eathan - I will have to sit down and carefully work through as per your instructions. My SQL skills aren't great but I am learning! Will let you know how it goes! :)

Share this post


Link to post
Share on other sites

I love this contribution...my only problem is that I currently have huge category images to replace the category heading text. So instead of heading_text and category image, I have what looks like heading text and a banner under it..although it is only a single image. electronics-main.gif

 

Is there a way to add a second category image that can be used exclusively for this contribution? I have no clue about mySQL but my thought is that maybe it could be possible to assign a second category image and then query that image to the box? Can someone help me please??

Share this post


Link to post
Share on other sites

ecopeia,

 

That's a tough issue. What did you have before using Browse by Categories, the default sub-category icons layout of osCommerce? How did that looked like?

 

As fast answer, you can either disable displaying the category icon and just use text, or you may have to tweak the code to suit your needs. I haven't thought much about it yet, but I see no fast patch that I can deliver to you. If you or other community have any ideas, I'll be glad to discuss them.

 

But has you may have noticed already, I'm taking quite a long time to release version 2.6, or even code other user's requests, such as Browse by Manufacturer. I just don't have enough free time to spare, at the moment. I apologize for that.

 

If you can post the link to your shop, maybe I or others can throw in some good ideas to help you out. What you think?


Contributions:

. Browse by Categories

-----------------------------------------------------------

Jos? Carlos Monteiro - DoWeDo-IT

Share this post


Link to post
Share on other sites

Thank you for your response..I totally understand how you can get swamped.

 

Here is my site Please note that it is NOT LIVE - yet. :)

 

I have managed to jury-rig a solution for myself using image maps..but I reeeally want to use the contribution instead. So, I'll keep my eye on your contrib and hope that in the future someone may decide to take up my cause.

 

Thanks again!

Share this post


Link to post
Share on other sites

Ok, Straider, it's me again. I don't know if this is still the active thread but I have another question. If you've already answered this, I apologize!!

 

Does this contribution work for 2nd level category pages? All my products are located at least 3rd level deep, and I'd like to have this contribution push my sub-sub cats up a page by displaying the deeper 3rd level on the 2nd level page. Am I making sense? I'm half crazy so I apologize if I am being incoherent. LOL.

 

Here is my website. If you remember me, then you can see I stayed with the image maps on the front, so instead I want to show the sub-subs using browse by category.

 

I know where the code would be placed to appear this way, I just don't know if the current code will work if I just plug it in where the category pages get called. If this is way too complicated, thank you for your support and efforts anyway. I know things are always easier said than done.

Share this post


Link to post
Share on other sites

ecopeia,

 

I remember someone having a problem with 3rd-level or deeper sub-categories, but I also recall that it was fixed. It seems to me that it's best to release v2.6 before closing all open issues, specially since it's been quite a long time since I last did any code tweaking on this contribution.

 

BTW, great looking site, very lean and appealing, so you should have no problems in keeping your customers visiting the site.

 

Moving on, there are now 3 places in index.php to include the Browse by Categories module. As Ethan1701 so well pointed out, the documentation to install this module must be improved, and I intended to do that in v2.6. Please, review this thread to see the latest posts about editing the index.php. Just keep in mind that if you don't want to have the Browse by Categories module on front page then you must not follow the indications for the last include on index.php

 

Hope that helps...

 

P.S.: for some reason I didn't receive the notification about your previous post, but yes this is the active thread (although not that active at the moment).


Contributions:

. Browse by Categories

-----------------------------------------------------------

Jos? Carlos Monteiro - DoWeDo-IT

Share this post


Link to post
Share on other sites

Hey straider...I've managed to rig your contrib to look exactly as I inteded it to look! Thank you so much for the awesome contrib. I just have one quick question...is there an easy way to call sub categories to the module on the default page?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×