Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Development] Products Specifications


kymation

Recommended Posts

While implementing products specifications, creating a filter of class "multiple" with "Display the filter as:" set to checkbox works fine.

However, another filter of class "multiple" has "Display the filter as:" set to multiimage. It does not work.

 

The first filter (with the checkboxes) passes the selected checkboxes via GET in the form f58[1]=16&f58[2]=20&f58[3]=24.

The second filter (with multiimage) passes the selected checkboxes via GET in the form &f59=ceran.gif&f59=elektro.gif&f59=gas.gif. This does not work, as GET will only accept a single value for f59 (so the php-application can only see the last of the selected options).

 

Any ideas?

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 Jim,

 

Sorry I thought I had upgraded all to the latest release.

 

Thanks

 

James

 

Hi Jim,

 

I have now got the admin screens all working and everything works fine in the categorie file except that the values are not being added into the database. Do you know if there is a statement wrong somewhere?

 

I can post parts of my categorie file if you so wish.

 

James

Link to comment
Share on other sites

That's a bug. In catalog/admin/includes/functions/products_specifications, change the multiimage case (line 401ff) to the following:

      case 'multiimage':
       $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 ...

         if ($value['id'] == '0') {
           $value['id'] = SPECIFICATIONS_GET_ALL_IMAGE;
           $value['text'] = SPECIFICATIONS_GET_ALL_IMAGE;
         }
         $box_text .= '<span class=image_box>';
         $box_text .= tep_draw_checkbox_field ($specification_name . '[' . $checkbox_id . ']', $value['id'], $checked);
         $box_text .= '  ' . tep_image (DIR_WS_CATALOG_IMAGES . $value['text'], $value['text'], SPECIFICATIONS_FILTER_IMAGE_WIDTH, SPECIFICATIONS_FILTER_IMAGE_HEIGHT, ' class="image_filter"');
         $box_text .= '</span>' . "\n";
         $checkbox_id++;
       }
       break;

In catalog/includes/functions/products_specifications.php, change the multiimage case (lines 698ff) to the following:

      case 'multiimage':
       $box_text .= tep_draw_form('filter', $target, 'get');
       foreach ($filters_select_array as $filter) {
         $checked = ($filter['id'] == $filter_value[$checkbox_id]) ? true : false;
         $box_text .= tep_draw_checkbox_field($filter_name . '[' . $checkbox_id . ']', $filter['id'], $checked);
         $box_text .= '  ' . tep_image(DIR_WS_IMAGES . $filter['text'], $filter['text'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . "\n";
         $box_text .= '<br>' . "\n";
         $checkbox_id++;
       }
       $box_text .= $additional_variables . tep_hide_session_id();
       $box_text .= tep_image_submit('icon_next.gif', TEXT_FIND_PRODUCTS);
       $box_text .= '</form>';
       break;

 

Thanks for the bug report. I haven't had time to test this yet, so typos are possible.

 

Regards

Jim

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

Link to comment
Share on other sites

James -- You probably missed something in the top part of that file. Check the insert/update case for the values that you are missing.

 

Regards

Jim

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

Link to comment
Share on other sites

James -- You probably missed something in the top part of that file. Check the insert/update case for the values that you are missing.

 

Regards

Jim

 

Hi Jim,

 

Fixed it! I forgot to add the last query! Sorry to bother you.

 

 

James

Link to comment
Share on other sites

That's a bug. In catalog/admin/includes/functions/products_specifications, change the multiimage case (line 401ff) to the following:

      case 'multiimage':
       $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 ...

         if ($value['id'] == '0') {
           $value['id'] = SPECIFICATIONS_GET_ALL_IMAGE;
           $value['text'] = SPECIFICATIONS_GET_ALL_IMAGE;
         }
         $box_text .= '<span class=image_box>';
         $box_text .= tep_draw_checkbox_field ($specification_name . '[' . $checkbox_id . ']', $value['id'], $checked);
         $box_text .= '  ' . tep_image (DIR_WS_CATALOG_IMAGES . $value['text'], $value['text'], SPECIFICATIONS_FILTER_IMAGE_WIDTH, SPECIFICATIONS_FILTER_IMAGE_HEIGHT, ' class="image_filter"');
         $box_text .= '</span>' . "\n";
         $checkbox_id++;
       }
       break;

In catalog/includes/functions/products_specifications.php, change the multiimage case (lines 698ff) to the following:

      case 'multiimage':
       $box_text .= tep_draw_form('filter', $target, 'get');
       foreach ($filters_select_array as $filter) {
         $checked = ($filter['id'] == $filter_value[$checkbox_id]) ? true : false;
         $box_text .= tep_draw_checkbox_field($filter_name . '[' . $checkbox_id . ']', $filter['id'], $checked);
         $box_text .= '  ' . tep_image(DIR_WS_IMAGES . $filter['text'], $filter['text'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . "\n";
         $box_text .= '<br>' . "\n";
         $checkbox_id++;
       }
       $box_text .= $additional_variables . tep_hide_session_id();
       $box_text .= tep_image_submit('icon_next.gif', TEXT_FIND_PRODUCTS);
       $box_text .= '</form>';
       break;

 

Thanks for the bug report. I haven't had time to test this yet, so typos are possible.

 

Regards

Jim

Thanks the fix is working, though my catalog/includes/functions/products_specifications.php, has about 50 lines less than yours it seems ...

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

FYI when generating a list of links, e.g. for price ranges, non-existing ranges in the result set caused indentation of the list, so I changed the function to not generate the leading blanks. Seems to work fine for me. I havent found any situation where these   are needed

 

includes/functions/products_specifications.php

  function tep_draw_links_menu ($name, $values, $target, $default = '') {
   $field = '';

   foreach ($values as $link_data) {

//      $field .= '  ';

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

Another issue which is seen with multi-image, (generating a blank for the image filename) is solved by changing the catalog/includes/modules/products_filter.php around line 112 to only add the space when there actually is a prefix or suffix

        if ($specs_array['products_column_name'] == 'products_price') {
           $previous_filter = $currencies->format ($previous_filter);
           $filter_text = $currencies->format ($filters_array['filter']);
         } else {
	    $filter_text = $filters_array['filter'];
	    if(!empty($specs_array['specification_prefix']))
              $filter_text = $specs_array['specification_prefix'] . ' ' . $filter_text;
                   if(!empty($specs_array['specification_suffix']))
                     $filter_text = $filter_text . ' ' . $specs_array['specification_suffix'];
         }

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

I have in catalog/includes/modules/products_filter.php the following code around line 143

       if ($specs_array['filter_class'] == 'range') {
         if ($specs_array['products_column_name'] == 'products_price') {
           $previous_filter = $currencies->format ($previous_filter);
         }

 

on the admin side I actually setup the price range filter with the 'final_price', I suspect this also needs to be included here.

Can you please confirm and know of other areas where similar change might be needed ?

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, final_price should be in there as well. I can't think of any other place that would be needed that is not already included. Thanks for the reports on the other updates; I'll take a look as soon as I have some time.

 

Regards

Jim

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

Link to comment
Share on other sites

Another issue which is seen with multi-image, (generating a blank for the image filename) is solved by changing the catalog/includes/modules/products_filter.php around line 112 to only add the space when there actually is a prefix or suffix

        if ($specs_array['products_column_name'] == 'products_price') {
           $previous_filter = $currencies->format ($previous_filter);
           $filter_text = $currencies->format ($filters_array['filter']);
         } else {
	    $filter_text = $filters_array['filter'];
	    if(!empty($specs_array['specification_prefix']))
              $filter_text = $specs_array['specification_prefix'] . ' ' . $filter_text;
                   if(!empty($specs_array['specification_suffix']))
                     $filter_text = $filter_text . ' ' . $specs_array['specification_suffix'];
         }

Please ignore, this is solved in v1.01 .

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

fix for v1.01 display of images on the product info page:

change display to filter_display,

change enter to enter_values

append the output of tep_image to the specification_text

 

catalog/includes/modules/products_specifications.php around line 69

       $specification_text .= $specifications['specification_prefix'] . ' ';
       //CB fix  for v1.01                    
       //       if ($specifications['display'] == 'image' || $specifications['display'] == 'multiimage' || $specifications['enter'] == 'image' || $specifications['enter'] == 'multiimage') { 
       if ($specifications['filter_display'] == 'image' || $specifications['filter_display'] == 'multiimage' || $specifications['enter_values'] == 'image' || $specifications['enter_values'] == 'multiimage') { 
         //  tep_image (DIR_WS_IMAGES . $specifications['specification'], $specifications['specification_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
         $specification_text .= tep_image (DIR_WS_IMAGES . $specifications['specification'], $specifications['specification_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
       } else {
         $specification_text .= $specifications['specification'] . ' ';
       }

       $specification_text .= $specifications['specification_suffix'];

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 Jim,

 

My admin screens work fine and dandy now and I have today completed the catalog side.

 

I have input some test data into two products and the specifications are linked to a category but when I got to check in the product listing I am not given a choice to filter. The product filters module is loaded but no filters appear. I have checked to ensure they are shown as on which they are. Therefore I am at a bit of a dead end again.

 

Do you have any ideas?

 

James

Link to comment
Share on other sites

Did you set the values for the filters?

 

Regards

Jim

 

 

Yes I did set up values for the filters.

 

For example I have a group called home safes which is applied to the home safe category and also sub's.

 

Then under that I have colour, cash rating and lock type. Under each of those I have set up values.

 

Can you confirm it is the correct way of doing it? If so do you have any ideas why it would not work?

 

 

Many thanks

 

James

Edited by jamesblackburn
Link to comment
Share on other sites

I have no idea. If you have filter values, and the matching values for the products, then the filters should work. Well, if you have one of the filter modules set to appear on the page they will.

 

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 no idea. If you have filter values, and the matching values for the products, then the filters should work. Well, if you have one of the filter modules set to appear on the page they will.

 

Regards

Jim

 

Shall I PM you a link to the site?

 

James

Link to comment
Share on other sites

In your Admin, Filters in Specification: Brand is empty. Ditto all of the other specifications. The Manufacturer filter shows because it pulls the existing manufacturer names from the database. With no available filter values to select, the rest of the selections are not shown. You need to add filter values. Read section 4.2.3 in the manual.

 

Your Admin is not secure. Change the name of the admin folder and protect it with .htaccess/.htpassword. You should also read the security threads on this forum before you get hacked.

 

Regards

Jim

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

Link to comment
Share on other sites

Good Afternoon,

 

Am needing help with this very nice contribution. It all seems to work until I try and use a existing database field. When I try to us one it will not show up on my product info page. I already have one spec that I have added on my own as I have seen in a another post. Looking at my database it is showing "manufacturers_id" in the "products_column_name" so that part is working. This is on a clean install with no other contributions installed. Thank you for any help in advance.

 

Bailey

Link to comment
Share on other sites

Check that Groups -> Show on Products Info Page is set to on (green). The same for the the Specification in that group that you want to show.

 

Regards

Jim

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

Link to comment
Share on other sites

Check that Groups -> Show on Products Info Page is set to on (green). The same for the the Specification in that group that you want to show.

 

Regards

Jim

 

 

Jim,

 

I have made sure that the Show on Products Info Page and the Specification in the group are both green. The Specification that I enter shows up on the Product Info page just not the one I choose from a Existing Database Field. I am wanting to us a field that I have made in my data base and am just using the Manufacture as a test. I have about 15 fields on a excel sheet I am needing to us on my site and would like to upload them using easy populate to make it easy.

 

Thanks again for all your help,

 

Bailey

Link to comment
Share on other sites

Existing fields don't show up on the Product Info page because they're already there. Don't try to repurpose an existing data field -- they are all tied into the code on various pages, and finding and changing them all is a major task. Just add new fields in Product Specifications. Easy Populate is not going to work though, until I get around to modifying it for PS.

 

Regards

Jim

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

Link to comment
Share on other sites

Existing fields don't show up on the Product Info page because they're already there. Don't try to repurpose an existing data field -- they are all tied into the code on various pages, and finding and changing them all is a major task. Just add new fields in Product Specifications. Easy Populate is not going to work though, until I get around to modifying it for PS.

 

Regards

Jim

 

Good Afternoon,

 

I am not trying to use something that is already used on any other page. Lets say that I want to make a spec called "abc" and only use it on the product spec tab. When I do that it will show the one I enter as a "text field" but it won't show the "abc". I can use Easy Populate to get all of my data into the products_description table in the data base by changing a few things. Thanks for all your help and have a nice weekend.

 

Bailey

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