Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Products Specifications


kymation

Recommended Posts

I wish I knew what you are talking about. Where are you seeing all languages at once? What are you trying to do with this information?

 

Regards

Jim

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

Link to comment
Share on other sites

I wish I knew what you are talking about. Where are you seeing all languages at once? What are you trying to do with this information?

 

Regards

Jim

Jim, when you edit a product - you have to supply each value for each language

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

Now I understand what you are saying. It should be possible to do this with JavaScript, but I have never done it, and I don't know of anybody who has.

 

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 been troubled by this issue too, but my lists are not that long ...

 

I looked at the code and found that

1) the specification_values_id is the same for the different values in the different langues

2) this is currently not part of the product edit screen, but pretty sure that is easy to add

 

I have found a fiddle that demonstrates a javascript solution to sync radio buttons, I think using data-sync="specification_values_id" does the trick for radio buttons and probably checkboxes at the same time as a specification_values_id is specific to a specification id (stored in specification_values)

http://jsfiddle.net/cTQeJ/2/

 

So it seems pretty easy to implement this. It is after midnight here, perhaps someone else has more hours left in their day :-

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

Hmm couldn't sleep :D

 

Here is what I've done on my admin to get this working for radio buttons and checkboxes, (NOT for selection fiellds)

 

file admin/includes/modules/product_specifications_input in mine around line 80 find this section

added sv.specification_values_id to the first line

added                                                     'data-sync' => $values_data['specification_values_id'], to the values_select_array

 

              $values_query_raw = "select svd.specification_value, sv.specification_values_id
                                   from " . TABLE_SPECIFICATIONS_VALUES . " sv,
                                        " . TABLE_SPECIFICATIONS_VALUES_DESCRIPTION . " svd
                                   where svd.specification_values_id = sv.specification_values_id
                                     and sv.specifications_id = '" . $id . "'
                                     and svd.language_id = '" . (int) $languages[$i]['id'] . "'
                                   order by sv.value_sort_order,
                                            svd.specification_value
                                 ";  
              // print $values_query_raw . "<br>\n";
              $values_query = tep_db_query ($values_query_raw);

              $values_select_array = array();
              if (tep_db_num_rows ($values_query) > 0) {
                
                while ($values_data = tep_db_fetch_array ($values_query) ) {
                  if ($values_data['specification_value'] != '') {
                    $values_select_array[] = array ('id' => $values_data['specification_value'],
                                                    'data-sync' => $values_data['specification_values_id'],
                                                    'text' => $values_data['specification_value']
                                                   );
                  }
                } //  while ($values_data
            
                echo tep_get_values_menu ($enter_values, $values_select_array, 'products_specification[' . $id . '][' . $languages[$i]['id'] . ']', $products_specification);

 

Next change the tep_get_values_menu to output the data-sync attribute

file admin/includes/functions/products_specifications

 

I'm assuming that this won't have any side effects, if it does have side effects another function needs to be created and called in the above code block.

 

the default radio field and checkbox functions won't work, so explicitly spelled out what it needs to be, so the changes are only in the section just below the commented out tep_draw lines

 

      case 'radio':
        foreach ($values_select_array as $value) {
          $checked = ($value['id'] == $specification_value) ? true : false;
//          $box_text .= tep_draw_radio_field ($specification_name, $value['id'], $checked) . ' ' . $value['text'];
          $box_text .= '<input type="radio" name="' . tep_output_string($specification_name) . '"';
          if (tep_not_null($value['id'])) $box_text .= ' value="' . tep_output_string($value['id']) . '"';
          if (tep_not_null($value['data-sync'])) $box_text .= ' data-sync="' . tep_output_string($value['data-sync']) . '"';
          if($checked == true) $box_text .= ' checked="checked"';

          $box_text .=  '> ' . $value['text'].'<br>' . "\n";
        }
        break;

 

 

      case 'checkbox':
        $checkbox_id = 0;
        foreach ($values_select_array as $value) {
          $checked = false;
          if (is_array ($specification_value) ) {
            foreach ($specification_value as $spec) {
              if ($spec['id'] == $value['id']) {
                $checked = true;
                break;
              }
            }
          } else {
            $checked = ($value['id'] == $specification_value[$checkbox_id] ) ? true : false;
          } // if (is_array ... else ...
            
//          $box_text .= tep_draw_checkbox_field ($specification_name . '[' . $checkbox_id . ']', $value['id'], $checked) . ' ' . $value['text'];
          $box_text .= '<input type="checkbox" name="' . tep_output_string($specification_name. '[' . $checkbox_id . ']') . '"';
          if (tep_not_null($value['id'])) $box_text .= ' value="' . tep_output_string($value['id']) . '"';
          if (tep_not_null($value['data-sync'])) $box_text .= ' data-sync="' . tep_output_string($value['data-sync']) . '"';
          if($checked == true) $box_text .= ' checked="checked"';

          $box_text .=  '> ' . $value['text'].'<br>' . "\n";
          $checkbox_id++;
        } // foreach ($values_select_array
        break;

 

lastly, add the javascript in the admin/categories.php

I added it just below the call for inclusion of the products_specifications_input file

 

<?php          
// Products Specifications
      require (DIR_WS_MODULES . FILENAME_PRODUCTS_SPECIFICATIONS_INPUT);
?>

<script>
var $radios = $('input[type=radio][data-sync]');
$radios.change(function() {
    $radios.filter('[data-sync="' + $(this).attr('data-sync') + '"]').attr('checked', true);
});
var $checks = $('input[type=checkbox][data-sync]');
$checks.change(function() {
    $checks.filter('[data-sync="' + $(this).attr('data-sync') + '"]').attr('checked', $(this).attr('checked'));
});
</script>

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

First of all: Im very impressed, that you both take care of my problems so quickly  :thumbsup:  :D

 

At second goes the biggest THANK YOU to Carine (Ive robbed her sleep  o:) )

 

With your code you save me a lot of time ! Maybe it really was too late yesterday... I found a little mistake in the script in admin/categories.php:

<script>
var $radios = $('input[type=radio][data-sync]');
$radios.change(function() {
    $radios.filter('[data-sync="' + $(this).attr('data-sync') + '"]').prop('checked', true);
});
var $checks = $('input[type=checkbox][data-sync]');
$checks.change(function() {
    $checks.filter('[data-sync="' + $(this).attr('data-sync') + '"]').prop('checked', $(this).prop('checked'));
});
</script> 

With this corrections it did exactly what I want   (w00t)  :thumbsup: Once again: Thank you very much !

 

SEE YA !

 

Denzel.

Link to comment
Share on other sites

I'm not sure about the mistake, when I used prop my debugger complained. Not 100% sure on how/what exactly when to use prop vs attr - tricky one.

I changed to attr and it worked, so I was happy about it :)

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

Hi Carine !

 

With attr in the sourcecode only the radiobuttons changed once together. But nothing other happened. So I changed to prop and everything goes :D Maybe the php version is interessting for this issue ? Got 5.3.15 on my server.

 

SEE YA !

 

Denzel. 

Link to comment
Share on other sites

  • 3 weeks later...

Hello, I have a question.

 

I applied a filter named "Generation" to the category Processors (CPU)

 

The values are intel i3 / intel i5 / intel i7

 

When i go to the backend to edit a CPU product i can see the filter drop down with i3 selected by default.

 

is there a way to leave a product with Null value ? because not all processors belong to i3 or i5 or i7

 

I modified the files admin/includes/modules/products_specifications_input.php

 

I added under

if ($values_data['specification_value'] != '') {

this line

$values_select_array[0] = array('id' => '0', 'text' => 'None');

Seems working fine.

Now by default, I have 'None' as a first option in the backend, without any changes in the front end.

 

But i need the author advice, I'm afraid this will lead to some problems. Do you think this is safe ?

Link to comment
Share on other sites

  • 3 weeks later...

Hi @kymation,

thanks for this great addon. As you can see i have some problems with your addon. The specifications don't show in the bm_products_filter.php and the products_filter.php.
In the backendarea and in the productsite everything ist fine.
Please take a look at my sites:
http://www.erotikshop-liebe.de/products_filter.php?cPath=10&sort=products_name(on the top and in the box no specifications are showing)
and
http://www.erotikshop-liebe.de/testkategorie(on the top and in the box no specifications are showing)
and
http://www.erotikshop-liebe.de/testkategorie/analzapfen.html(on products-site under "Merkmale" you will see my specifications)
The box is only showing after setting the "Minimum Spec Filter" to value 0.
I hope you know this problem because i need urgently the "specification-function".
PHP-Version: 5.6.10, MySQL-Version: 5.5, Oscommerce: 2.3.4, Products Specification-Addon: 1.1.11 without "products tabs-function"
Many thanks

Edited by volupp
Link to comment
Share on other sites

must be something todo with your products if the backside works and the front doesn't (w00t)  - WAD (WorkingAsDesigned)

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 sounds like you don't have any products that meet the filter criteria. Check that you have products in that category and that the values for the Specifications are filled in for those products.

 

Regards

Jim

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

Link to comment
Share on other sites

At least some of those filters should work. For example, your price filter: do you have the Price specification linked to the existing Final Price field? It needs that link to find products to match the filter criteria.

 

Regards

Jim

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

Link to comment
Share on other sites

Hi Jim,

now i checked the functions of our great addon. I forgot to set the filters. :-
I have only one last question:
The counter in the box and on the top are differently. Do you have any ideas?

 

Edited by volupp
Link to comment
Share on other sites

  • 2 months later...

The filter works great - but only if I select 5 options (colour blue, size XXL, brande Y etc.), if I select a 6th selection it becomes very slow (high load on my MySQL server). It's always the 6th (and later off course). I've tried to optimize the code (not really necessary) but can't find why the sixth selection (and later) is a problem. Anyone any idea why this is? 

Link to comment
Share on other sites

All filters place an extra load on the database server, since they create the need for a temporary table. The more filters you add, the worse the load. The number of products will also increase the size of the temp table. I'm going to guess that the load of six filters is hitting a limit on your database server; probably a memory limit. If I'm right, only increasing the memory available to the database process will help.

 

I've used filters on various websites many times, and I can't remember ever using more that 2 or 3. I doubt very many customers are going to bother to set 6.

 

Regards

Jim

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

Link to comment
Share on other sites

I managed to set 8 with no difference in time. But my result set has become small along the way

http://www.keukenlust.be<<remove these spaces> /products_filter.php?cPath=60_51_250&f60=Fissler&sort=3&f167=Original%20Pro%20Collection&f58=20-24&f59=Inductie&f78=Kookpot&f170=25-50&f53=150-200&f95=3-4.5

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

  • 4 months later...

I have question regarding filter by price (high to low and low to high). I want make the price filter connected with current filter that i have input in database so every filter depand one with another.


Let say i choose filter by colour and in colour filter, it's can filter by price (high to low and low to high).


Do it's possible to create directly in admin panel? Current i only think it's possible via range ($0 - $100 and so on). Thanks.

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