Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Development] Products Specifications


kymation

Recommended Posts

No need for Javascript. Just modify the PHP code that outputs the rows to use a different CSS class for even and odd rows. See catalog/includes/modules/product_listing.php, lines 79-83.

 

Regards

Jim

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

Link to comment
Share on other sites

No need for Javascript. Just modify the PHP code that outputs the rows to use a different CSS class for even and odd rows. See catalog/includes/modules/product_listing.php, lines 79-83.

 

Regards

Jim

 

Thanks for your reply Jim I put it together with jquery as we had it loaded for tabs anyway and cleaned the code from the above.

I finished it before you replied I didn't think of that as a solution, good input. I wasn't thinking outside the box.

 

I added it as a addon for product specification link

 

maybe It could could be added as a enhancement for the next release

 

Thanks for the contribution

 

Al

Link to comment
Share on other sites

The Comparison table is not set up to be sorted by an arbitrary Specification. I'm certain that can be done, but it won't be simple. You could sort the products by an arbitrary field in the Products table by adding that field to the $columns_query_raw. Something like the Sort Order Addon does to stock osCommerce.

 

Regards

Jim

 

So, if I added a new field to the Products table in the OScommerce database, I could add that field to the $columns_query_raw to sort the products? Or, I suppose I could sort by an existing field like the manufacturers_id?

 

It looks like it sorts the list in the Comparison table by products_id, which won't work now or in the future for this site. How would I change it to sort by the products_name or manufacturers_id fields instead?

 

Thanks again in advance...

Link to comment
Share on other sites

You just change the sort by products_id to sort by products_name or whatever field you want to use.

 

Regards

Jim

 

Maybe I'm missing something or it might be because I'm not totally fluent in PHP, but where in the comparison.php (in catalog/includes/modules right?) does it specify the sort by products_id? If you can show the code piece you're talking about, that would help a lot.

 

Thanks...

Link to comment
Share on other sites

  • 2 weeks later...

Sorry for the slow reply; I missed this one somehow. The actual sort by statement is p.products_sort_order on line 191 of catalog/includes/modules/comparison.php. You can change that to any field you want.

 

Regards

Jim

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

Link to comment
Share on other sites

Hi kymation,

i have somewhat of a peculiar problem to solve.

I have a separate table that i need to integrate into products_specification (by importing all the data).

In this table i have the OSC products id, a filter name and a filter value.

 

Would you please help or at least direct me to the correct way of importing automatically all these already-done filters for my products?

I've been looking at the database and the manual, but its kinda 'messy' (for me!) in the database ... :'(

 

Would you please, direct me?

 

Thanks in advance

Link to comment
Share on other sites

There is no direct way to do this. I'm working on an addon to Easy Populate to do this, and so is someone else, but we haven't got it to import yet. This will probably not be finished soon.

 

It sounds like what you have are Product Specification values. You would need to set up the Specification Group(s) and Specifications (your names) first. Then your values could be entered. You'll probably have to do this by hand in the osC Admin, at least for now.

 

Regards

Jim

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

Link to comment
Share on other sites

There is no direct way to do this. I'm working on an addon to Easy Populate to do this, and so is someone else, but we haven't got it to import yet. This will probably not be finished soon.

 

It sounds like what you have are Product Specification values. You would need to set up the Specification Group(s) and Specifications (your names) first. Then your values could be entered. You'll probably have to do this by hand in the osC Admin, at least for now.

 

Regards

Jim

 

Hi Jim,

thanks for the answer.

What i have right now is the 'Name' (for example, of a Monitor i have the 'name' of the filter, which could well be 'size' and the value for it, which could be 15 inches).

 

I know how i could get the groups, i could make an assignment by checking on the product category, and see what are the groups assigned to it ... Lets say group is not a problem.

Where should i enter what? I'm sorry, i really cant understand the current database structure ... if you could just direct me to the correct tables it would be a big help.

Link to comment
Share on other sites

All of the tables are linked together. Get one of the links wrong and you could cause serious problems, even make your store unusable. Make very certain that you understand the relations between the tables before you start editing the tables directly. If you want to learn how the tables are tied together, see the diagram in Appendix B of the User's Manual.

 

The specifications (the names of your columns, e.g. 'size') are stored in the specification_description and specification tables. The value for that specification is stored in the products_specifications table. Again, don't add anything until you understand the purpose of every single field in those tables.

 

Regards

Jim

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

Link to comment
Share on other sites

I've uploaded a new version to the usual location. It will be available as soon as a moderator approves it.

 

Most of the bugs are fixed in this version, and two new tabs were added to the optional Product Info page. There are still features to be added, but I ran out of time to do anything more. I think it's better to release something that's not perfect rather than release nothing at all. So here it is.

 

Any new bug reports, code, or grand ideas should be posted here. Requests for installation support should be posted in the support thread.

 

Regards

Jim

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

Link to comment
Share on other sites

I knew I forgot something. I wanted to thank everyone who submitted bug reports, code, or suggestions in this forum. This would be a lot harder without all of your support.

 

Thanks again

Jim

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

Link to comment
Share on other sites

  • 2 weeks later...

hi Jim,

 

Thanks for the upload. I haven't gone through all the changes yet, but wanted to check with you if the following logic is true and simplify my data-entry a little bit.

 

If filter class = range, then the input must be numeric, and when enter values = text, I can define just one input field for the number and generate the language specific entries in the background.

This would simplify the data entry and enforce consistency, avoiding typo's.

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

for anyone interested

 

in admin/modules/products_specifications_input.php at around line 110

 

if you change

             echo tep_draw_textarea_field ('products_specification[' . $id . '][' . $languages[$i]['id'] . ']', 'soft', '70', '3', $products_specification); 

to

             echo tep_draw_input_field ('products_specification[' . $id . '][' . $languages[$i]['id'] . ']', $products_specification); 

 

you just have a single line entry iso a text box for text fields.

I haven't gotten any specifications that really need a lot of space, so this is a quick fix to save some screen space

 

it's in 2 places ... a few lines apart

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

The range filter is not restricted to numbers; it can be anything that will sort. If you want to restrict it to numbers, feel free.

 

Regards

Jim

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

Link to comment
Share on other sites

  • 1 month later...

Hello all,

 

I am working with Product Specifications V1.0.2. I think I have found a couple of bug in the /catalog/includes/boxes/products_filter.php

I was getting multiple copies of filter box labels showing up, and was able to eliminate that issue by changing this line:

 

$box_label .=  '<b>' . $specs_array['specification_name'] . '</b><br>';

to

$box_label =  '<b>' . $specs_array['specification_name'] . '</b><br>';

 

Now when the box is building the filter input boxes and box labels, everything seems to be out of order. For instance, when it builds the filter box label/input box list, this is what I get:

 

 

Box Label 3

Box Label 2

Box Label 1

Input Box 1

Input Box 2

Input Box 3

 

I'm not sure why it's not building the list sequentially, as it appears that is what is happening in the code, but the result seems to stack things out of order. Has anyone else come up against and or can you reproduce this issue?

Link to comment
Share on other sites

On the issue of the box labels being displayed out of order, I think I found where the issue is happening. I still don't understand why. Conventional wisdom says that it should work.

 

I went back to V 1.0 and installed that filter box, and it was working fine for the input fields that I have tested. I then compared it to the changes made in the 1.0.2 version and it appears that there was some added functionality that was made to accommodate the <br clear=all> when some the input fields were being drawn in includes/functions/products_specifications.php

 

The new version adds the $box_label variable, and appends it to the $box_text toward the bottom of the file here:

 

if ($box_text != '<br clear=all>') {

$box_text = $box_label . $box_text;

}

 

For some reason, this is making the labels for the input field show out of order.

 

If changed the line:

$box_label .=  '<b>' . $specs_array['specification_name'] . '</b><br>';

to

$box_label = '';
$box_text .=  '<b>' . $specs_array['specification_name'] . '</b><br>';

it seems to have solved the issue.

 

This is just a kludge to get it working, but probably isn't the right approach, as I'm certain it's breaking another feature that I haven't started using yet. Maybe this will help point someone in the proper direction to create a fully validated fix for this. that is, assuming anyone else can reproduce my original issue.

Link to comment
Share on other sites

I found another issue the may be considered a bug, or just one of proper instruction. When I tested the specs system I created a bunch of generic specifications and populated all of the fields the same way. Because I was just adding specs, without knowing all of the ramifications, I added prefixes and suffixes to all the values. Though, I don't believe anyone would knowingly add those for an image, it does break the Image specification filter functions because it adds the prefix and suffix to the image filename in the temp_draw_images_menu function in includes/functions/products_specifications.php .

 

Also there doesn't seem to be a way to add the TEXT_SHOW_ALL link for an image spec, so I modified the following function (default case) to add a text link:

 

Original:

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

   foreach ($values as $link_data) {
     if ($link_data['id'] == '0') {
       $link_data['text'] = SPECIFICATIONS_GET_ALL_IMAGE;
     }

     switch (true) {
       case ($link_data['count'] != '' && $link_data['count'] < 1 && SPECIFICATIONS_FILTER_NO_RESULT == 'none'):
         break;

       case ($link_data['count'] != '' && $link_data['count'] < 1 && SPECIFICATIONS_FILTER_NO_RESULT == 'grey'):
		//if ($link_data['text'] == )
         $field .= '<span class="no_results">';
         $field .= tep_image (DIR_WS_IMAGES . trim ($link_data['text']), $link_data['text'], SPECIFICATIONS_FILTER_IMAGE_WIDTH, SPECIFICATION_FILTER_IMAGE_HEIGHT, ' class="image_filter"');
         $field .= '</span>';
         break;

       default:	
         $field .= '<a href="' . tep_href_link ($target, tep_get_array_get_params (array ( $name, 'page') ) . ($link_data['id'] == '0' ? '' : $name . '=' . tep_output_string ($link_data['id']) ) ) . '">';
         $field .= tep_image(DIR_WS_IMAGES . trim ($link_data['text']), $link_data['text'], SPECIFICATIONS_FILTER_IMAGE_WIDTH, SPECIFICATION_FILTER_IMAGE_HEIGHT, ' class="image_filter"');
         $field .= '</a>'
         break;
     } // switch (true)
   }

 

Changed:

 

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

   foreach ($values as $link_data) {
     if ($link_data['id'] == '0') {
       $link_data['text'] = SPECIFICATIONS_GET_ALL_IMAGE;
     }

     switch (true) {
       case ($link_data['count'] != '' && $link_data['count'] < 1 && SPECIFICATIONS_FILTER_NO_RESULT == 'none'):
         break;

       case ($link_data['count'] != '' && $link_data['count'] < 1 && SPECIFICATIONS_FILTER_NO_RESULT == 'grey'):
		//if ($link_data['text'] == )
         $field .= '<span class="no_results">';
         $field .= tep_image (DIR_WS_IMAGES . trim ($link_data['text']), $link_data['text'], SPECIFICATIONS_FILTER_IMAGE_WIDTH, SPECIFICATION_FILTER_IMAGE_HEIGHT, ' class="image_filter"');
         $field .= '</span>';
         break;

       default:
               //added TEXT_SHOW_ALL
	if ($link_data['text'] == SPECIFICATIONS_GET_ALL_IMAGE){
		$field .= '<a href="' . tep_href_link ($target, tep_get_array_get_params (array ( $name, 'page') ) . ($link_data['id'] == '0' ? '' : $name . '=' . tep_output_string ($link_data['id']) ) ) . '">';
		$field .= TEXT_SHOW_ALL;
         	$field .= '</a><br clear=all>';
	} else {
         $field .= '<a href="' . tep_href_link ($target, tep_get_array_get_params (array ( $name, 'page') ) . ($link_data['id'] == '0' ? '' : $name . '=' . tep_output_string ($link_data['id']) ) ) . '">';
         $field .= tep_image(DIR_WS_IMAGES . trim ($link_data['text']), $link_data['text'], SPECIFICATIONS_FILTER_IMAGE_WIDTH, SPECIFICATION_FILTER_IMAGE_HEIGHT, ' class="image_filter"');
         $field .= '</a>';
	  }
         break;
     } // switch (true)
   }

 

Hope this help someone.

Edited by fourmat
Link to comment
Share on other sites

That's correct, I simply didn't think that anyone would add a prefix or suffix to an image specification. Probably should say that in the instructions.

 

The Show All image should work. I remember testing that. the code is this part:

     if ($link_data['id'] == '0') {
       $link_data['text'] = SPECIFICATIONS_GET_ALL_IMAGE;
     }

Maybe it's not getting triggered somehow. Did you set Filter Show All to Yes for that Specification?

 

Regards

Jim

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

Link to comment
Share on other sites

Yes, The Filter Show All was set and it is being triggered correctly, but there wasn't anything being displayed, which is why I added the modification in the previous post. I actually use the SPECIFICATIONS_GET_ALL_IMAGE to trigger the mod. Was there supposed to be an actual image that is displayed to signify "Show All"? There are no images in the downloaded package that I can find and no reference to one int he code (I could be missing it if it's there).

 

Have you experienced the issue that I had highlighted in the previous post with the out of order box labels?

Link to comment
Share on other sites

You need to provide your own image. The image name is set in Admin >> Configuration >> Products Specifications >> Get All Image.

 

No, I haven't seen the out-of-order problem that you mentioned. Everything is set up to use Sort Order, so that should maintain the order. I have no idea why that would work the way you said.

 

Regards

Jim

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

Link to comment
Share on other sites

You need to provide your own image. The image name is set in Admin >> Configuration >> Products Specifications >> Get All Image.

 

No, I haven't seen the out-of-order problem that you mentioned. Everything is set up to use Sort Order, so that should maintain the order. I have no idea why that would work the way you said.

 

Regards

Jim

 

 

Ah yes, ok, I remember seeing that in the manual. And Yes I RTFM as you requested, but the complexity and detail of this contribution is a bit overwhelming at first. Awesome, but overwhelming. I'm getting it slowly...thanks again..

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Hey Jim,

 

Is there plans for a 2.3.1 version ?

 

Chris

Yes, I do intend to release a 2.3 version. It's a big job, though, and will take quite a bit of effort. I could sure use some help (hint hint.)

 

Regards

Jim

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

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