Community Forums 

Main Content

Remot Call not working

    Jul 28 2013 18:47:18

    #1

    Lynn Greene

    Join date : 2011-07-25      Posts : 20

    I've taken a remote call that works from one of my websites, and used it as a starting point for my new website.

    I've tested the remote call using a form with the variables, and it works.

    When I test using the shopping cart, I notice these things things:

    1) When I look at the order detail on the mals website, the order looks as expected except that the Payment Method is shown as Other3.

    NOTE 1: I have set up another payment option Standard Methods/Payment option/Other Payment Options in the 3rd row ad "Purchase Order".
    NOTE 2: In Advanced Settings/Collect Additional Data/First Field (required input) I have asked how the customer learned about us. This information is shown in the order details on the mals website.

    2) The customer e-mail received contains everything as expected, except it shows Payment by: Other 3 instead of Purchase Order.

    3) The e-mail I received as the seller is as expectd - no problems.

    4) The remote call for this order collected absolutely no data in my database, yet it worked great from my form.

    Problem 1: How do I change the customer e-mail and the the order on mals website to show payment by Purchase Order instead of Other3?

    Problem 2: This is the Major Problem, how do I intercept what is being fed to me from the shopping cart for an order to be paid for by Purchase Order? Is there another way to handle a Purchase Order?

    Thank you!

    Lynn Greene
    The Cornice Store
    www.cornicestore.com




    Jul 28 2013 19:15:55

    #2

    Debbie Q

    Join date : 2008-09-18      Posts : 4994

    Check the url of your remote call script: Cart Setup/advanced settings/remote call

    Debbie Q

    Mal's Support: www.mals-e.com/support.php
    GT's Forms and examples: www.malsforms.com
    Helpful java scripts: www.gemasana.com/mals
    Shipping help documents: www.stoner.org.uk/mals

    My Create-A-Book Publishing - mycreateabook.com
    Personalized Books, Music CDs and Gifts for all ages and occasions.

    Please help me out and share my site on your networks.




    Jul 28 2013 19:30:25

    #3

    Lynn Greene

    Join date : 2011-07-25      Posts : 20

    Debbie Q said Check the url of your remote call script: Cart Setup/advanced settings/remote call

    I copied and pasted the URL into my browser. No complaints by the browser, and the database was updated with all fields empty.

    Any other ideas?

    Lynn Greene
    The Cornice Store
    www.cornicestore.com




    Jul 28 2013 20:53:15

    #4

    Lynn Greene

    Join date : 2011-07-25      Posts : 20

    Ooops - Item 2) is working properly, so Problem 1) doesn't exist.

    Problem 2 remains.

    Problem 3: I have debug mode turned on, after being unchecked for a couple of hours, and continuing to perform testing. I'm not receiving the output from my script in an e-mail.

    Lynn Greene
    The Cornice Store
    www.cornicestore.com




    Jul 30 2013 00:32:52

    #5

    anon

    Join date : 2008-09-18      Posts : 488

    It is hard to tell what is wrong without seeing your remote call script code.

    Does the method (get/post) you set in the cart match what your test form is using (and what your script is looking for)?



    Jul 30 2013 01:05:58

    #6

    Lynn Greene

    Join date : 2011-07-25      Posts : 20

    anon said It is hard to tell what is wrong without seeing your remote call script code.

    Does the method (get/post) you set in the cart match what your test form is using (and what your script is looking for)?


    Here is my remote call script code:

    // this code is called after payment through Mal's Shopping Cart
    foreach ( $_POST AS $ky=>$vl ) {
    $variable[$ky] = $vl;
    }
    // $variable['date'] = "2 Aug 2011 - 19:26";
    // print_r ($variable);
    $offset=strpos($variable['date'], ' - ');
    $variable['date'] = substr($variable['date'],0,$offset);
    $mo['Jan']="01";
    $mo['Feb']="02";
    $mo['Mar']="03";
    $mo['Apr']="04";
    $mo['May']="05";
    $mo['Jun']="06";
    $mo['Jul']="07";
    $mo['Aug']="08";
    $mo['Sep']="09";
    $mo['Oct']="10";
    $mo['Nov']="11";
    $mo['Dec']="12";
    $offset = strpos($variable['date'], " ");
    $day = substr("0".substr($variable['date'],0,$offset),-2);
    $month=substr($variable['date'],$offset+1,3);
    $year=substr($variable['date'],-4);
    $variable['date']=$year."-".$mo[$month]."-".$day;
    $cart = "";
    $cart_left = $variable['cart'];
    while ($cart_left != "") {
    $offset = strpos($cart_left, ' : ');
    $description = substr($cart_left,0,$offset+1);
    // echo "cart=$cart!<BR>";
    $cart_left = substr($cart_left,$offset+3);
    $offset = strpos($cart_left," ");
    $quantity = substr($cart_left,0,$offset);
    if ($cart == "") {
    $cart = $quantity." each - ".$description."\n";
    } else {
    $cart.= $quantity." each - ".$description."\n";
    }
    $offset = strpos($cart_left, '~');
    if ($offset > 0) {
    $cart_left = substr($cart_left,$offset+1);
    } else {
    $cart_left = "";
    }
    }
    $variable['cart'] = $cart;
    $offset=strpos($variable['inv_name'], ' ');
    $variable['inv_first_name'] = substr($variable['inv_name'],0,$offset);
    $variable['inv_last_name'] = substr($variable['inv_name'],$offset+1);
    $thankyou_notification = "";
    $source = "clickandlearn.com";
    $order_date = "0000-00-00";
    $item = $variable['cart'];
    $ship_date ="0000-00-00";
    $shipped_notification ="";
    $processing_fee ="";
    $timestamp = date('Y-m-d H:i:s');
    if ($variable['inv_country'] == "US") {$variable['inv_country'] = "United States";}
    Include ('mysql_connect.inc');
    $next_key = 1;
    $start_break = false;
    $query = "SELECT * FROM `sales` order by `key`" ;
    // echo "query=$query<br>";
    $result = mysql_query( $query ) ;
    // echo "Results:<br>".$result."<br>";
    if ($result != "") {
    $num_results = mysql_num_rows ($result);
    // echo $num_results." items<br>";
    for ($i=0; $i <= $num_results; $i++)
    {
    $row = mysql_fetch_array($result) ;
    $key = $row['key'] ;
    if ($key >= $key_start && $start_break == false)
    {
    // echo "$key - Entry<br>";
    if ($key != $next_key)
    {
    $start_break = true;
    } else {
    // echo "Key=$key<br>";
    $next_key = $key + 1;
    }
    }
    }
    }
    // echo "<BR>";
    // echo "Method=".$variable['method']."<BR>";
    // echo "First Name=".$variable['inv_first_name']."<BR>";
    // echo "Last Name=".$variable['inv_last_name']."<BR>";
    // echo "Name=".$variable['inv_name']."<BR>";
    // echo "Company=".$variable['inv_company']."<BR>";
    // echo "Address1=".$variable['inv_addr1']."<BR>";
    // echo "Address2=".$variable['inv_addr2']."<BR>";
    // echo "State=".$variable['inv_state']."<BR>";
    // echo "Zip=".$variable['inv_zip']."<BR>";
    // echo "Country=".$variable['inv_country']."<BR>";
    // echo "Telephone=".$variable['tel']."<BR>";
    // echo "E-Mail=".$variable['email']."<BR>";
    // echo "IP Address=".$variable['ip']."<BR>";
    // echo "Cart=".$variable['cart']."<BR>";
    // echo "Total=".$variable['total']."<BR>";
    // echo "Tax=".$variable['tax']."<BR>";
    // echo "Fee=".$variable['mc_fee']."<BR>";
    // echo "Payment Date=".$variable['date']."<BR>";
    // echo "Thank you date=".$thankyou_notification."<BR>";
    // echo "Source=".$source."<BR>";
    // echo "Order Date=".$order_date."<BR>";
    // echo "Ship Date=".$ship_date."<BR>";
    // echo "Processing Fee=".$processing_fee."<BR>";
    // echo "Extra Data=".$variable['edata']."<BR>";
    // echo "Timestamp=".$timestamp."<BR>";
    // echo "Key=".$next_key."<BR>";
    $query = "INSERT INTO `sales` (`txn_type`,`first_name`,`last_name`,`address_name`,`address_company`,`address_street`,`address_city`,`address_state`,`address_zip`,`address_country`,`contact_phone`,
    `payer_email`,`ip`,`item_desc`,`mc_gross`,`tax`,`mc_fee`,`payment_date`,`thankyou_notification`,`source`,`order_date`,
    `ship_date`,`processing_fee`,`about`,`timestamp`,`key`) values
    ('".addslashes($variable['method'])."', '"
    .addslashes($variable['inv_first_name'])."', '"
    .addslashes($variable['inv_last_name'])."', '"
    .addslashes($variable['inv_name'])."', '"
    .addslashes($variable['inv_company'])."', '"
    .addslashes($variable['inv_addr1'])."', '"
    .addslashes($variable['inv_addr2'])."', '"
    .addslashes($variable['inv_state'])."', '"
    .addslashes($variable['inv_zip'])."', '"
    .addslashes($variable['inv_country'])."', '"
    .addslashes($variable['tel'])."', '"
    .addslashes($variable['email'])."', '"
    .addslashes($variable['ip'])."', '"
    .addslashes($variable['cart'])."', '"
    .addslashes($variable['total'])."', '"
    .addslashes($variable['tax'])."', '"
    .addslashes($variable['mc_fee'])."', '"
    .addslashes($variable['date'])."', '"
    .addslashes($thankyou_notification)."', '"
    .addslashes($source)."', '"
    .addslashes($order_date)."', '"
    .addslashes($ship_date)."', '"
    .addslashes($processing_fee)."', '"
    .addslashes($variable['edata'])."', '"
    .addslashes($timestamp)."', '"
    .addslashes($next_key)."')";
    $result = mysql_query( $query ) ;
    if ($result) {
    // echo mysql_affected_rows().' inserted into database.';
    } else {
    $emailtext.="Failed -".mysql_error()."!\n\n";
    }
    mysql_close($link);

    ?>

    Here is my cart HTML:

    <form action="http://ww7.aitsafe.com/cf/add.cfm"; method="post">
    <input type="hidden" name="userid" value="97404049">
    <input type="hidden" name="product[]" value="<?php echo $product; ?>">
    <input type="hidden" name="price" value="<?echo $price; ?>">
    <input type="hidden" name="units" value="0">
    <input type="hidden" name="qty" value="<?echo $qty; ?>">
    <input type="hidden" name="noqty" value="0">
    <input type="hidden" name="return" value='http://www.fiveneatthings.com/subscribe.php?submit=<?php echo $Subscribe; ?>'>
    <input type="submit" style="height: 30px; width: 450px; font-size:18px; font-family:arial" value="<?echo $Subscribe; ?>" name="submit">
    </form>

    The values are correct because they are correct in the e-mails that I received.

    Now, I'm wondering - the information in $product has a lot of new lines (\n). I'm wondering if that messes things up. I've seen somewhere how you can add additional information to the description in a different way. Maybe I have to parse $product for \n and enter the pieces in that manner. This should be easy to test.

    Any other ideas?

    Lynn Greene
    The Cornice Store
    www.cornicestore.com




    Jul 30 2013 03:57:45

    #7

    Lynn Greene

    Join date : 2011-07-25      Posts : 20

    Now, I'm wondering - the information in $product has a lot of new lines (\n). I'm wondering if that messes things up. I've seen somewhere how you can add additional information to the description in a different way. Maybe I have to parse $product for \n and enter the pieces in that manner. This should be easy to test.

    Any other ideas?

    Nope - changed the product description to a couple of words and same thing - database is filled with blanks.

    Lynn Greene
    The Cornice Store
    www.cornicestore.com




    Jul 30 2013 04:19:31

    #8

    Lynn Greene

    Join date : 2011-07-25      Posts : 20

    Problem fixed - what a dummy.

    I had GET instead of POST in the remote call setting.

    Problem closed.

    Lynn Greene
    The Cornice Store
    www.cornicestore.com