Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Option Types v2


Zappo

Recommended Posts

You'd think that the sort_order would be "universal" product to product...

Yeah... And it should be "universal" product to product...

Like Eek said... It never hurts to help!
----------------------------------------

Link to comment
Share on other sites

Thanks! Yeah it's probably somewhere conflicting. It's just strange that it varies between products what order each option's attributes are displayed in.

 

For example on one product option1's attributes are listed like this:

attribute1

attribute2

attribute3

 

Then on another one option1's attributes might be listed like:

attribute2

attribute1

attribute3

 

You'd think that the sort_order would be "universal" product to product...

 

Just to follow up and for anyone who may search this thread and wants to try and merge this contribution with Attributes Sets Plus I MAY have figured out - so far it looks good. I just had duplicate queries running and I think it was jacking up the frontend and the attributes it displayed.

 

If you combine the two mods on product_info.php to look like this it should take care of the sorting problem when you have the attribute sets contribution as well. (On or around line 206 for me)

:

//BOF - Zappo - Option Types v2 - Add extra Option Values to Query && Placed Options in new file: option_types.php
  $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_type, popt.products_options_length, popt.products_options_comment, popt.products_options_order from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$product_info['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_order, popt.products_options_name");
  while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {

	// - Zappo - Option Types v2 - Include option_types.php - Contains all Option Types, other than the original Drowpdown...
	include(DIR_WS_MODULES . 'option_types.php');

	if ($Default == true) {  // - Zappo - Option Types v2 - Default action is (standard) dropdown list. If something is not correctly set, we should always fall back to the standard.
	$products_options_array = array();
//		$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
// BOF Linkmatics attributes sets plus								  
	  $products_options_query = tep_db_query("
	  SELECT pov.products_options_values_id, pov.products_options_values_name, 
		   pa.options_values_price, pa.price_prefix , pase.sort_order
		  FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . 
				TABLE_PRODUCTS_ATTRIBUTES_SETS_TO_PRODUCTS . " pas2pa, " . 
				TABLE_PRODUCTS_ATTRIBUTES_SETS . " pas, " .
				TABLE_PRODUCTS_ATTRIBUTES_SETS_ELEMENTS . " pase, " .
				TABLE_PRODUCTS_OPTIONS_VALUES . " pov
				WHERE	  pa.products_id = '" . (int)$_GET['products_id'] . "'		   
			AND pa.options_id = '" . 
// Zappo changed - $products_options_name['products_options_id'] . "'
$ProdOpt_ID['products_options_id'] . "'
			AND pas2pa.products_id = pa.products_id
			AND pas.products_attributes_sets_id = pas2pa.products_attributes_sets_id
			AND pas.products_options_id = pa.options_id
			AND pase.products_attributes_sets_id = pas.products_attributes_sets_id
			AND pase.options_values_id = pa.options_values_id
			AND pov.products_options_values_id = pa.options_values_id
			AND pov.language_id = '" . $languages_id . "'
			ORDER BY pase.sort_order, pa.options_values_id"); 
				 // >>>>> BOF Linkmatics attributes sets plus patch v1.01 and Zappo changes
	   if (tep_db_num_rows($products_options_query)== 0 ) {
				   $products_options_query = tep_db_query("
		   SELECT pov.products_options_values_id, pov.products_options_values_name,
				  pa.options_values_price, pa.price_prefix , pa.options_values_id
			 FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " .
					  TABLE_PRODUCTS_OPTIONS_VALUES . " pov
			 WHERE pa.products_id = '" . (int)$_GET['products_id'] . "'
			   AND pa.options_id = '" . $products_options_name['products_options_id'] . "'
			   AND pov.products_options_values_id = pa.options_values_id
			   AND pov.language_id = '" . $languages_id . "'
			 ORDER BY pa.options_values_id");
	   }
	  // <<<<< EOF Linkmatics attributes sets plus patch v1.01	  
	  // EOF Linkmatics attributes sets plus		
	while ($products_options = tep_db_fetch_array($products_options_query)) {
	  $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
	  if ($products_options['options_values_price'] != '0') {
		$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
	  }
	}

	if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
	  $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
	} else {
	  $selected_attribute = false;
	}
?>
<!--	Zappo - Options Types - My fix for duplicate attributes showing (rr) 
	 <tr>
		  <td class="main"><?php //echo $products_options_name['products_options_name'] . ':'; ?></td>
		  <td class="main"><?php //echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
		</tr>
-->		   
		<tr>
		  <td class="main"><?php echo $ProdOpt_Name . ':'; ?></td>
		  <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $ProdOpt_ID . ']', $products_options_array, $selected_attribute) . '   ' . $ProdOpt_Comment;  ?></td>
		</tr><?php
  } // End if Default=true
 }
//EOF - Zappo - Option Types v2 - Add extra Option Values to Query && Placed Options in new file: option_types.php

Link to comment
Share on other sites

Hi there

i just installed this contri but i get on admin site when i want to

create an text option

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in includes/functions/database.php on line 99

 

and

Warning: Cannot modify header information - headers already sent by (output started at ....includes/functions/general.php on line 22

any one know this problem

 

thank you

Danta67

Link to comment
Share on other sites

Hi there

i just installed this contri but i get on admin site when i want to

create an text option

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in includes/functions/database.php on line 99

 

and

Warning: Cannot modify header information - headers already sent by (output started at ....includes/functions/general.php on line 22

any one know this problem

 

thank you

Danta67

 

Make sure you've installed all the contribution's code for both database.php and general.php

 

Is it giving you the error when you add the option? You might want to re-check the products_attributes.php contribution additions are correct as well.

Link to comment
Share on other sites

* You have the ability to set the Images directory (for separating the Option Images from the rest (if you want to ;) ))

* You can also set the Images Prefix (also to see some separation between the Option Images and the other images)

* The images can be the same for all languages, or you can set things up to use another image for each language!

 

Hey, hey! Ok so I was testing out your image option on my test server and I set it to pull images by ID. Well, I have 2 image options on the same product but it doesn't seem to work. When I make selections, both images disappear and say "undefined"

 

Is this an error or is the contrib set up this way to only allow 1 image option per product?

Thank ya!

Link to comment
Share on other sites

Make sure you've installed all the contribution's code for both database.php and general.php

 

Is it giving you the error when you add the option? You might want to re-check the products_attributes.php contribution additions are correct as well.

there is no code for the database.php

 

i copyed the product-atributes.php from the contri so there must be a error in the given file?

 

Danta67

Link to comment
Share on other sites

I have just installed this brilliant contribution and have found that the value of a text field is not being passed to the checkout confirmation page.

 

 

I have a text field called gearbox in the product option.

 

I add the attribute to a product and everything works fine.

I go through checkout and it shows the gearbox and value added in the shoppng cart but thats it. It does not show it in the checkout confirmation and it does not show it anywhere in admin..

 

It shows the product option but just not the value entered.

 

Can you please help in this as i need to know what the customer has entered in this field in the admin and account order history and invoice and packingslip.

 

I have spent hours going through the install and from what i can see it is coded this way to not show beyond shopping cart.

 

 

PLEASE PLEASE PLEASE HELP... this is the last thing im adding and the store is due to go live monday morning.

Link to comment
Share on other sites

Hi everyone,

 

I've been very busy with my work, and don't have the time to offer any support.

Just a few things I'd like to say:

* If you get an error, beginning with "1054 - Unknown column", the SQL is not (fully) inserted. Check if all the tables have been created!

* to Rosemary: Multiple images SHOULD be possible... I can imagine the mistake is made somewhere in option_types.php, where the fields are named and numbered. I could have messed up somewhere...

Sorry I can't help much more than this, I'll probably be busy for another few weeks...

Like Eek said... It never hurts to help!
----------------------------------------

Link to comment
Share on other sites

Hi everyone,

 

I've been very busy with my work, and don't have the time to offer any support.

Just a few things I'd like to say:

* If you get an error, beginning with "1054 - Unknown column", the SQL is not (fully) inserted. Check if all the tables have been created!

* to Rosemary: Multiple images SHOULD be possible... I can imagine the mistake is made somewhere in option_types.php, where the fields are named and numbered. I could have messed up somewhere...

Sorry I can't help much more than this, I'll probably be busy for another few weeks...

 

Hiya Zappo,

 

Busy working all this time... unlucky! and I thought you have been kicking back somewhere nice on holiday enjoying the sunshine.

Thanks for sharing your hardcoded display imageoptions (Option Types v2.1.1) Great tool! I installed it on a site 'am working on for a test run. Everything works fine. The only issue I have is that images uploaded as imageoptions apart from showing properly when you choose them from the font dropdown, they are also showing up just below product description (that is just between where product description ends and available options starts)

 

I suspected I must have duplicated the codes that show the images somewhere but I could not figure it out myself after many searches.

Do you have any idea what I did wrong or how to go about troubleshooting it?

 

Thanks.

Rich

Link to comment
Share on other sites

Hiya Zappo,

 

Busy working all this time... unlucky! and I thought you have been kicking back somewhere nice on holiday enjoying the sunshine.

Thanks for sharing your hardcoded display imageoptions (Option Types v2.1.1) Great tool! I installed it on a site 'am working on for a test run. Everything works fine. The only issue I have is that images uploaded as imageoptions apart from showing properly when you choose them from the font dropdown, they are also showing up just below product description (that is just between where product description ends and available options starts)

 

I suspected I must have duplicated the codes that show the images somewhere but I could not figure it out myself after many searches.

Do you have any idea what I did wrong or how to go about troubleshooting it?

 

Thanks.

Rich

Hi Rich,

 

I don't think you duplicated anything, but something is wrong with the Image Preloading...

Did you merge the .css file?

All possible Images are preloaded when the page loads, in a (by css) hidden field.

Edited by Zappo

Like Eek said... It never hurts to help!
----------------------------------------

Link to comment
Share on other sites

Hi Rich,

 

I don't think you duplicated anything, but something is wrong with the Image Preloading...

Did you merge the .css file?

All possible Images are preloaded when the page loads, in a (by css) hidden field.

 

 

Yeees Zappo, you were right! excellent diagnose.

I had the .css file merged with the admin/include/stylesheet.css file.

My mistake. Should have paid more attention. ..full of appreciation!

Now I can go and show off my new tool. Nice one Zappo!

 

 

Just another question regarding this:

 

All possible Images are preloaded when the page loads, in a (by css) hidden field.

 

Is it possible to display font images twice or more. e.g. Font1 and Font2.

I need to do this because I have a lot of different images to display. I could of course bang them all

together but it looks confusing and untidy. (All the images are loaded automatically into one option name anyway)

So I really need to split them into two or more. If possible, how?

 

Many thanks again.

Rich

Link to comment
Share on other sites

Dan I get the same errors with either the text field or text area. I'm trying to add the text field in the old 'products_attributes' section as I don't have the text option with the ajax manager. Have you figured out the mistake yet, as I probably have duplicated what you did?

 

 

edit: just a follow up...i still get the errror (which i have to browse back to get out of) but the text field does appear correctly on the product page. I still would like to get rid of the error though...thanks

Edited by coolfly
Link to comment
Share on other sites

hi dan...thanks for reply..i had sent you a pm about it, but disregard it. hmm, you using a clean osc store or a template? If you can, hold off on removing for a while...I'll try to figure it out or maybe someone familiar with it will post now that there's more than one of us with problem...seems like a cool mod if working right...

Thanks, Chris

Link to comment
Share on other sites

hello

 

i have just installed oscommerce rc2a with the following contributions : seperate pricing per customer 4.2.2 and SPPC pricebreaks v2.

 

after installing option type in admin everything worked ok.

 

i also get produkt_info.php installed and working. but after choosing a tex or textarea atribute the shopping cart stays empty. <_<

 

the problem lies in the fact that the attribute code in several php files are so much different from original ocs rc2a that i can not make anything out of it to replace it

with the code from the option type v2contribution.

 

has anyone installed all 3 contributions ??

 

please give me a solution or the correct code to use all 3 contributions together :rolleyes:

 

many,many thanks

 

eric

Link to comment
Share on other sites

I have no idea what went wrong, but I'm guessing the SQL file wasn't (properly) executed...

Go into your phpMyAdmin, and check the table "configuration_group" for the Option Types entry, and note the "configuration_group_id" number.

Then check the table "configuration", and find the Option Type values (use progress bars?, Upload File Prefix, Delete Uploads older than, upload directory and temporary directory)

These probably don't have the correct configuration_group_id... Set it to the value found in configuration_group

 

Lat me know if it works out.

We'll try another fix if it doesn't.

 

It worked out very well , but attributes disappearing when quantity is updated in shopping cart.

Link to comment
Share on other sites

Hello!! so far a Great Contrib!! THANK You!

 

I am having one issue:

 

In admin If i want to change the attribute it allows it - when I click the update button I get this error:

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /admin/includes/functions/database.php on line 99

 

Warning: Cannot modify header information - headers already sent by (output started at /admin/includes/functions/database.php:99) in /admin/includes/functions/general.php on line 208

 

any help would be great!

Thanks!

Link to comment
Share on other sites

HI,

 

Great contribution.!!!

 

I have a heavily modified OSC and have spent the last 2 days manually inserting all changes (after making painstaking comparisons) :blink:

 

I have installed options V2.1.1 & Atttrib Manager Addon. All works perfectly and . Many thanks :thumbsup:

 

 

I have one small cosmetic problem. (IN SHORT - can i define which option value is the 'Default' selected option value ?????

 

(and i will try to explain why i am doing what i want to do )

 

I have the same products listed more than once in my shop, each 'similar' product has a different option, therefore a different price. As i only have limited products i DO need to list them seperatly to give my shop some volume. What i use options for is to allow any prospective buyer to tailor the specific product they are looking at and maybe make it the same as another similar item (this saves them having to go find that specific product. (eg. product 1 is Fireplace without light, Product 2 is fireplace with light) Both products are the same except one has lights and one does not, NOW Here is my ISSUE

 

1. if someone is looking at the product Fireplace with light, the options they have would be to remove the light (option Light NO -£15.00)

2. if someone is looking at the product Fireplace with NO light, the options they have would be to ADD the light (option Light YES +£15.00)

 

if someone views 1, then i need to have option Light YES shown as default and not option light NO -£15.00

if someone views 2, then i need to have option Light NO shown as default and not option light YES +£15.00

 

Currently the default 'Selected' option appears to depend in which order you add the option, CAN THE 'DEFAULT' option shown be Assigned anywhere?

Link to comment
Share on other sites

This is an excellent plugin. This is one of the few installations we have done with osCommerce that worked exactly as you described. Thank you for your efforts.

 

Here is my question:

The attributes under each option seem to randomly order themselves, not matter which order you put them in using the Option Types plugin. Is there a way using Option Types v2 to change the order of the individual option attributes?

 

I tried making each attribute a seperate option to control the order using the 'sort order' field, but the radio box option type allows you to select EVERY option without a way to deselect them.

 

Any help or advice you can provide is appreciated.

 

- Presario

 

 

This contribution is built on top of osCommerce 2.2rc2a.

It is an update/upgrade/revision/compilation of the following contributions:

* Option Type Feature v3 (Originally by Chandra Roukema)

* Option Type File Feature v.8 (Originally by Matt Fletcher)

* AJAX Attribute Manager v2.8.6 ((Almost unchanged) Originally by Sam West)

* Improvements by me (AvanOsch aKa Zappo the Wizard of Osch) for http://shop.crystalcopy.nl

 

Please post questions, comments, request, etc. right here!

 

The Contribution Page can be found here: http://www.oscommerce.com/community/contributions,xxxx

Link to comment
Share on other sites

Currently the default 'Selected' option appears to depend in which order you add the option, CAN THE 'DEFAULT' option shown be Assigned anywhere?

No, there's currently no way to set the default option...

I'll have to look into that (as it is a very useful feature)

 

The attributes under each option seem to randomly order themselves, not matter which order you put them in using the Option Types plugin. Is there a way using Option Types v2 to change the order of the individual option attributes?

No, there's also no way to order the attributes of a certain option...

This function will need an extra field for Products Option Values to set the sort order.

I'll look into this as well.

 

Both problems have to do with the same code, so I'll try to add both functions at the same time.

Don't know when I'll be done though, and there's no real "quick fix" for either problem...

Like Eek said... It never hurts to help!
----------------------------------------

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