Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Option Types v2


Zappo

Recommended Posts

Oh dear,

 

Spoke too soon...although I have checked and re-checked the installation in product info.php the screenshot below shows the option somehow being called up twice.

 

Also when I examine the page source I see the box being called up twice, like:

 

<tr>
		  <td class="main">Memory:</td>
		  <td class="main"><select name="id[4]"><option value="1">4 mb (+£1.20)</option></select>   </td>
	    </tr>	  <strong>:</strong><br /><select name="id[]"><option value="1">4 mb (+£1.20)</option></select><br

 

I just cant seem to find where I have made the error....

 

Many Thanks

Edited by Mort-lemur

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

Can anyone help - In my shopping cart when I add an item with a CUSTOMER-INPUT field option, it will not show what was types in the box.\\

 

Here is an example - The option name is Linear FT - and it is set to Text Input. I have tried everything, and manually added the code to shoppingcart.php, ect. Has any one had the same issue?

 

Matrox G200 MMS

- Linear FT CUSTOMER-INPUT

- Memory 8 mb

- Model Premium

Link to comment
Share on other sites

@@Mort-lemur

 

Heather, I have no idea. It looks like the one output comes from includes/modules/option_types.php and the onrher one from product_infp.php directly

 

Did you compare with zappos product_info.php ?

Link to comment
Share on other sites

@@Finwood

 

there is no file shoppingcart.php.

 

You need to be clear about what file you edited (path to the file and correct filename)

 

I modified all the files in the install but specifically /includes/classes/shopping_cart.php. I basically went like you said and used the V2 file and manually merged. It is the same problem I had with the updated version. It seems like it is not outputting the input text.

 

I can send you the files if needed.

Link to comment
Share on other sites

I have been working on this for some time and i can't seem to find the answer.

I have installed this awesome contribution and everything seems to work perfectly, except for one thing. When a user types some free text into the option on the product info page and then presses "Add to Cart" the option shows up with a value of "CUSTOMER-INPUT". However, when you go to checkout it does not show this, but shows the actually text that was typed in.

 

I know that CUSTOMER-INPUT is just the default value for the input. I have searched through the shopping_cart class and application_top and can't find anything. I also don't understand why it works in the order confirmation page and why not in the shopping cart page.

 

Any help would be great!!! Thanks so much

Also - the actual text inserted does show up on the checkout confirmation page, and on the invoice, ect. So it seems to be an issue with the shopping cart.

Link to comment
Share on other sites

Finwood, CUSTOMER-INPUT: look for a block of code that looks similar to this and see what you are missing. I had a similar problem. See if you are missing:

 

	   if ($value == OPTIONS_VALUE_TEXT_ID) {
	    echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . TEXT_PREFIX . $option . ']', $products[$i]['attributes_values'][$option]);
	    $attr_value = $products[$i]['attributes_values'][$option];
	  } else {
	    echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
	    $attr_value = $attributes_values['products_options_values_name'];
	  }

 

the full block of code should be something like this:

 

   for ($i=0, $n=sizeof($products); $i<$n; $i++) {
// Push all attributes information in an array
  if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
    while (list($option, $value) = each($products[$i]['attributes'])) {
	  echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
	  $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
								  from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
								  where pa.products_id = '" . (int)$products[$i]['id'] . "'
								   and pa.options_id = '" . (int)$option . "'
								   and pa.options_id = popt.products_options_id
								   and pa.options_values_id = '" . (int)$value . "'
								   and pa.options_values_id = poval.products_options_values_id
								   and popt.language_id = '" . (int)$languages_id . "'
								   and poval.language_id = '" . (int)$languages_id . "'");
	  $attributes_values = tep_db_fetch_array($attributes);
	   if ($value == OPTIONS_VALUE_TEXT_ID) {
	    echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . TEXT_PREFIX . $option . ']', $products[$i]['attributes_values'][$option]);
	    $attr_value = $products[$i]['attributes_values'][$option];
	  } else {
	    echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
	    $attr_value = $attributes_values['products_options_values_name'];
	  }
	  $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
	  $products[$i][$option]['options_values_id'] = $value;
	  $products[$i][$option]['products_options_values_name'] = $attr_value ;
	  $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
	  $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
    }
  }
   }

Link to comment
Share on other sites

Does anyone have the full install instructions for attributes manager? I had the latest attributes manager installed prior to installing option types. I didn't the option types attribute manger folder, I just want to know what changes need to be made. Thanks.

Link to comment
Share on other sites

@@dailce

 

There shouldn't be any difference, however

 

- do modifications to admin/categories.php as per option types instructions (should be same as what you have)

- Upload attribute manager folder (I don't know if there are any differences in the files, you could compare them, but finally you'll use the files of option types package)

- Do the changes to admin/includes/template_top.php as described here (should be same as what you have)

Link to comment
Share on other sites

Well attributes manager seems to be working ok, however, it's not pulling the optiontype value: CUSTOMER-INPUT. Nor is there an option to choose/set length value for text or the option type.

 

Seems like it's not using the option type settings, but rather just functioning as normal.

 

One thing I notice is that if I have a say:

Option Name = "mycustomtext"

Option Value = "CUSTOMER-INPUT"

etc... set in products_attributes.php

 

I can add this to a product from products_attributes.php just fine. However, if I go edit a product, the attributemanger will show "mycustomtext" as a new option, attributemanger won't let me add it because there is no value being pulled for this option - it's blank. Seems that may be the problem.

 

I don't see any code in the included attributemanger that refers to text, may just be it was just included but not modified for optiontypes specifically, maybe I'm wrong?

Link to comment
Share on other sites

@@dailce

 

I would suggest you use the attribute manager files from the option types package, because they work just fine for me

 

You need to create the options for text etc, using the regular attributes page. Once this is done, you can use the attribute manager to add that options to any product, the value that appear is CUSTOMER_INPUT

 

If you have issues with this, then maybe something else is wrong

Link to comment
Share on other sites

Finwood, CUSTOMER-INPUT: look for a block of code that looks similar to this and see what you are missing. I had a similar problem. See if you are missing:

 

	   if ($value == OPTIONS_VALUE_TEXT_ID) {
		echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . TEXT_PREFIX . $option . ']', $products[$i]['attributes_values'][$option]);
		$attr_value = $products[$i]['attributes_values'][$option];
	  } else {
		echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
		$attr_value = $attributes_values['products_options_values_name'];
	  }

 

the full block of code should be something like this:

 

for ($i=0, $n=sizeof($products); $i<$n; $i++) {
// Push all attributes information in an array
  if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
	while (list($option, $value) = each($products[$i]['attributes'])) {
	  echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
	  $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
								  from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
								  where pa.products_id = '" . (int)$products[$i]['id'] . "'
								   and pa.options_id = '" . (int)$option . "'
								   and pa.options_id = popt.products_options_id
								   and pa.options_values_id = '" . (int)$value . "'
								   and pa.options_values_id = poval.products_options_values_id
								   and popt.language_id = '" . (int)$languages_id . "'
								   and poval.language_id = '" . (int)$languages_id . "'");
	  $attributes_values = tep_db_fetch_array($attributes);
	   if ($value == OPTIONS_VALUE_TEXT_ID) {
		echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . TEXT_PREFIX . $option . ']', $products[$i]['attributes_values'][$option]);
		$attr_value = $products[$i]['attributes_values'][$option];
	  } else {
		echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
		$attr_value = $attributes_values['products_options_values_name'];
	  }
	  $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
	  $products[$i][$option]['options_values_id'] = $value;
	  $products[$i][$option]['products_options_values_name'] = $attr_value ;
	  $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
	  $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
	}
  }
}

 

I checked the code and mine is correct. This is for catalog/shopping_cart.php correct? The strange thing is that the text input displays on the checkout confirmation page and in the admin pages, just not in the shopping cart. Really frustrating.

Link to comment
Share on other sites

I checked the code and mine is correct. This is for catalog/shopping_cart.php correct? The strange thing is that the text input displays on the checkout confirmation page and in the admin pages, just not in the shopping cart. Really frustrating.

 

Interesting ---- I removed a line space and now it seems to be working as it should. Will blank line spaces cause issues?

Link to comment
Share on other sites

I decided to use the latest attributes manager, I found the issue was in attributeManager.class.php. I included the original attributeManager.class.php file from OptionTypes in the latest version of the attributes manager folder, and it seems to be working well.

 

 

@@dailce

 

I would suggest you use the attribute manager files from the option types package, because they work just fine for me

 

You need to create the options for text etc, using the regular attributes page. Once this is done, you can use the attribute manager to add that options to any product, the value that appear is CUSTOMER_INPUT

 

If you have issues with this, then maybe something else is wrong

Link to comment
Share on other sites

@@dailce

 

I would suggest you use the complete folder for attribute manager that came with option types.

 

This does not include improvements and corrections I posted to this topic a year ago, maybe even longer

Link to comment
Share on other sites

Hi George,

 

I didnt have these problems when installing on 2.2....

 

I sorted out the product_info.php problem, but now have a problem with catalog/shopping_cart.php.

 

When I add the code, or use the drop on top file the shopping cart page loses the quantity box + the remove + update buttons.

 

Have tried using the contributions from zappo for this file with the same result....

 

Any Ideas?

 

Thanks

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

Hi there, firstly thanks for such a great contribution (after managing to get it to finally work). I thought I'd share a little script I added to catalog/includes/modules/option_types.php for the radio button attributes. I wanted to have the first radio button of a group checked by default when the product was first opened (well, as a radio group, one item should be selected at all times). It checked if anything is checked first as a customer might click on the product from the shopping chart.

 

Add this just before end of the OPTION_TYPE_RADIO switch statement.

// jscript to "check" the first radio button if nothing is checked - Chris 13/07/2012
$tmp_html .= '<script>' .
'  $(function() {' .
'	if ($(\'input:radio[name=id[' . $ProdOpt_ID . ']]:checked\').val() == undefined) {' .
'	  $(\'input:radio[name=id[' . $ProdOpt_ID . ']]:nth(0)\').prop(\'checked\',true);' .
'	}' .
'  });' .
'</script>';

 

Hope this is of use to others.

Edited by Blaise
Link to comment
Share on other sites

I have a 2.3 install with several contributions. I tried to add Option Types, going through all of the changes outlined in the install file manually, so as not to disturb my other contribs. My admin area is working fine and I seem able to add (for example) text areas with no problem... except that my site has gone completely blank. Nothing outside the admin area will open. My best guess is it's to do with includes/application_top.php. Has anyone else had this problem, and if so how did you solve it? I'm going to compare my changes to the drop-on-top files included in the download to see if something in the install file had a typo or if I replaced a wrong something, but if someone else has had this problem and can respond sooner than I can read through all those lines of code, that would be awesome and thanks in advance!

Link to comment
Share on other sites

@@maritrench

 

Most possible is that you did some mistake during installation, something like a systax error etc, that you cant see because you have error reporting off

 

Go through all files and check again each step

 

If you have a blank page everywhere, then possible pages to check first are

includes/application_top.php

includes/classes/shopping_cart.php

Link to comment
Share on other sites

I've managed to get this mostly working except right now my shopping cart is not getting populated at all. I can view the product, I get the correct options including the text input field, but when I click add to cart I am sent to an empty shopping cart. Any ideas or thoughts?

 

If this is too vague of an issue, then please elaborate on the appropriate installation procedures. You download includes two main directories, and two different instruction files (txt and html). I initially followed the txt file instructions and reviewed the directories but am confused. The directories include duplicate files, would overwrite my configuration files with incorrect parameters and negate the changes made by following the txt file instructions.

 

I uploaded your catalog directory and then re-applied the changes made using your txt file and html file, but now I am at a state where the shopping cart isn't getting populated. If I have to start over from the top I would like to know the correct installation procedure to follow.

 

Also, I have made changes to the application_top, stylesheet and header files to accommodate a design. So I would prefer to use a process like the instructions in the txt file rather than simply replacing those files.

 

Whatever you can do to help me resolve this I would appreciate.

Link to comment
Share on other sites

Hello, I have now installed the optiontypes231 to regret has to realize they were when I want to do in the basket, told me that no goods are splashing around in the cart. Why is das.

 

I can only conclude that it is up to the product_info.php.

 

would be nice if I can help.

 

ps. my English is not good, and sorry to see use of Google Translate.

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