Jump to content

Archived

This topic is now archived and is closed to further replies.

burt

Open discussion on Better Navigation and Categories

Recommended Posts

From what I recall (I haven't worked in 2.4 for some time), 2.4 has a unordered list for the category system (it might have been that I was looking at a development version rather than a public version). Could someone who has a 2.4 installed check for me ?

 

If that is the case, then we could backport the code changes into the 2.3 heirarchy, no ?


Help shape the future of Phoenix; join the Phoenix Club

Share this post


Link to post
Share on other sites

From what I recall (I haven't worked in 2.4 for some time), 2.4 has a unordered list for the category system (it might have been that I was looking at a development version rather than a public version). Could someone who has a 2.4 installed check for me ?

 

If that is the case, then we could backport the code changes into the 2.3 heirarchy, no ?

Yes, in 2.4 it is a bm_categories using categories_tree class

https://github.com/osCommerce/oscommerce2/blob/24/includes/classes/category_tree.php

 

Not sure if you would extend classes or use somekind of config switches to create the required html/css output


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites

One more idea: While identical subcategories in multiple categories is possible in osCommerce, the subcategory has to be created separately and then populated, which is a huge pain. Can we modify the category structure to allow a category to link to multiple parent categories? This would help a lot in accomplishing #2 on that list.

So you would need a categories_to_categories table, and then decide if you remove the parent_id from the categories table and use the categories_to_categories table all the time, or if you just use categories_to_categories to create addtional parents for a particular category (with a kind of config switch in the admin) so you know in code if it you need to check for entries in that table or not.


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites

You would need a separate table for the category-to-parent relations. This needs to replace the current parent_id column. This is not that hard to do, but it will break all sorts of things, so probably needs to go in osC 2.4.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Ah yeah, I recall now the 2.4 system - I think it only writes the subcategories when required, what we need is to write everything at all times, ready for styling.


Help shape the future of Phoenix; join the Phoenix Club

Share this post


Link to post
Share on other sites

i know that osC has a filter/sort function inside the header of the product listing like, sort by name or price.

why not add "grid/list view" "15, 20, 50, 100 products per page" and a dropdwon that includes "Name A-Z", "Name Z-A", "Price low > high", "Price high > low", "Rating highest", "Rating lowest" something like that. and would be great to have the ability to switch these functions on/off in the admin area.

why not give the customer the freedom of choosing how to browse through your store? i sometimes encounter shops that have over 300 items in 1 category but only show 20 products per page, which is very inconvenient to browse with over 15 pages.

 

is this not recommended to have in a store by default? or is it a coding issue?

Share this post


Link to post
Share on other sites

Sure that's a possibility - but I can't do this all alone...

 

If you can put the code together (even if it's not "nice" code), a developer can then clean it up and we can go from there.


Help shape the future of Phoenix; join the Phoenix Club

Share this post


Link to post
Share on other sites

i'm not a coder nor do i have the skill to accomplish something like that. my copy & paste skill is outstanding though. :blush:

still, i'm willing to give it at least a try even if the chances to make it are small.

people like you, or few others in this forum, are gifted with outstanding coding skills and could probably do it within a couple of minutes or hour(s).

 

do you remember? :-

 

...as I am plugged into the grid a bit like Neo.

 

IF, and thats a big if, i should be successfull i'll let you know.

Share this post


Link to post
Share on other sites

I (and a handful of others) already give enough time, it's time for others to step up.

 

please, don't missunderstand burt. i don't mean YOU or others should do it "alone". i was more admiring your skill set, that you "could" accomplish something like that in a short period of time.

you as a skilled coder "could be" a guide to achieve that goal.

 

a more positive answer could have been

great idea, maybe we could use the code
xxxxx

from the index.php and modified to do that.

 

and like i said i'll gladly give it a try, in fact i was already trying and i could be more motivated if you could give me a hint or be a guide to achieve that.

if you don't have the time to be such a guide or give a hint, that's absolutely fine.

Share this post


Link to post
Share on other sites

the suggested functionality exists in different contributions. I have used parts of these contributions on my site at one time or another, but currently I don't allow switching layout.

There is a contribution that enhances the sorting

There is a contribution that allows to change products per page

I think the difficult bit is that the product listing module is not used on all pages consistently, so you have to implement it on what's new, specials, advanced search results and index pages.


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites

the suggested functionality exists in different contributions. I have used parts of these contributions on my site at one time or another, but currently I don't allow switching layout.

There is a contribution that enhances the sorting

There is a contribution that allows to change products per page

I think the difficult bit is that the product listing module is not used on all pages consistently, so you have to implement it on what's new, specials, advanced search results and index pages.

 

the last couple days i searched and installed various add-ons that have some of these sorting/filtering functions.

most of the add-ons are pure overkill that offer more than i need. i picked appart the add-ons and took the pieces i needed. i could install successfully a max page dropdown but as you mentioned the specials.php and products_new.php don't have the same layout as the product_listing.php or advanced_search_result.php so i search around and found this.

 

http://forums.oscommerce.com/topic/393668-product-listing-proposal/#entry1675345

 

thank you burt! because of these 2 files the max products per page dropdown shows on all pages and it seems to work good so far.

these files definitely should be standart osC! looks lot better and probably easier to add a grid/list function later.

*optional*

i did a bit of modding my self and added a couple of new fields inside the database (2 new configure_group and couple new fields inside configure) and customized the two new files and duplicated the product_listing.php file "twice" for each (burt).php file one new listing.php so that i can setup up everything from the admin area like the original Product Listing Setting. Now i can choose if i want to have an Image or Model No. (or anything else showing up) individually in specials.php and products_new.php.

*/optional*

 

i also found a, IMO, "good" sorting/filter dropdown and implemented that successfull inside the "normal" product listing. well, inside the index.php to be exact. but as bruyndoncx said the difficult bit is to implement that filter inside the specials, products_new and advanced_search_result files. even with burts new files i have trouble installing that filter dropdown.

 

i haven't looked at the grid/list switching function yet but i think this might be possible using javascript. i will check that out as soon i get that filter running (or not running).

 

here is the code for the filter inside the index.php ( just before include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); )

if (PRODUCT_LIST_ADDITIONAL_FILTER > 0) {

if (isset($HTTP_GET_VARS['manufacturers_id']) && !empty($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 '<div>' . tep_draw_form('sort', FILENAME_DEFAULT, 'get') . '<p align="right">' . TEXT_SORT . ' ';

 if (isset($HTTP_GET_VARS['manufacturers_id']) && !empty($HTTP_GET_VARS['manufacturers_id'])) {
	 echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']);
 } else {
	 echo tep_draw_hidden_field('cPath', $cPath);
 }

 $sort_list = array('3a' => SORT_NAME_A_Z,
					 '3d' => SORT_NAME_Z_A,
					 '4a' => SORT_PRICE_L_H,
					 '4d' => SORT_PRICE_H_L,
'1a' => SORT_MODEL_A_Z,
'1d' => SORT_MODEL_Z_A);

 foreach($sort_list as $id=>$text) {
 $sort_range[] = array('id' => $id, 'text' => $text);
 }

 echo tep_draw_pull_down_menu('sort', $sort_range, (isset($HTTP_GET_VARS['sort']) ? $HTTP_GET_VARS['sort'] : ''), 'onchange="this.form.submit()"');
 echo tep_draw_hidden_field('filter_id', (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''));
 echo '</p></form></div>' . "\n";
 }
}

 

the values 1a, 1d, 3a, 3d,.....have to be adjusted to the sorting that you selected in the admin area.

if the product name is set to 2 you have to set the filter to 2a, 2d to be able to sort by name. "a" stands for "ASC" and "d" stands for "DESC" the SORT_XXX Text has to be added inside the languages/*your language*/index.php

 

for the PRODUCT_LIST_ADDITIONAL_FILTER you have to add a field inside the configure table.

i just copied the manufacturer/categories field renamed it to PRODUCT_LIST_ADDITIONAL_FILTER and gave it a new sort id.

 

for the max products per page i used following piece of code.

if (!tep_session_is_registered('max_products_per_page')) tep_session_register('max_products_per_page');
if (!isset($max_products_per_page) || !is_integer($max_products_per_page) || ($max_products_per_page < 1)) $max_products_per_page = MAX_DISPLAY_SEARCH_RESULTS;
if (isset($HTTP_GET_VARS['mppp']) && is_numeric($HTTP_GET_VARS['mppp']) && ($HTTP_GET_VARS['mppp'] > 0)) $max_products_per_page = intval($HTTP_GET_VARS['mppp']);
$mppp_list = array();
for ($i = 1; $i <= 5; $i += 1) {
$mppp = intval($i * MAX_DISPLAY_SEARCH_RESULTS);
$mppp_list[] = array('id' => $mppp, 'text' => $mppp);
}
$mppp_list[] = array('id' => 9999999, 'text' => TEXT_ALL_ITEMS);
$gvhf = '';
$ignore = array('page', 'mppp');
if (is_array($HTTP_GET_VARS) && (sizeof($HTTP_GET_VARS) > 0)) {
reset($HTTP_GET_VARS);
while (list($key, $value) = each($HTTP_GET_VARS)) {
 if ( (strlen($value) > 0) && ($key != tep_session_name()) && (!in_array($key, $ignore)) ) {
 $gvhf .= tep_draw_hidden_field($key, $value);
 }
}
}
$maxpppform = TEXT_MPPP . tep_draw_form('prod_per_page', basename($PHP_SELF), 'get') . $gvhf . tep_draw_pull_down_menu('mppp', $mppp_list, $max_products_per_page, 'class="smallText" onchange="this.form.submit()"') . '</form>';
$listing_split = new splitPageResults($listing_sql, $max_products_per_page, 'p.products_id');

 

add this inside the product_listing.php between the firs <?php and ?>

above <div class="contentText"> add

<div align="right">

<span><?php echo $maxpppform; ?></span>

</div>

 

i think that's it.

i would appreciate if somebody could help me out with the filter function for specials.php (burt version) and products_new.php (burt version). i think it's a query thing and i'm not so good with query stuff.

Share this post


Link to post
Share on other sites

I thought in a standard install of oscommerce you can sort the columns by clicking on the header title, or at least mine does, and I dont think I have added anything extra. Does this mean that someone is trying to code something that is already there, or just trying to improve something that is already there.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

@@Tsimi

@@14steve14

 

Hi,

 

No a standard install will just include the manufactures sort option.

 

So great work Tsimi hope you get there what you are trying to do.

 

I know you are trying to include a grid / list option which is a complicated bit of coding so :thumbsup:

 

standard looks like this


To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

@@14steve14 is right -- the standard install of osCommerce includes the ability to sort on (most of) the columns using the column heading. See that + after Product Name in the above image? That means that clicking on that heading will reverse the sort order. Manufacturers is a separate pulldown because that's not a column.

 

However, the stock table is a rather dated look. Using a single pulldown to sort would be an improvement. Just don't go reinventing the wheel to do it.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

@@kymation

I just went and checked on the oscommerce test site, and it did sort, on most of the headings. I also didnt think that I had altered anything in that part of my new store, but could not remember.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

@@kymation

I just went and checked on the oscommerce test site, and it did sort, on most of the headings. I also didnt think that I had altered anything in that part of my new store, but could not remember.

 

Yes forgot about the plus sign sorry correct


To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

@@Steve

i know that osC has a filter/sort function inside the header of the product listing like, sort by name or price.

why not add "grid/list view" "15, 20, 50, 100 products per page" and a dropdwon that includes "Name A-Z", "Name Z-A", "Price low > high", "Price high > low", "Rating highest", "Rating lowest" something like that. and would be great to have the ability to switch these functions on/off in the admin area.

why not give the customer the freedom of choosing how to browse through your store? i sometimes encounter shops that have over 300 items in 1 category but only show 20 products per page, which is very inconvenient to browse with over 15 pages.

 

is this not recommended to have in a store by default? or is it a coding issue?

 

i don't try to reinvent anything here, there is no need for that. there are two reasons why i want to do what i do.

1. i'd would look terrible using the standart header if you have a grid view or a grid/list switch.

2. no offense to the creators of that header but back in the 2.2ms2 days it took me and some people (even today) alot of time to even realize that there IS a sorting function in standart osC (by just clicking on "Products Name+" or "Price+") maybe write something like "sort by:" would help to see it better, i don't know. and to be honest i don't like the looks of that header. i will take that away in future, so a listing without header if you will.

 

btw. while i was searching in google for a solution i found alot topics from other osC forks and it seems like they solved these "dropdown filter" and "grid/list" and "max products per page" problem a long, long time ago. like i said in my opinion these 3 things should be standart osC from the beginning and not just add-ons.

but i'm not a coder so i don't have the skill to decide which code is "clean" to be worth to be implemented in standart osC by the developers.

right now i'm just playing around with various codes trying to find a solution to reach my goal.

 

@@joli1811

 

thank you! for your kind words. :thumbsup:

Share this post


Link to post
Share on other sites

found this interesting topic

 

http://forums.oscommerce.com/topic/387930-off-filter-box-or-sort-by-discount/

 

@@burt

 

is it possible to have a look at your piece of code that generates that filter?

 

here is something else i'm working at if i find time in between normal family life and sorting filter problem.

kind a "mega menu" that shows all or most categories. the superfish vertical box on the left is kymations work (very well done btw. :thumbsup: ). i just

restyled it a bit to much the original osC theme.

Share this post


Link to post
Share on other sites

regarding the header in the product_listing.php.

i added a additional setting field and edited a bit the product_listing file.

now the header can be switch on and off through admin -> configuration -> product listing. see attached pictures below.

Share this post


Link to post
Share on other sites

here is something else i'm working at if i find time in between normal family life and sorting filter problem.

kind a "mega menu" that shows all or most categories. the superfish vertical box on the left is kymations work (very well done btw. :thumbsup: ). i just

restyled it a bit to much the original osC theme.

 

Seems to me that the mega menu concept, in many cases, would be a much more user friendly menu i.e. all categories visible in one action by the visitor rather than having to click through several levels. Usefulness would depend on the stores product composition but overall I think a big plus.


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

I've been messing with the product_listing in regards to list/grid views. I have converted it from tables to a <ul></ul> structure. Almost all of the original code stays intact and this is all possible with a little javascript, some additions to your stylesheet, and a few new defines. New styles could be added at your discretion.

 

demo: http://bettercheckout.com/index.php?cPath=3_10


Matt

Share this post


Link to post
Share on other sites

I also wanted to get a filter for options and attributes, so when a person is looking at the list, they can say "show me only size large" (assuming you had size: large as a option/attribute).

 

Here's some code to add to /includes/modules/product_listing.php which grabs the available options for those products in the category being looked at. Can someone take this on and extend it so that when the link is clicked on the page reloads with only those products that are "large" (for example).

 

$products_attributes_query = tep_db_query("SELECT count(*) as total FROM " . TABLE_PRODUCTS_ATTRIBUTES . " WHERE products_id IN (SELECT * FROM (select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "' GROUP BY products_id) AS subquery)");
 $products_attributes = tep_db_fetch_array($products_attributes_query);
 if ($products_attributes['total'] > 0) {
   $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' AND patrib.products_id IN (SELECT * FROM (select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "' GROUP BY products_id) AS subquery) order by popt.products_options_name");

   while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
     $products_options_array = array();
     $products_options_query = tep_db_query("select DISTINCT pov.products_options_values_id, pov.products_options_values_name from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' AND pa.products_id IN (SELECT * FROM (select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "' GROUP BY products_id) AS subquery)");

     while ($products_options = tep_db_fetch_array($products_options_query)) {
       $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
     }
     ?>
     <ul class="attribute_filter">
       <li class="attribute_first"><?php echo $products_options_name['products_options_name'] . ':'; ?></li><?php
         foreach ($products_options_array as $k => $v) {
           echo '<li><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('attrib_id')) . 'attrib_id=' . (int)$v['id']) . '">' . $v['text'] . '</a></li>';
         }
         ?>
     </ul>
     <?php
   }
 }

 

Add that right above

$prod_list_contents = '<div class="ui-widget infoBoxContainer">' . 


Help shape the future of Phoenix; join the Phoenix Club

Share this post


Link to post
Share on other sites

×