Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Development] Products Specifications


kymation

Recommended Posts

I have setup a price range filter, my site shows prices with tax, but the filter is working on the tax exclusive prices, I thought it was already mentioned it is working based on the choosen shop setting, or I have missed an update on my test system perhaps ?

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

Link to comment
Share on other sites

The problem with use of an & in the manufacturer's name would be tough to solve. We pass the filters as GET variables. That was my decision, made to avoid additional load on the database by looking up the name from the ID number. That would have to be done twice per page for all filters, so it's a real problem. Anyway, we can't pass &s through GET; they're a special character that would break the code. I suggest that you convert all & to and if that is possible.

 

For the subcategories, I used the standard osCommerce function tep_has_category_subcategories() to get the subcategory count. That's where the limit is. I could write a function that would recursively count all subcategories, but this will be more of a database load as well. Probably not that bad unless you have a really deep category structure, which is a bad idea anyway. Let me take a look at this.

 

Regards

Jim

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

Link to comment
Share on other sites

I have setup a price range filter, my site shows prices with tax, but the filter is working on the tax exclusive prices, I thought it was already mentioned it is working based on the choosen shop setting, or I have missed an update on my test system perhaps ?

Yes it was fixed, but not completely. Fixing the price means adding a couple of special cases to each of the filters. I assumed that Price would only be used with the Range filter, so that's the only one I fixed. If you are still having this problem with a Range filter, then I need to go find a bug.

 

Edit: I fixed the Subcategories problem. I found a workaround that won't add much of a database load to the process. Once I figure out your Price problem, I'll put u a bugfix release with both.

 

Regards

Jim

Edited by kymation

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

Link to comment
Share on other sites

The problem with use of an & in the manufacturer's name would be tough to solve. We pass the filters as GET variables. That was my decision, made to avoid additional load on the database by looking up the name from the ID number. That would have to be done twice per page for all filters, so it's a real problem. Anyway, we can't pass &s through GET; they're a special character that would break the code. I suggest that you convert all & to and if that is possible.

the & are really part of the branding, on my current site filter, I managed to get the & properly in the get variable, I'll need to check the code to see what I did to accomodate special html chars

 

EDIT: i use the rawurlencode function around the brandname

rawurlencode($facet['text'])

For the subcategories, I used the standard osCommerce function tep_has_category_subcategories() to get the subcategory count. That's where the limit is. I could write a function that would recursively count all subcategories, but this will be more of a database load as well. Probably not that bad unless you have a really deep category structure, which is a bad idea anyway. Let me take a look at this.

I understand doing it all recursively might be a very big load, also considering that this is quite static and does not change much, probably not the best thing todo with every call. I'll be changing my site categories menu upon which it might become less of an issue, as it is unlikely that someone clicks on the toplevel menu (or i might choose not to show filters for the top level, and only for the level down)

Edited by bruyndoncx

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

Link to comment
Share on other sites

Yes it was fixed, but not completely. Fixing the price means adding a couple of special cases to each of the filters. I assumed that Price would only be used with the Range filter, so that's the only one I fixed. If you are still having this problem with a Range filter, then I need to go find a bug.

I do have it setup as a range filter. Is the special code on the catalog side, or in the admin ?

On the catalog side, I have the default rc2a setup with your files on top, on the admin side, I have it integrated in my site, but I don't think I could have missed much as the proudcts_specifications.php is all new, only the categories.php is the tricky bit ...

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

Link to comment
Share on other sites

I understand the branding issue. We could get around this by using rawurlencode() to encode the filters and rawurldecode() to decode them. I need to look at this carefully to determine that we are not going to break anything.

 

Regards

Jim

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

Link to comment
Share on other sites

I do have it setup as a range filter. Is the special code on the catalog side, or in the admin ?

On the catalog side, I have the default rc2a setup with your files on top, on the admin side, I have it integrated in my site, but I don't think I could have missed much as the proudcts_specifications.php is all new, only the categories.php is the tricky bit ...

It's only on the catalog side. I just checked the code, and it looks right. I need to make some changes to my test setup s I can check this again.

 

Regards

Jim

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

Link to comment
Share on other sites

I'm also unable to duplicate the price issue. Prices are being filtered on the price + tax on my test store. Check that you have the latest version of catalog/includes/functions/products_specifications.php. Lines 441-460 should look like this:

		  $tax_rate = tep_get_tax_rate ('1');
	  $tax_multiplier = 1.0;
	  if ($tax_rate > 0) {
		$tax_multiplier += $tax_rate / 100;
	  }

	  if (strlen ($products_column_name) > 1) {
		if (count ($filters_range) < 2) { // There is only one parameter, so it is a minimum
		  if ($tax_rate > 0 && ($products_column_name == 'products_price' || $products_column_name == 'final_price') ) {
			$sql_array['where'] .= " and (" . $products_column_name . " * " . $tax_multiplier . ") > " . $filters_range[0] . " ";
		  } else {
			$sql_array['where'] .= " and " . $products_column_name . " > " . $filters_range[0] . " ";
		  }
		} else {
		  if ($tax_rate > 0 && ($products_column_name == 'products_price' || $products_column_name == 'final_price') ) {
			$sql_array['where'] .= " and ( (" . $products_column_name . " * " . $tax_multiplier . ") between " . $filters_range[0] . " and " . $filters_range[1] . ") ";
		  } else {
			$sql_array['where'] .= " and (" . $products_column_name . " between " . $filters_range[0] . " and " . $filters_range[1] . ") ";
		  }
		}

Note that this will use the store's Country and Zone IDs if the customer is not signed in. It also assumes that the Tax Class ID is 1 -- that's the stock Taxable Goods class. If you've deleted that class or are not using it, this will not work. Maybe I should add a Configuration setting for the default class?

 

Regards

Jim

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

Link to comment
Share on other sites

The Brands and Price Range filters work, and I have them also flagged for the product_comparison page, it is normal that they do not show ?

The headers for these 2 filters are shown on top.

Actually, for my test products it shows, but anywhere else on the site, it doesn't show actual content. I haven't figured it out yet, if it would show data rows when no specifications have been entered at all for the particular category.

 

 

Also for the Spec Combo - how do I enable these ? I can't get anything to show on the comparison page. I checked the user manual, but "I don't get it"

 

My comparison settings:

Products Comparison Page	  Subhead	  Informatie 
Minimum Spec Comparison 	1 	 
Comparison Link in Index 	True 	Informatie 
Comparison Row in Table 	top 	Informatie 
Show Comparison 	True 	Informatie 
Comparison in Index 	False 	Informatie 
Comparison Suffix in Header 	True 	Informatie 
Comparison Box Style 	Simple 	Informatie 
Spec Combo Manufacturer 	1 	Informatie 
Spec Combo Weight 	0 	Informatie 
Spec Combo Price 	9 	Informatie 
Spec Combo Model 	2 	Informatie 
Spec Combo Image 	1 	Informatie 
Spec Combo Name 	1 	Informatie 
Spec Combo Buy Now 	9 	Informatie

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

Link to comment
Share on other sites

I'm also unable to duplicate the price issue. Prices are being filtered on the price + tax on my test store. Check that you have the latest version of catalog/includes/functions/products_specifications.php. Lines 441-460 should look like this:

		  $tax_rate = tep_get_tax_rate ('1');
	  $tax_multiplier = 1.0;
	  if ($tax_rate > 0) {
		$tax_multiplier += $tax_rate / 100;
	  }

	  if (strlen ($products_column_name) > 1) {
		if (count ($filters_range) < 2) { // There is only one parameter, so it is a minimum
		  if ($tax_rate > 0 && ($products_column_name == 'products_price' || $products_column_name == 'final_price') ) {
			$sql_array['where'] .= " and (" . $products_column_name . " * " . $tax_multiplier . ") > " . $filters_range[0] . " ";
		  } else {
			$sql_array['where'] .= " and " . $products_column_name . " > " . $filters_range[0] . " ";
		  }
		} else {
		  if ($tax_rate > 0 && ($products_column_name == 'products_price' || $products_column_name == 'final_price') ) {
			$sql_array['where'] .= " and ( (" . $products_column_name . " * " . $tax_multiplier . ") between " . $filters_range[0] . " and " . $filters_range[1] . ") ";
		  } else {
			$sql_array['where'] .= " and (" . $products_column_name . " between " . $filters_range[0] . " and " . $filters_range[1] . ") ";
		  }
		}

Note that this will use the store's Country and Zone IDs if the customer is not signed in. It also assumes that the Tax Class ID is 1 -- that's the stock Taxable Goods class. If you've deleted that class or are not using it, this will not work. Maybe I should add a Configuration setting for the default class?

 

Regards

Jim

That explains, I have lots of tax classes in use but not the default one. Also I have effectively 2 different tax rates. 99% of items sold is the default rate (21%) but books and food is 6%. Since the site is integrated with our accounts, the tax classes also drive the classification of the goods in inventory and sales accounts ...

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

Link to comment
Share on other sites

That explains, I have lots of tax classes in use but not the default one. Also I have effectively 2 different tax rates. 99% of items sold is the default rate (21%) but books and food is 6%. Since the site is integrated with our accounts, the tax classes also drive the classification of the goods in inventory and sales accounts ...

Still it is not working, I debugged and found that the actual $products_column_name is

 

IF(s.status, s.specials_new_products_price, p.products_price)

 

not sure where the "as final_price" is lost, or where it could be added again ...

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

Link to comment
Share on other sites

The Manufacturer should show on the Comparison page. I'll take a look at that. Price Range will not show, only the Price. Range is a filter class only.

 

For the Combo column to show, you need to create a Specification and assign the Use Existing Database Field: to Combination. Also, the Sort order needs to be a different number for each entry in the Config; duplicate numbers will cause problems.

 

Trying to retrieve the tax class for each product in a large filter group would probably make the database query too slow to work. This is a huge problem for osCommerce; it really needs to have the price with tax stored in the database. I don't have a good solution to this right now.

 

Oh, and 21% tax rate? Ouch!

 

Regards

Jim

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

Link to comment
Share on other sites

The Manufacturer should show on the Comparison page. I'll take a look at that. Price Range will not show, only the Price. Range is a filter class only.

the manufacturer shows, the price range shows N/A.

 

For the Combo column to show, you need to create a Specification and assign the Use Existing Database Field: to Combination. Also, the Sort order needs to be a different number for each entry in the Config; duplicate numbers will cause problems.

OK, I can see them now. The duplicate config numbers messed it up.

 

Still, it only shows rows for the products having values in products_specifications, while I would expect it to show all products, with the brand, and combo column and any available specifications.

 

Trying to retrieve the tax class for each product in a large filter group would probably make the database query too slow to work. This is a huge problem for osCommerce; it really needs to have the price with tax stored in the database. I don't have a good solution to this right now.

there have been some tax_class optimizations to cache the taxid array, something that chemo did in the past. could be an option.

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

Link to comment
Share on other sites

this is the tax rate contribution i referred to:

http://www.oscommerce.com/community/contributions,2417

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

Link to comment
Share on other sites

the manufacturer shows, the price range shows N/A.

As expected. What did you want it to do?

 

OK, I can see them now. The duplicate config numbers messed it up.

 

Still, it only shows rows for the products having values in products_specifications, while I would expect it to show all products, with the brand, and combo column and any available specifications.

The Comparison page is intended to compare Specifications. Products with no Specifications to show would have mostly empty rows. Doesn't sound very useful to me. I supposed I could add an Admin option for this.

 

there have been some tax_class optimizations to cache the taxid array, something that chemo did in the past. could be an option.

 

This one? That only caches the tax rate calculation, not the database calls to find the tax class for each individual product. It could probably be modified to cache the additional values, but that still feels wrong. How big is the cache going to be for a store with 10,000 products? Since the cache is stored in the session, how big is that data? If the cache is stored in the database, what have you gained? I'm still looking for an answer to this one.

 

Regards

Jim

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

Link to comment
Share on other sites

As expected. What did you want it to do?
nothing else, just mentioned it to confirm it is showing the data.

 

The Comparison page is intended to compare Specifications. Products with no Specifications to show would have mostly empty rows. Doesn't sound very useful to me. I supposed I could add an Admin option for this.

I personnally like to have the same interface over the whole site. Even if it is just to compare pictures and descriptions of products.

If you hide the products without specifications, you won't see what is missing/incomplete when entering all that data ...

 

This one? That only caches the tax rate calculation, not the database calls to find the tax class for each individual product. It could probably be modified to cache the additional values, but that still feels wrong. How big is the cache going to be for a store with 10,000 products? Since the cache is stored in the session, how big is that data? If the cache is stored in the database, what have you gained? I'm still looking for an answer to this one.

You are correct. My bad.

 

Edit: please look also at post #362

Edited by bruyndoncx

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

Link to comment
Share on other sites

Still it is not working, I debugged and found that the actual $products_column_name is

 

IF(s.status, s.specials_new_products_price, p.products_price)

 

not sure where the "as final_price" is lost, or where it could be added again ...

Oops. That's right, that won't work. Let me think up a way around this one.

 

Regards

Jim

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

Link to comment
Share on other sites

Oops. That's right, that won't work. Let me think up a way around this one.

OK, fixed.

 

There remains the problem of calculating tax accurately without overloading the database. It may be possible to do the entire mess in SQL as part of the filter code. Still thinking about this one.

 

Regards

Jim

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

Link to comment
Share on other sites

Hello,

 

Has anyone got a test site where I could have a look at the filtering and comparaison functionality please? If I understand correctly, the only negative point of the filter is that you can add some but cannot remove them?

 

Thanks,

 

Greg

Link to comment
Share on other sites

The product comparison link is only available when just a category is selected, not when there are actual filters active.

I understand it is working as designed, has it been considered to extend this to basically have the comparison page working similar to the product listing module ?

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

Link to comment
Share on other sites

It's based on the Product Listing module, so the functionality is much the same. It's only linked from the Category listing page because it pulls products from the category. A version that works with an arbitrary products list has been suggested, and I plan to code that someday.

 

Regards

Jim

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

Link to comment
Share on other sites

Small cosmetic error.

 

On the filters module on top, I first have Brands pulldown, and then other filters as radio buttons and pulldowns.

I noticed that the Brands label is slightly higher up on the page than the others.

I looked at the HTML and each filter is in it's own table cell, but the Brands filter (the first cell) does not have a leading <br> while the other cells all have a leading <br>.

I'd prefer it if all leading <br> could be dropped.

 

<table border="0" width="100%" cellspacing="0" cellpadding="4" class="infoBoxContents">
 <tr>
<td><b>Brand</b><br><form name="filter" action="products_filter.php" method="get"><select name="f55" onChange="this.form.submit();"><option value="0" SELECTED>Show All<span class="filter_count"> (165)</span></option><option value="Alessi">Alessi<span class="filter_count"> (18)</span></option><option value="Beka">Beka<span class="filter_count"> (9)</span></option><option value="Demeyere">Demeyere<span class="filter_count"> (69)</span></option><option value="Fissler">Fissler<span class="filter_count"> (51)</span></option><option value="Gefu">Gefu<span class="filter_count"> (3)</span></option><option value="NSN">NSN<span class="filter_count"> (2)</span></option><option value="Silit">Silit<span class="filter_count"> (6)</span></option><option value="Spring">Spring<span class="filter_count"> (2)</span></option><option value="Staub">Staub<span class="filter_count"> (5)</span></option></select><input type="hidden" name="cPath" value="60_51"><input type="hidden" name="sort" value="4a"><noscript><input type="image" src="includes/languages/english/images/buttons/icon_next.gif" border="0" alt="Find Matching Products" title=" Find Matching Products "></noscript></form></td>

<td><br>
<b>Diameter</b><br><form name="filter" action="products_filter.php" method="get"><input type="radio" name="f58" value="24" onClick="this.form.submit();">  24 cm<span class="filter_count"> (2)</span><br>
<input type="hidden" name="cPath" value="60_51"><input type="hidden" name="sort" value="4a"><noscript><input type="image" src="includes/languages/english/images/buttons/icon_next.gif" border="0" alt="Find Matching Products" title=" Find Matching Products "></noscript></form></td>
<td><br>
<b>Price Range</b><br><form name="filter" action="products_filter.php" method="get"><select name="f53" onChange="this.form.submit();"><option value="0" SELECTED>Show All<span class="filter_count"> (165)</span></option><option value="0-1">0 -  1<span class="filter_count"> (2)</span></option><option value="1-5">1 -  5<span class="filter_count"> (2)</span></option><option value="5-10">5 -  10<span class="filter_count"> (1)</span></option><option value="15-20">15 -  20<span class="filter_count"> (1)</span></option><option value="20-30">20 -  30<span class="filter_count"> (9)</span></option><option value="30-40">30 -  40<span class="filter_count"> (3)</span></option><option value="40-50">40 -  50<span class="filter_count"> (5)</span></option><option value="50-75">50 -  75<span class="filter_count"> (11)</span></option><option value="75-100">75 -  100<span class="filter_count"> (28)</span></option><option value="100-150">100 -  150<span class="filter_count"> (42)</span></option><option value="150-200">150 -  200<span class="filter_count"> (38)</span></option><option value="200-500">200 -  500<span class="filter_count"> (23)</span></option></select><input type="hidden" name="cPath" value="60_51"><input type="hidden" name="sort" value="4a"><noscript><input type="image" src="includes/languages/english/images/buttons/icon_next.gif" border="0" alt="Find Matching Products" title=" Find Matching Products "></noscript></form></td>

<td><br>
<b>test</b><br><form name="filter" action="products_filter.php" method="get"><input type="radio" name="f57" value="0" CHECKED onClick="this.form.submit();"> Show All<span class="filter_count"> (165)</span><br>
<input type="hidden" name="cPath" value="60_51"><input type="hidden" name="sort" value="4a"><noscript><input type="image" src="includes/languages/english/images/buttons/icon_next.gif" border="0" alt="Find Matching Products" title=" Find Matching Products "></noscript></form></td>
 </tr>
</table>

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

Link to comment
Share on other sites

1) The multi-pulldown doesn't seem to be working at all on my site.

I only get to see the count of the last entry, nothing else.

Tried on the Brand filter, set the filter to multiple and display filter to multi-pulldown (shows 'multi' in the readonly preview)

 

2) I've setup a specification for diameter of cooking pots. I predefined the values to choose from.

When I edit a product from the cooking pots section without going to the tab for the specifications, it adds the first entry in the background.

Should I add an n/a option, and force the default for each limited list or is this something where the code could be improved to only detect when the value was actually changed ?

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

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...