Author |
Topic |
|
kumar
Starting Member
Thailand
18 Posts |
Posted - June 01 2012 : 04:48:53
|
In make an offer whe a customers enters a value it says email has been sent......Lets say for example my product value is US$300.00 and my customer enter a value zero, or a negative number or a value higher than US$300.00 then an error message should pop up stating "please reenter the offer- value lesser than the product cost/zeros and negative numbers are invalid"
How to do it! |
|
carfin
VP-CART Expert
United Kingdom
948 Posts |
Posted - June 01 2012 : 09:16:16
|
Hi Kumar,
first add a new language record eg langOfferPriceError with a caption like "Please enter Offer amount again, negative numbers are not allowed" Reset your language
Open file shopmakeanoffer.asp Find Sub ValidateData() Then find If not isnumeric(stroffer) then serror=serror & getlang("LangUserPriceError") & " " & getlang("Langmakeanoffer") & "<br />" end if Add the following lines with your new error message: If stroffer<0.01 then serror=serror & getlang("langOfferPriceError ") & "<br />" end if
Save and upload.
Hope this helps,
Carrol www.deanston-electrical.co.uk |
|
|
kumar
Starting Member
Thailand
18 Posts |
Posted - June 04 2012 : 02:39:31
|
Hi carrol, Impressive..... I have seen your help notes and it is way too helpful.....I have 2 more questions....how to add a new language record .... and i guess this code is for negative numbers and zeros; could you also help me out with other fields like a value higher than the cost price also.... |
|
|
carfin
VP-CART Expert
United Kingdom
948 Posts |
Posted - June 04 2012 : 04:18:00
|
Adding a new record for the language table is very straightforward and can be found in the help manual which you should have downloaded when you purchased the product.
As for the value higher than the product price:
Add a new language record as before eg langOfferPriceTooHigh with a caption like "You have entered an amount greater than the product price, please try again" Reset your language
Same as before, open file shopmakeanoffer.asp and save a copy Find Sub ValidateData() Add the following lines at the beginning of the sub dim offerprice offerprice=prs("cprice") then add the check for a higher offer price: If stroffer>offerprice then serror=serror & getlang("LangUserPriceError") & " " & getlang("Langmakeanoffer") & "<br />" end if Save, upload and test
Regards,
Carrol www.deanston-electrical.co.uk
|
|
|
kumar
Starting Member
Thailand
18 Posts |
Posted - June 04 2012 : 09:58:16
|
Hi Carrol... Thank you so very much for your instant and brilliant soluton. The negative numbers and zero is now not accepting under make an offer. As for the value higher than the product price... its not working :( It says " Amount must be numeric for Make an offer" Can you please check for me and explain me under which line i have to insert the code. Your help will be very much appreciated. Thanks again
|
|
|
carfin
VP-CART Expert
United Kingdom
948 Posts |
Posted - June 04 2012 : 11:41:45
|
Hi Kumar,
Open shopmakeanoffer.asp and save a copy. Copy and paste this whole sub over the existing sub in your file The blue text is the custom code The green text is for you to change to your 2 new language records.
Sub ValidateData() '*** Custom variables dim offerprice offerprice=prs("cprice") '*** end custom Validatefield getlang("langYourName"), "Custname", strCustname,"No" Validatefield getlang("langYourEmail"), "Custemail", strCustemail,"No" Validatefield getlang("langcustPhone"), "phone", strcustphone,"No" Validatefield getlang("langproductquantity"), "quantity", strquantity,"No" Validatefield getlang("langproductoffer"), "Offer", strOffer,"No" If serror="" then If not isnumeric(strquantity) then serror=serror & getlang("langproductquantity") &"<br />" end if end if If Serror<>"" then Serror= getlang("LangCommonRequired") & "<br />" & SError strquantity="" exit sub end if If Not InStr(strcustemail, "@") > 1 Then Serror=Serror & getlang("LangInvalidEmail") & "<br />" end if '*** Custom user input check for zero, negative or greater than cost prices If not isnumeric(stroffer) then serror=serror & getlang("LangUserPriceError") & " " & getlang("Langmakeanoffer") & "<br />" else If stroffer<0.01 then serror=serror & getlang("LangUserPriceZero") & "<br />" else If stroffer>offerprice then serror=serror & getlang("LangUserPriceHigh") & "<br />" end if end if end if '*** end custom End sub
Save, upload and test.
Regards,
Carrol www.deanston-electrical.co.uk |
|
|
kumar
Starting Member
Thailand
18 Posts |
Posted - June 04 2012 : 12:41:52
|
Hi Carrol. I thank you very much for your kind help and swift response. I entered your new revised code. Now zero and negative numbers are not accepted :) , but it says "You have entered an amount greater than the product price, please try again" (the comment i have given if customer enter more than the listed price) to all the price :( ..... Say for eg: A product is listed for $300.00 , it shows the above comment, even if i type less than $300.00 . The comment should be enabled , only if the customer enters above $300. It should work fine , from 1 to 300. I believe you will resolve my problem. THANK YOU SO MUCH AGAIN :) Kindest regards Kumar |
|
|
kumar
Starting Member
Thailand
18 Posts |
Posted - June 04 2012 : 13:02:10
|
HI carrol. I forgot to say something... i dont use Validatefield getlang("langproductquantity"), "quantity", strquantity,"No"
All my products are sold as single. I do not deal with lot or quantity's.
I very much look forward your reply and solution. thanks again. Kindest regards |
|
|
kumar
Starting Member
Thailand
18 Posts |
Posted - June 05 2012 : 00:16:51
|
Hi Carrol, I very much look forward your email. Please help me.
|
|
|
carfin
VP-CART Expert
United Kingdom
948 Posts |
Posted - June 05 2012 : 04:09:29
|
Hi Kumar,
sorry, I am quite busy at work just now preparing to go on holiday for 3 weeks.
Try this please:
Sub ValidateData() '*** Custom variables dim offerprice offerprice=prs("cprice") offerprice=shopformatcurrency(cprice,Getconfig("xdecimalpoint")) '*** end custom Validatefield getlang("langYourName"), "Custname", strCustname,"No" Validatefield getlang("langYourEmail"), "Custemail", strCustemail,"No" Validatefield getlang("langcustPhone"), "phone", strcustphone,"No" Validatefield getlang("langproductquantity"), "quantity", strquantity,"No" Validatefield getlang("langproductoffer"), "Offer", strOffer,"No" If serror="" then If not isnumeric(strquantity) then serror=serror & getlang("langproductquantity") &"<br />" end if end if If Serror<>"" then Serror= getlang("LangCommonRequired") & "<br />" & SError strquantity="" exit sub end if If Not InStr(strcustemail, "@") > 1 Then Serror=Serror & getlang("LangInvalidEmail") & "<br />" end if '*** Custom user input check for zero, negative or greater than cost prices If not isnumeric(stroffer) then serror=serror & getlang("LangUserPriceError") & " " & getlang("Langmakeanoffer") & "<br />" stroffer="" exit sub end if If stroffer<0.01 then serror=serror & getlang("LangUserPriceZero") & "<br />" stroffer="" exit sub end if If shopformatcurrency(stroffer,Getconfig("xdecimalpoint"))>offerprice then serror=serror & getlang("LangUserPriceHigh") & "<br />" stroffer="" exit sub end if '*** end custom End sub
Regards,
Carrol www.deanston-electrical.co.uk |
Edited by - carfin on June 05 2012 04:27:04 |
|
|
kumar
Starting Member
Thailand
18 Posts |
Posted - June 05 2012 : 06:10:37
|
Hi Carrol, Thank you very much for your email with the code. I did inserted the new code, it says : Microsoft VBScript runtime error '800a000d'
Type mismatch: 'cdbl'
(irrespective of the amount we type). I look forward your email. Happy Journey :) rgds Kumar |
|
|
carfin
VP-CART Expert
United Kingdom
948 Posts |
Posted - June 05 2012 : 07:08:19
|
I have tested this thoroughly and it works perfectly
Sub ValidateData() '*** Custom variables dim offerprice offerprice=prs("cprice") offerprice=shopformatcurrency(offerprice,Getconfig("xdecimalpoint")) '*** end custom Validatefield getlang("langYourName"), "Custname", strCustname,"No" Validatefield getlang("langYourEmail"), "Custemail", strCustemail,"No" Validatefield getlang("langcustPhone"), "phone", strcustphone,"No" Validatefield getlang("langproductquantity"), "quantity", strquantity,"No" Validatefield getlang("langproductoffer"), "Offer", strOffer,"No" If serror="" then If not isnumeric(strquantity) then serror=serror & getlang("langproductquantity") &"<br />" end if end if If Serror<>"" then Serror= getlang("LangCommonRequired") & "<br />" & SError strquantity="" exit sub end if If Not InStr(strcustemail, "@") > 1 Then Serror=Serror & getlang("LangInvalidEmail") & "<br />" end if
'*** Custom user input check for zero, negative or greater than cost prices If not isnumeric(stroffer) then serror=serror & getlang("LangUserPriceError") & " " & getlang("Langmakeanoffer") & "<br />" stroffer="" exit sub end if If stroffer<0.01 then serror=serror & getlang("LangUserPriceZero") & "<br />" stroffer="" exit sub end if If shopformatcurrency(stroffer,Getconfig("xdecimalpoint"))>offerprice then serror=serror & getlang("LangUserPriceHigh") & "<br />" stroffer="" exit sub end if End sub
Regards,
Carrol www.deanston-electrical.co.uk |
|
|
kumar
Starting Member
Thailand
18 Posts |
Posted - June 05 2012 : 09:58:06
|
HI carrol thank you very much for your time. unfortunately, it does'nt work completely :( It does work for negatives and zero's, but if we enter any amount other than negatives and zero's , even if it is below the cost price, it says " You have entered an amount greater than the product price, please try again. " I know you should be busy in preparing for your holiday trip. May be , i will get a solution from you after your return. Happy journey regards kumar
|
|
|
kumar
Starting Member
Thailand
18 Posts |
Posted - June 05 2012 : 10:09:53
|
Also carrol. i tried several times with different numbers (less and more than the cost price) . it randomly accepts some numbers but some not :( For eg: The listed priceis $300.00 I tried with 99 , it did'nt work when i tried with 27 it worked !!! regards kumar |
|
|
kumar
Starting Member
Thailand
18 Posts |
Posted - June 05 2012 : 10:37:23
|
Hi carrol one more hint..... 3 digit number is accepting but not singl or 2 digit. Say - the listed price is $300.00 , the coding accepts if any 3 digit number less than 300 is entered but not 1 or 2 digit. thanks |
|
|
|
Topic |
|