Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Force customers to choose from the "Available Options"


raindays

Recommended Posts

I have customers passing right by the options of the products and going directly to the payment area I recieve payment without knowing what they ordered.

 

How do I stop this from happening?

 

I would appreciate any help, thanks.

Link to comment
Share on other sites

If you want to force your customers to select an option from your product options menu, you could use a contribution I uploaded today(Enforce Attribute Select) - you can find it at http://www.oscommerce.com/community/contributions,3891

 

Hope this helps.

Who would have thought that so much can be created from 0`s and 1`s...

Link to comment
Share on other sites

No, you don't need to change any permissions. Can you paste your product_info.php page here so I will see how you edited the code?

Who would have thought that so much can be created from 0`s and 1`s...

Link to comment
Share on other sites

not trying to hijack your thread...but maybe you can help

 

http://www.oscommerce.com/forums/index.php?sho...31entry768231

 

trying to figure out how to set the default attribute option related to the contribution you are discussing.

 

See my reply in that thread

Who would have thought that so much can be created from 0`s and 1`s...

Link to comment
Share on other sites

  • 5 months later...

I'm all ready checking a script to make sure something else was checked before adding to the cart

 

I've got the check_conditions and now the validate script.

 

<script language="javascript" type="text/javascript"><!--
 function check_conditions() {
if( document.forms["cart_quantity"].products_accept &&
	document.forms["cart_quantity"].products_accept.checked == false ) {
	alert("You must agree to the terms and conditions to add this product to your cart");
	return false;
}
return true;
 }
//--></script>

 

<script language="javascript"><!--
// az - Start Enforce Attribute Select
function validate() {
if (cart_quantity.elements['id[1]'].value == 5) {
alert('Please select an option for the menu.');
cart_quantity.elements['id[1]'].focus();
return false;
}
}
// az - End Enforce Attribute Select
//--></script>

 

is there a way to make both scripts work together?

 

<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'onSubmit="return check_conditions();"'); ?>

 

<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'onSubmit="return validate(this);"'); ?>

.

Link to comment
Share on other sites

Since you can call only one function in the onSubmit you will need to join both functions into one. You could try doing the following for example:

 

<script language="javascript" type="text/javascript"><!--
 function check_conditions() {
if( document.forms["cart_quantity"].products_accept &&
	document.forms["cart_quantity"].products_accept.checked == false ) {
	alert("You must agree to the terms and conditions to add this product to your cart");
	return false;
}

			else if (cart_quantity.elements['id[1]'].value == 5) {
			alert('Please select an option for the menu.');
			cart_quantity.elements['id[1]'].focus();
			return false;
			}

return true;
 }
//--></script>

 

and have the body of the file have the following code

<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'onSubmit="return check_conditions(this);"'); ?>

 

I haven't tested the above code so I'm not sure if it needs any additional tweaking to make it work, but at least you'll have a direction as to how to modify the script.

Who would have thought that so much can be created from 0`s and 1`s...

Link to comment
Share on other sites

That worked great. Thank you very much!

 

Now one more quick question.

 

In some case I have more then one option for them to choose.

 

Would I just add a new check like this?

 

 

<script language="javascript" type="text/javascript"><!--
 function check_conditions() {
if( document.forms["cart_quantity"].products_accept &&
	document.forms["cart_quantity"].products_accept.checked == false ) {
	alert("You must agree to the terms and conditions to add this product to your cart");
	return false;
}

			else if (cart_quantity.elements['id[1]'].value == 5) {
			alert('Please select an option for the menu.');
			cart_quantity.elements['id[1]'].focus();
			return false;
			}
			else if (cart_quantity.elements['id[2]'].value == 6) {
			alert('Please select an option for the menu.');
			cart_quantity.elements['id[2]'].focus();
			return false;
			}
return true;
 }
//--></script>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...