Jump to content

i tried to custom a product with two custom fields and it doesn't work


iscato

Recommended Posts

Hi,
 
i tried to custom a product with two custom fields (image and textfield for an url) and when i save the customization on the front-end and then click to add to cart it doesn't work telling me that i need to fill the custom fields.
 
i found out that there is this function in tools.js in the root of the PS that checks the custom fields.
 
this is the function:

function checkCustomizations()
{
	var pattern = new RegExp(' ?filled ?');

	if (typeof customizationFields != 'undefined')
		for (var i = 0; i < customizationFields.length; i++)
		{
			/* If the field is required and empty then we abort */
			if (parseInt(customizationFields[i][1]) == 1 && ($('#' + customizationFields[i][0]).html() == '' ||  $('#' + customizationFields[i][0]).text() != $('#' + customizationFields[i][0]).val()) && !pattern.test($('#' + customizationFields[i][0]).attr('class')))
				return false;
		}
	return true;
}

doing some console.log() i found that is the image field is the one who returns false and and i'm not sure how to proceed now.

 

Someone has any idea?

 

Thanks.

 

this is the url to the product: http://fotonicho.es/fotoceramica/27-codigo-qr-para-lapidas-5x7cm.html

 

i am using PS 1.6.1.5

Link to comment
Share on other sites

Hi NemoPS,

 

it worked, thank you!!

 

There is only one more thing, when i click the save button of all the customitzation, if i do not upload an image it always save the customitzation and then it lets to add to cart.

 

I put the fields in required but it does it anyway.

 

can you help me again?  :rolleyes:

Link to comment
Share on other sites

The thing is that if you fill the text field and you didn't fill the image field, it let you save and add to cart.

 

The two fields are required.

 

It shouldn't let you save and add to cart if the two fields aren't filled.

 

To add to cart you need to previously save the customitzation

 

i did some css on the upload button of the image to let the customer know that he has to do that, but is not the best course of action, cause there is that little problem that may happen if the customer is silly enough.

 

http://fotonicho.es/fotoceramica/27-codigo-qr-para-lapidas-5x7cm.html

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...