cancel
Showing results for 
Search instead for 
Did you mean: 

Sync Problem

Sync Problem

I am using Soap Api in magento1.9 for addToCart process for mobile App....but the problem i am facing here is..

1. It is not synchronizing with my website and vice versa

2.Also Cart product items is disappear when we un-install the Mobile App(If we save it locally from mobile end).

 

I followed this link for web services: http://devdocs.magento.com/guides/m1x/api/soap/checkout/checkout.html 

 

pls help me to resolve these issue. How can i do Sync. Mobile App with Website and vice versa.

Thanks.

2 REPLIES

Re: Sync Problem

Hi @myjeptag,

 

I guess is a little bit hard to help because you aren't showing an error.

Also, since you're using your own app/integration, is hard to try to trace where the problem could be.

--
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"

Re: Sync Problem

Hello Damian,

     Have a look to my code,and pls resolve my issue.

 

<?php
 require_once '../app/Mage.php';
 Mage::app();
 require_once("dbcontroller.php");
 $db_handle = new DBController();
 //read JSon input
 $jsondata=file_get_contents('php://input');
 $js = json_decode($jsondata, true);
 $session_id = strtolower($js['session_id']);
 $cart_id = $js['cart_id'];
 $product_id = $js['product_id'];
 $qty = $js['qty'];
 
 if(!empty($session_id) && !empty($cart_id) && !empty($product_id) && !empty($qty)){
     
$config=array();
$config["hostname"] = "bshop2u.com";
  $opt = array('trace'=>1,'encoding'=>'utf-8');
   
 
$proxy = new SoapClient('http://'.$config["hostname"].'/index.php/api/soap/?wsdl', $opt);
 
  try{
   $arrProducts = array(
 array(
  "product_id" => $product_id,
  "qty" => $qty
 )
);

$resultCartProductAdd = $proxy->call(
 $session_id,
 "cart_product.add",
 array(
  $cart_id,
  $arrProducts
 )
);

   if ($resultCartProductAdd) {
    
       $json = array("error" => false, "message" => "Add to cart successfully!");
       
   } else {
    
     $json = array("error" => false, "message" => "Not added!");
     
   }  
        } catch (Exception $e){
 
    $json = array("error" => true, "message" => $e->getMessage());
  }  
    }else{
   
  $json = array("error" => true, "message" => "SessionID, CartID and Products not blank!");
 }
 
    header('Content-type: application/json, charset=UTF-8');
    echo json_encode($json);

?>

 

This is the code ,i am using . After Soap Login successful,it gives me sessionId,CartId .Using this i am writing web services for AddTocart. product is successfully Adding to Cart in Mobile App. But it is not synchronizing with website.Please help me.

 

Thanks