Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Option Type Feature 1.7


kirikintha

Recommended Posts

Hello everyone I have

 

Option Type Feature 1.7 working on

 

osCommerce 2.2 Milestone 2 Update 051113 with the STS template system.

 

Everything on Option Type seems to be working, I am able to pass the products attributes through the entire path of the OSC Cart, I get the attributes in the email - everything.

 

However, say I add a product.

 

Got to product_info.php - get all the attributes. I have three attributes, textarea, select and a checkbox.

 

Select your desired attributes, add some text all fine 100%. Then, select add to cart.

 

When I am in shopping_cart.php I can see only the text area attibutes and the '-' separator for each other attribute. No select, no checkbox message. Just the text.

 

like this:

 

Product name

-

-Hello this is text

-

 

then, when I go to checkout, and get to checkout_payment.php

 

ALL OF A SUDDEN I HAVE ALL THE FIELDS!!! if I go back to the shopping_cart.php no fields - back to payment all the fields. All the way through the checkout process. I get my confirmation email and all the selected attributes are there as well.

 

So, obviously something is wrong in the cart, but I cannot figure out why the values are not being passed? I must admit I read through a lot of posts before posting this, so I know my version of this contribution has been tweaked from a lot of other posts.

 

Anyone have any good ideas?

 

I cannot figure out why it works for one and not the other Thanks! :blink:

Nothing unreal exists

Link to comment
Share on other sites

Hello Paul,

 

I do not use the Option Type contribution but thought I would pipe in to give you some assistance...

 

What version of STS are you using? Are you using the product_info templates? If so, try it without the product templates to help rule out STS.

 

Are your permission settings correct according to the Option Type instructions?

 

Here is a link that may help you find the answer to your problem (just add what you are looking for in between the quotes at the end of the link, currently it will search for anything in the Option Type forum that has to do with "STS") - Add the link below into a Google Search window and see what you will find:

 

site:http://www.oscommerce.com/forums/lofiversion/index.php/t57259 "sts"

 

Good luck,

 

Bill

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

HI Bill thanks for the feedback - not using the product_info template - I saw another post a while ago in my installation that said I may have run into problems, I am using the catalog_shopping_cart - but I saw no effect in taking that away.

 

I have been looking at the output of the contribution and I am finding that it just looks like the values for those specific options are just not being recieved and/or read properly from the action of adding it to the shopping cart.

 

I did add a piece of code from this forum:

 

http://www.oscommerce.com/forums/index.php?sho...mp;#entry994422

 

go all the way down to JanZ's post

 

The instructions haven't been updated after the latest osC update of August 17, 2006. Especially in the shopping cart, the function add_cart that is very confusing since $products_id and $products_id_string are used differently in the two versions...

 

so I'm using what they came up with. now I'm trying to debug that. >_<

Nothing unreal exists

Link to comment
Share on other sites

I have been looking at the output of the contribution and I am finding that it just looks like the values for those specific options are just not being recieved and/or read properly from the action of adding it to the shopping cart.
From what you describe it looks like the attributes are added correctly but they are not displayed on the page shopping_cart.php. A short piece of code that has a few changes for OTF is responsible for that:

// 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'])) {
	  //clr 030714 move hidden field to if statement below
	  //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 = '" . $products[$i]['id'] . "'
								   and pa.options_id = '" . $option . "'
								   and pa.options_id = popt.products_options_id
								   and pa.options_values_id = '" . $value . "'
								   and pa.options_values_id = poval.products_options_values_id
								   and popt.language_id = '" . $languages_id . "'
								   and poval.language_id = '" . $languages_id . "'");
	  $attributes_values = tep_db_fetch_array($attributes);

	  //clr 030714 determine if attribute is a text attribute and assign to $attr_value temporarily
	  if ($value == PRODUCTS_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;
	  //clr 030714 assign $attr_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'];
	}
  }

Apparently, things are OK for the text area, but not for the other ones. Perhaps you can post what you have for code (STS specific things in there?)

Link to comment
Share on other sites

From what you describe it looks like the attributes are added correctly but they are not displayed on the page shopping_cart.php. A short piece of code that has a few changes for OTF is responsible for that:

// 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'])) {
	  //clr 030714 move hidden field to if statement below
	  //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 = '" . $products[$i]['id'] . "'
								   and pa.options_id = '" . $option . "'
								   and pa.options_id = popt.products_options_id
								   and pa.options_values_id = '" . $value . "'
								   and pa.options_values_id = poval.products_options_values_id
								   and popt.language_id = '" . $languages_id . "'
								   and poval.language_id = '" . $languages_id . "'");
	  $attributes_values = tep_db_fetch_array($attributes);

	  //clr 030714 determine if attribute is a text attribute and assign to $attr_value temporarily
	  if ($value == PRODUCTS_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;
	  //clr 030714 assign $attr_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'];
	}
  }

Apparently, things are OK for the text area, but not for the other ones. Perhaps you can post what you have for code (STS specific things in there?)

 

 

Hi Jan thank you so much for replying, really thank you.

 

Can you tell me specifically which files you would like to look at? I will post the codes for those. once again thank you so much for the reply!

Nothing unreal exists

Link to comment
Share on other sites

Well, I hope everyone can use this information in order to find the answer here to the updated code problem - as far as I can tell everything works gorgeous on my shopping_cart.php

 

What was wrong - in the original code for the install, and the one previously posted in this post does not include

 

"$attributes_values = tep_db_fetch_array($attributes);" - this is how the sql translates into the array - it took me forever to realize that '$attr_value = $attributes_values['products_options_values_name'];' was not declared anywhere in any of the inlucded files.

 

// 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'])) {

//clr 030714 move hidden field to if statement below

//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);

//clr 030714 determine if attribute is a text attribute and assign to $attr_value temporarily

if ($value == PRODUCTS_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];

print(PRODUCTS_OPTIONS_VALUE_TEXT_ID);

print($attr_value .': <br />');

} else {

echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);

$attr_value = $attributes_values['products_options_values_name'];

print(PRODUCTS_OPTIONS_VALUE_TEXT_ID);

print($attr_value .': <br />');

}

 

$products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'] .': ';

$products[$i][$option]['options_values_id'] = $value;

//clr 030714 assign $attr_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'];

}

}

}

 

 

Thanks again JanZ for allowing me to know which code was offending -

 

PS - STS does not seem to be the problem for this particular problem, however I am not using a product_info.php STS template page

 

NOTE: There are print() commands in there - so you can see what is happening, just comment them out. -Cheers!

Nothing unreal exists

Link to comment
Share on other sites

PS - STS does not seem to be the problem for this particular problem, however I am not using a product_info.php STS template page

 

NOTE: There are print() commands in there - so you can see what is happening, just comment them out. -Cheers!

Paul, glad to see it working for you. I would go ahead and try the product_info template to just see if you have any issues with this contribution. I do not think you will. :thumbsup:

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

  • 10 months later...

Hi,

I've installed STS v4.5.8 and option_type_feature-v1.5.

 

I've created a Quantity radio button option, with 3, 6, and 9 values.

 

The attirbutes has the following values

 

Quantity Price

3 10.55€

6 19.00€

9 27.00€

 

When I add a product and select, for example Quantity 6 - Price 19.00 € the shopping_cart page shows a price of -8.45EUR.

 

I've seen that something similar is achieved in the demo http://www.openstoresolutions.com/demos/catalog/index.php.

If possible in this contribution to configure an option that allows to explained above, how is this achived? or should I use anothere contrib as Price_Break_Per_Products.

 

Thanks a lot

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.
Note: Your post will require moderator approval before it will be visible.

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