Jump to content
kymation

[Development] Products Specifications

Recommended Posts

I just realized why I had an issue with the Get All Image. The SQL statement is not included in the products_specifications.sql file, so it isn't an option that is available in the admin configuration. I downloaded and checked the 1.0.1 and 1.0.2 versions and neither contains the sql statement.

 

Jim, can you post the proper SQL statement to install that? I'm sure it was just an oversight.

OK, this is now getting seriously weird. I remember testing this, so I'm sure it exists, but I can't find the SQL anywhere. I need to reconstruct this. Give me a bit to go look at the code.

 

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

This should work:

INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES
(NULL, 'Get All Image', 'SPECIFICATIONS_GET_ALL_IMAGE', 'get_all.gif', 'Set the name of the image to display for the all products image filter.', 1610, 255, '2010-07-15 18:46:37', '2010-07-15 18:46:45', NULL, NULL);

Sorry about the confusion, and thanks for finding a bug. I'll add this to the next release.

 

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

OK, next issue. I'm trying to get the specifications working with an existing database field, and I am having an issue getting any values to show up in either of the filter boxes (column left or subheader). Have tried manufacturer, price and retail price (my addition) columns without success.

 

For instance, I am trying to create a filter based on products_price, and setting it to filter by range. I know it's picking up the specification and trying to create the filter because I have set the minimum filter number to 0 and it shows the Show All(#) and an initial range value of $0 as a valid filter in the column_left and subheader areas. But there are no other price value showing up. I have 30+ products with various dollar amounts in a single category.

 

I need a little bit of clarification to make sure that I'm doing things correctly.

 

1) I am assuming that there doesn't need to be a specific filter value or a specification value created for the filter to show up. Is this correct?

 

2) Does there need to be a specific value entered in the "Enter Specification Values as" dropdown? I've been through several and haven't been able to get any values to show up

 

3) Is there a specific debug location that I can target a print or echo statement to try to get it to spit out the values or a clue? I have tried a few but so far I haven't been able to come up with anything specifically wrong.

 

4) Any other bit of wisdom would be appreciated. Thanks.

 

Matt

Share this post


Link to post
Share on other sites

1. No. Filter values must be explicitly specified. In the case of a price range, you need to set the Filter Type to Range and then specify the maximum value for each range in the Filter Values for that Specification.

 

2. Enter Specification Values as will be disabled if you are using an existing column, as that column already has a field set up to accept the values (as part of stock osCommerce).

 

3. There are any number of spots you can put a Print statement to view the data. It all depends on what you want to see.

 

4. Read the section of the manual on Filters again. Filter setup is complex. It may take multiple passes through the instructions to understand it. I find that it helps to read the description of a feature and then go play with that feature.

 

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

OK, I got it figured out right before your last post. I added filter ranges to the prices, and I saw that there is an option to import the manufacturers in the filters, which I didn't see documented anywhere. Seems to work well now.

 

I went back through the PDF and looked for clues as to exactly how to set up the different fields but I didn't find anything that said explicitly how to set up different scenarios. I'm dense and sometimes I need more of a clue. We definitely need to write up some example filter scenarios to help newbies. With that being said, you have produced a well documented contribution that rivals any that I have ever installed in the 10 years I have been working with OSC, (I lost count as to how many are integrated into my latest system).

 

You've done an extraordinary amount of work to get this to where it is. Maybe the rest of us can come up with a set of example scenarios to add to the docs to help you out. Lord knows I've utilized the OSC resources enough, and appreciate the work that everyone puts into this. Time to pay back.

Share this post


Link to post
Share on other sites

Any help at all will be greatly appreciated. I put a lot of time and effort into that manual, but it could certainly use a lot more. I just don't have the time to fight that battle right now. Or probably ever. So if you want to add to it, go for 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

Has anyone used this module with STS templating module? I have; installed the module as described to the "T' and nothing displays. I am trying to create a placeholder for use with sts templating on the index.php page, but I don't think it should be necessary as STS templating still uses that file.

 

Any help??

 

Thanks

Share this post


Link to post
Share on other sites

Has anyone used this module with STS templating module? I have; installed the module as described to the "T' and nothing displays. I am trying to create a placeholder for use with sts templating on the index.php page, but I don't think it should be necessary as STS templating still uses that file.

 

Any help??

 

Thanks

 

 

I ran into the same problem and as much as I always thought it was something wrong with the installation or coding, it always turned out to be my issue not having everything configured in the specifications. Meaning that the coding was always correct, but the specs, filter, or display settings were not tweeked to find products. I know this doesn't help you much, but before you dive in and start mucking in the code (like I did), go through all your admin settings and make double sure you aren't missing something.

Share this post


Link to post
Share on other sites

Jim,

 

I'm running into a problem where I have set up a "Call For Price" system in my cart. Basically, I created another column in the products table that just sets a flag, 1 or 0, to display "Call For price" for each item. I don't want those items to show up in the products filter (or filter count) when I filter based on final price or products_price. I was going through the SQL logic in catalog\includes\functions\products_specifications.php, and have tried to insert a

 

and p.products_call_for_price != '1'

 

into the 'where' statements, to no avail so far.

 

Is there some specific place you can point me to where I can place this logic where the products with no prices won't show up in the filter list? I think I may not have placed the p.products_call_for_price in the right select statement, but I'm a bit stuck as to where the columns are actually selected. I'm looking at around line 392-398, but I'm not sure.

Share this post


Link to post
Share on other sites

I ran into the same problem and as much as I always thought it was something wrong with the installation or coding, it always turned out to be my issue not having everything configured in the specifications. Meaning that the coding was always correct, but the specs, filter, or display settings were not tweeked to find products. I know this doesn't help you much, but before you dive in and start mucking in the code (like I did), go through all your admin settings and make double sure you aren't missing something.

 

Are you using this with STS Templating? I need to create a placeholder to display the product_filter box in the left hand column of my sts template. My store is http://www.stogieboys.com/store and I believe that unless I create a info box calling that file it will nt display when I have the STS Templating enabled.

 

Can anyone confirm this?

Share this post


Link to post
Share on other sites

Are you using this with STS Templating? I need to create a placeholder to display the product_filter box in the left hand column of my sts template. My store is http://www.stogieboys.com/store and I believe that unless I create a info box calling that file it will nt display when I have the STS Templating enabled.

 

Can anyone confirm this?

 

 

I am using the BTS with the infobox admin contribution. I'm not sure how STS handles the info boxes, but I did have to do some custom stuff with BTS to get the new box in the right place so the template would pick it up. But even after I had everything all set up and working "as it should have" I didn't have the Products Specs set up correctly to allow the box to actually display. This was very confusing to me at first because nothing showed up where I though it should have.

 

Have you set up any filters or specifications in admin? You must have something set up, and be in the proper category with products that fall into the filter/specification criteria otherwise the filter box will not show up at all.

 

As a test you can open up the /includes/boxes/products_filter box.php file and comment out the code that says

 

 if ($count_filters >= SPECIFICATIONS_FILTER_MINIMUM) {

and the corresponding close brace } toward the bottom of the file. At least then it will display a blank box for you so you know you have it in the right location.

Share this post


Link to post
Share on other sites

Hi guys,

 

If you use the same specs for multiple categories and have a filter in one category but no values set in another the filter will still display so to sort this out a count per category would need to be set

 

it would need to count the spec values in a category instead of just values in a spec group.

 

my thoughts would be to add table categories to the $filters_query_raw syntax

query strings are not my strong suit and have not been able to get it working

 

Al

Share this post


Link to post
Share on other sites

Excellent contribution!

Have a 'small' problem. If I filter a few products and the page is split in different pages the second, third etc. goes to:

 

products_filter.php?f4=Array&cPath=29&sort=products_name&page=2

 

The part f4=Array is wrong. it should be: products_filter.php?f4[0]=testname&cPath=29&sort=products_name&page=2

 

Is it only me with this problem?

Edited by Frisser

Share this post


Link to post
Share on other sites

The problem is with multiple checkboxes. So it you choose a checkbox the URL will be:

products_filter.php?f4[0]=name1&cPath=29&sort=6a

 

If I go to page 2 the [0] is gone and I see this: products_filter.php?f4=Array&cPath=29&sort=products_name&page=2

 

Is it not possible to change [] to () like: products_filter.php?f4(0)=name1&cPath=29&sort=6a this should work if you go to page2?

Share this post


Link to post
Share on other sites

The problem is with multiple checkboxes. So it you choose a checkbox the URL will be:

products_filter.php?f4[0]=name1&cPath=29&sort=6a

 

If I go to page 2 the [0] is gone and I see this: products_filter.php?f4=Array&cPath=29&sort=products_name&page=2

 

Is it not possible to change [] to () like: products_filter.php?f4(0)=name1&cPath=29&sort=6a this should work if you go to page2?

 

Problem solved, not really a very clean solution - but I used a pager script (so not the internal split page function). Well it works and it also looks better :)

I noticed this problem also on other sites so it's a bit of a bug.. really would be nice if it could be fixed (after 3 days I gave up and used this solution).

Share this post


Link to post
Share on other sites

Another questions guys,

 

I want to display the weight on the product info page, but not as a filter and not in the comparison page. I have set up the spec and have selected the Products Weight from the drop down. It is not displaying in the products information page along with the other specs.

 

I have a couple of questions:

Is this even possible with this feature?

If so, what would the criteria be that I need to meet to make it happen?

 

Thanks for the help.

 

Matt

Share this post


Link to post
Share on other sites

That won't work. The weight is a stock field, and there is no code for the stock fields to show up on the Product Info page, since they should already be there. You could add a separate field for weight, which means you would have to enter that value twice. You could also modify the code to allow the stock field to show up, but that's a can of worms.

 

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

That won't work. The weight is a stock field, and there is no code for the stock fields to show up on the Product Info page, since they should already be there. You could add a separate field for weight, which means you would have to enter that value twice. You could also modify the code to allow the stock field to show up, but that's a can of worms.

 

Regards

Jim

 

 

 

Thanks for the prompt reply Jim. I thought that was the answer but I miss things sometimes. I'm trying to consolidate the display of various bits if information about the products, and this system would be a great place to put it. For instance I have added UPC, ISBN, Manufacturer Part Number fields as well as the already existing fields. To bring the site up to the standards of a Grainger or Fastenal, I'll need to be able to display all of this information in a fast easy to digest manner. The dilemma I have is that my customers who admin the site see the "display on products info page" setting and are disappointed when I tell them that they can't do that.

 

Correct me if I'm wrong. In glancing at the code, I'm thinking that if I add an additional MySQL query to the /includes/modules/products_specifications.php code, which ignores the restrictions from the products_specification table, I'll be able to bring in the information from the products_column_name field, and reference that to the products_id to be able to display the info stored in the field. I'll just have to rejigger some of the if statements (and grow some talent).

 

Any thoughts?

Share this post


Link to post
Share on other sites

That code exists in the comparison page listing, so you just need to find that part and copy it.

 

I need to make some updates to this, but I've been just too busy to manage it. If I ever do, I'll add this option to the code.

 

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

Thanks for the push in the right direction.

 

I'm having another problem and I wonder if I found a bug. I have built a filter with a multi select box. Whenever I select multiple items within the same box, and submit I get the following SQL error.

 

1066 - Not unique table/alias: 'ps9'

 

select count(p.products_id) as count from (products p) join (products_to_categories p2c) on (p.products_id = p2c.products_id) left join (specials s) on (p.products_id = s.products_id) INNER JOIN products_specifications ps9 ON p.products_id = ps9.products_id INNER JOIN products_specifications ps9 ON p.products_id = ps9.products_id where p.products_status = '1' and p.products_master_status != '1' and p2c.categories_id = '140' AND ps9.specification <=> 215 AND ps9.specifications_id = '9' AND ps9.language_id = '1' AND ps9.specification <=> 245 AND ps9.specifications_id = '9' AND ps9.language_id = '1'

 

Is anyone else seeing this?

Share this post


Link to post
Share on other sites

I should clarify the previous post by saying that I have the MySQL error issue on the Filter Module or Box the public side.

Share this post


Link to post
Share on other sites

Hi Jim

This is one of the best add on for osc.

 

While I play with the contributions, by adding if ($link_data['count'] == '0') in the products_specifications.php under functions folder, so I successfully disable all manufactures which is has no products, so I can using the filter as manufacture filter.

But there are two products I getting now.

1. mysql queries increased 4 times. (Can I solve the problem by cache mysql queries and page?)

2. Other filters also only display the links spec that has product, but when some spec has no product at all the title still display. So, how can I disable title when there has no product under that title?

thank you.(sorry about my English)

ken

Edited by ken0306

Share this post


Link to post
Share on other sites

1. Yes there are a lot of queries. A large number of queries is not necessarily bad. Look at the load time instead. If your page is taking a long time to load, then look at optimizing queries or caching the output.

 

2. I don't see how there can be a filter with no products at all. Missing data? In any case, this would not be easy to change, and would add more queries to #1. Not that it's impossible, just messy.

 

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

Hi,

 

First, thanks for this great contribution.

It save me lot of time.

 

To resolve the problem for the number of queries on the database, I wrote 1 function and changed one.

 

The both, in the general.php,

The first function is to create an array of the whole categorie tree. I need it for my mega_menu.

 

The second one, it's the function tep_get_subcategories, I changed the name to tep_get_subcategories2.

 

Please find the code here after, I think it need to be improve.

 

You must add this line in your header or your filter file,

$categories_tree = tep_get_mega_menu2();

 

 

function tep_get_mega_menu2() {
global $languages_id;
$category_name_query = "select cd.categories_id, cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . (int)$languages_id . "' order by categories_id";
$category_name = tep_db_query($category_name_query);
$categories_names = array();
   while ($categories_name = tep_db_fetch_array($category_name)) {
	$categories_names[$categories_name['categories_id']] = $categories_name['categories_name'];
}
$category_tree_query =  'select root.categories_id  as root_id, down1.categories_id as down1_id, down2.categories_id as down2_id
		from categories as root
			left outer join categories as down1
				on down1.parent_id = root.categories_id
			left outer join categories as down2
				on down2.parent_id = down1.categories_id
		where root.parent_id = 0
		order by root.sort_order, down1.sort_order, down2.sort_order';
$category_tree = tep_db_query($category_tree_query);
$categories_tree = array();
while ($categories_tree_line = tep_db_fetch_array($category_tree)) {
	$categories_tree[] =  array($categories_tree_line['root_id'],$categories_tree_line['down1_id'],$categories_tree_line['down2_id']);
}

$result = array();
$rayon;
	$cat ;
	$souscat ;
foreach($categories_tree as $categories) {
	$rayon = $categories[0];
	$cat = $categories[1];
	$souscat = $categories[2];

	if (!isset($result[$rayon])) {
		$result[$rayon] = array(
									"id" => $rayon,
									"text" => $categories_names[$rayon]);
	} 

	if (isset($cat)) {
		if (!isset($result[$rayon]['subcategories'])) {	
			$result[$rayon]['subcategories'] = array();
		} 
		if (!isset($result[$rayon]['subcategories'][$cat])) {	
				$result[$rayon]['subcategories'][$cat] = array(
									"id" => $cat,
									"text" => $categories_names[$cat]);
		}
	}
	if (isset($souscat)) {
		if (!isset($result[$rayon]['subcategories'][$cat]['subcategories'])) {$result[$rayon]['subcategories'][$cat]['subcategories'] = array();}
		$result[$rayon]['subcategories'][$cat]['subcategories'][$souscat] = array(
									"id" => $souscat,
									"text" => $categories_names[$souscat]);
	}
}
 return($result);
 }


function tep_get_subcategories2($parent_id = 0) {
 global $languages_id, $categories_tree;
 $subcategories_array = array();
     foreach($categories_tree as $categories_id => $categories) {
	if ($categories_id == $parent_id) {
		foreach ($categories['subcategories'] as $subcat_id => $subcat) {
			$subcategories_array[] = $subcat_id;
			//echo '<pre>';print_r($subcat['subcategories']);echo '</pre>';
			foreach ($subcat['subcategories'] as $lastcat_id => $lastcat) {
				$subcategories_array[] = $lastcat_id;
			}
		}
	}
   }
return $subcategories_array;
 }

Share this post


Link to post
Share on other sites

Can anyone point me on my way..

 

See the attached image - I have install the add-on, works great!

 

Just need to style out the drop down menus and the heading text..

 

1. how do i change the headings (above the drop box) Font SIze / Colour? - where to find the css etc...

 

2. how can i change the look of the drop down menu? would like to have them a little smaller, and change the colour (maybe no drop down icon to the right of the box) - just "on mouse over" or "on press" it expands...

 

If anyone has any nice Ajax code for this part or some nice mods please send forth!

 

Many thanks all!

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

×