Guest Posted January 11, 2006 Posted January 11, 2006 One of my clients has sales representatives, and warehouses in over 25 states. They have to charge sales tax to customers ordering from those states. There is a program called Certitax from CCH (esalestax.com), that will calculate the appropriate state/county sales tax on thier orders. Has anybody ever used certitax in OSCommerce? I am going to start working on a contribution for it today, but if anybody has already done this I would like see how you did it. Or if you can give me any useful advice/help I would appreciate it.
Guest Posted January 30, 2006 Posted January 30, 2006 I have been working on this CertiTax Mod and I need some advice. Right now I have php code that can post customer data (zip / nation) and the order total to the certitax server and it will return the correct sales tax. I need to integrate this code into the code that defines what the tax is in OScommerce. I think I need to modify "catalog/includes/functions/general.php" to do this. Are there any other OSC scripts that I need to look at? Can I put the certitax code right into general.php, or should I make a separate file and include it? Here is the code that will return the sales tax value from certitax: <?php error_reporting(E_ALL ^ E_NOTICE); require_once('/server_path_to/nusoap.php'); $wsdl = "https://webservices.esalestax.net/CertiTAX.NET/CertiCalc.asmx?WSDL"; $client = new soapclient($wsdl,"wsdl"); $soapAction = "http://webservices.esalestax.net/CertiTAX.NET/Calculate_NORID"; $soapNamespace = "http://webservices.esalestax.net/CertiTAX.NET"; $Order["SerialNumber"] = "<Serial Numer>"; $Order["Location"] = ""; $Order["MerchantTransactionId"] = "< ID >"; $Order["Nexus"] = "POS"; $Order["PostalCode"] = "< POSTAL CODE VARIABLE HERE >"; $Order["Nation"] = "< NATION VARIABLE HERE >"; $Order["ShippingCharge"] = "< SHIPPING VARIABLE HERE >"; $Order["Total"] = "< ORDER TOTAL VARIABLE HERE >"; $mysoapmsg = '<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://webservices.esalestax.net/CertiTAX.NET" xmlns:types="http://webservices.esalestax.net/CertiTAX.NET/encodedTypes" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <tns:Calculate> <SerialNumber xsi:type="xsd:string">' .$Order["SerialNumber"].'</SerialNumber> <Location xsi:type="xsd:string">'.$Order["Location"].'</Location> <MerchantTransactionId xsi:type="xsd:string">'.$Order["MerchantTransactionId"].'</MerchantTransactionId> <Nexus xsi:type="xsd:string">'.$Order["Nexus"].'</Nexus> <Name xsi:type="xsd:string">'.$Order["Name"].'</Name> <Street1 xsi:type="xsd:string">'.$Order["Street1"].'</Street1> <Street2 xsi:type="xsd:string">'.$Order["Street2"].'</Street2> <City xsi:type="xsd:string">'.$Order["City"].'</City> <County xsi:type="xsd:string">'.$Order["County"].'</County> <State xsi:type="xsd:string">'.$Order["State"].'</State> <PostalCode xsi:type="xsd:string">'.$Order["PostalCode"].'</PostalCode> <Nation xsi:type="xsd:string">'.$Order["Nation"].'</Nation> <ShippingCharge xsi:type="xsd:decimal">'.$Order["ShippingCharge"].'</ShippingCharge> <HandlingCharge xsi:type="xsd:decimal">'.$Order["HandlingCharge"].'</HandlingCharge> <Total xsi:type="xsd:decimal">'.$Order["Total"].'</Total> <CalculateTax xsi:type="xsd:boolean">'.$Order["CalculateTax"].'</CalculateTax> <ConfirmAddress xsi:type="xsd:boolean">'.$Order["ConfirmAddress"].'</ConfirmAddress> <DefaultProductCode xsi:type="xsd:int">'.$Order["DefaultProductCode"].'</DefaultProductCode> <TaxExemptCertificate xsi:type="xsd:string">'.$Order["TaxExemptCertificate"].'</TaxExemptCertificate> <TaxExemptIssuer xsi:type="xsd:string">'.$Order["TaxExemptIssuer"].'</TaxExemptIssuer> <TaxExemptReason xsi:type="xsd:string">'.$Order["TaxExemptReason"].'</TaxExemptReason> </tns:Calculate> </soap:Body></soap:Envelope>'; print_r("*****************************************************\n"); print_r(" SAMPLE ORDER DETAILS\n"); print_r("*****************************************************\n"); print_r($Order); $response = $client->send($mysoapmsg, $soapAction); if ($client->fault) { echo '<h3>Fault</h3><pre>'; print_r($response); echo '</pre>'; } else { print_r ("\n**************************************************\n"); print_r("RAW Response:\n"); print_r ("**************************************************\n"); print_r($response); print_r ("\n**************************************************\n"); // drill down to TotalTax in the response Array $searchresult = $response["Calculate_NORIDResult"]; print_r("\n*****************************************************\n"); print_r("RESULT:\n"); print_r("Order Total:". $Order["Total"]." Tax: " . $searchresult["TotalTax"]); print_r("\n*****************************************************\n"); } ?> Any advice on this topic will help me out alot.
mikey boy Posted March 15, 2006 Posted March 15, 2006 I'm interested in this suggesion, becuase it pertains to a need I have for my website. I think, from what I can tell, that the total price charged to a credit card or PayPal is $Order ["Total"]. This is the value of the order, plus any tax & S&H. The reason why I am interested is becuase I want the OsC confirmation page to show how much a customer credit card has been charged AFTER the charge has gone through. SO far I've not been able to make it work & cannot find any documentation on OsC's variables. Can anyone confirm that $Order ["Total"] is what I'm looking for? Thanks. Mike I have been working on this CertiTax Mod and I need some advice. Right now I have php code that can post customer data (zip / nation) and the order total to the certitax server and it will return the correct sales tax. I need to integrate this code into the code that defines what the tax is in OScommerce. I think I need to modify "catalog/includes/functions/general.php" to do this. Are there any other OSC scripts that I need to look at? Can I put the certitax code right into general.php, or should I make a separate file and include it? Here is the code that will return the sales tax value from certitax: <?php error_reporting(E_ALL ^ E_NOTICE); require_once('/server_path_to/nusoap.php'); $wsdl = "https://webservices.esalestax.net/CertiTAX.NET/CertiCalc.asmx?WSDL"; $client = new soapclient($wsdl,"wsdl"); $soapAction = "http://webservices.esalestax.net/CertiTAX.NET/Calculate_NORID"; $soapNamespace = "http://webservices.esalestax.net/CertiTAX.NET"; $Order["SerialNumber"] = "<Serial Numer>"; $Order["Location"] = ""; $Order["MerchantTransactionId"] = "< ID >"; $Order["Nexus"] = "POS"; $Order["PostalCode"] = "< POSTAL CODE VARIABLE HERE >"; $Order["Nation"] = "< NATION VARIABLE HERE >"; $Order["ShippingCharge"] = "< SHIPPING VARIABLE HERE >"; $Order["Total"] = "< ORDER TOTAL VARIABLE HERE >"; $mysoapmsg = '<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://webservices.esalestax.net/CertiTAX.NET" xmlns:types="http://webservices.esalestax.net/CertiTAX.NET/encodedTypes" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <tns:Calculate> <SerialNumber xsi:type="xsd:string">' .$Order["SerialNumber"].'</SerialNumber> <Location xsi:type="xsd:string">'.$Order["Location"].'</Location> <MerchantTransactionId xsi:type="xsd:string">'.$Order["MerchantTransactionId"].'</MerchantTransactionId> <Nexus xsi:type="xsd:string">'.$Order["Nexus"].'</Nexus> <Name xsi:type="xsd:string">'.$Order["Name"].'</Name> <Street1 xsi:type="xsd:string">'.$Order["Street1"].'</Street1> <Street2 xsi:type="xsd:string">'.$Order["Street2"].'</Street2> <City xsi:type="xsd:string">'.$Order["City"].'</City> <County xsi:type="xsd:string">'.$Order["County"].'</County> <State xsi:type="xsd:string">'.$Order["State"].'</State> <PostalCode xsi:type="xsd:string">'.$Order["PostalCode"].'</PostalCode> <Nation xsi:type="xsd:string">'.$Order["Nation"].'</Nation> <ShippingCharge xsi:type="xsd:decimal">'.$Order["ShippingCharge"].'</ShippingCharge> <HandlingCharge xsi:type="xsd:decimal">'.$Order["HandlingCharge"].'</HandlingCharge> <Total xsi:type="xsd:decimal">'.$Order["Total"].'</Total> <CalculateTax xsi:type="xsd:boolean">'.$Order["CalculateTax"].'</CalculateTax> <ConfirmAddress xsi:type="xsd:boolean">'.$Order["ConfirmAddress"].'</ConfirmAddress> <DefaultProductCode xsi:type="xsd:int">'.$Order["DefaultProductCode"].'</DefaultProductCode> <TaxExemptCertificate xsi:type="xsd:string">'.$Order["TaxExemptCertificate"].'</TaxExemptCertificate> <TaxExemptIssuer xsi:type="xsd:string">'.$Order["TaxExemptIssuer"].'</TaxExemptIssuer> <TaxExemptReason xsi:type="xsd:string">'.$Order["TaxExemptReason"].'</TaxExemptReason> </tns:Calculate> </soap:Body></soap:Envelope>'; print_r("*****************************************************\n"); print_r(" SAMPLE ORDER DETAILS\n"); print_r("*****************************************************\n"); print_r($Order); $response = $client->send($mysoapmsg, $soapAction); if ($client->fault) { echo '<h3>Fault</h3><pre>'; print_r($response); echo '</pre>'; } else { print_r ("\n**************************************************\n"); print_r("RAW Response:\n"); print_r ("**************************************************\n"); print_r($response); print_r ("\n**************************************************\n"); // drill down to TotalTax in the response Array $searchresult = $response["Calculate_NORIDResult"]; print_r("\n*****************************************************\n"); print_r("RESULT:\n"); print_r("Order Total:". $Order["Total"]." Tax: " . $searchresult["TotalTax"]); print_r("\n*****************************************************\n"); } ?> Any advice on this topic will help me out alot.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.