ارسال محصول از سایت...
 
آگاه‌سازی‌ها
پاک‌کردن همه

[حل شده] ارسال محصول از سایت به CRM

5 ارسال ها
2 کاربران
2 Likes
165 نمایش‌
0
شروع کننده موضوع

سلام

میخواستم محصولات سایت رو وارد CRM کنم.طبق مستندات پیش رفتم اما با خطا مواجه شدم.

$url = 'http://xxx.com/Services/API/IProduct.svc?Wsdl';
$soapClient = new SoapClient($url);
$params = array(
'userName' => $username,
'password' => $password,
'productInfo' => array(
'Name' => 'محصول تستی',
'Code' => '2',
'GroupName' => 'گروه اول',
'UnitBuyPrice' => 5000.00,
'UnitPrice' => 10000.00,
'ProductUnitType' => 'قطعه',
'TechInfo' => 'اطلاعات فنی تستی',
'Description' => 'توضیحات تستی',
'BuyAble' => true,
'Sellable' => true,
'Inventory' => true,
'Brand' => 'برند تست',
'MadeIn' => 'ایران',
'Taxable' => true,
)
);


خطا : محصول معتبر نیست
برچسب‌های موضوع
3 پاسخ
1

شما در کد ارسالیتون بجای productinfo از product استفاده کنید

$url = 'http://xxx.com/Services/API/IProduct.svc?Wsdl';
$soapClient = new SoapClient($url);
$params = array(
'userName' => $username,
'password' => $password,
'product' => array(
'Name' => 'محصول تستی',
'Code' => '2',
'GroupName' => 'گروه اول',
'UnitBuyPrice' => 5000.00,
'UnitPrice' => 10000.00,
'ProductUnitType' => 'قطعه',
'TechInfo' => 'اطلاعات فنی تستی',
'Description' => 'توضیحات تستی',
'BuyAble' => true,
'Sellable' => true,
'Inventory' => true,
'Brand' => 'برند تست',
'MadeIn' => 'ایران',
'Taxable' => true,
)
);
0

با سلام نمونه کد تست شده در .net

 

public class PgTestClientBase<TChannel> : ClientBase<TChannel> where TChannel : class
{
protected PgTestClientBase(string svcFilePath) : base(CreateServiceEndPoint(svcFilePath))
{
}

protected static ServiceEndpoint CreateServiceEndPoint(string svcPath)
{
ContractDescription desc = ContractDescription.GetContract(typeof(TChannel));
BasicHttpBinding binding = new BasicHttpBinding
{
MaxReceivedMessageSize = int.MaxValue,
MaxBufferPoolSize = int.MaxValue,
MaxBufferSize = int.MaxValue
};
binding.ReaderQuotas.MaxArrayLength = int.MaxValue;
binding.ReaderQuotas.MaxBytesPerRead = int.MaxValue;
binding.ReaderQuotas.MaxDepth = int.MaxValue;

if (!svcPath.StartsWith("/"))
{
svcPath = "/" + svcPath;
}

return new ServiceEndpoint(desc, binding, new EndpointAddress($"{ConfigurationManager.AppSettings["baseUrl"]}{svcPath}"));
}
}

---------------
public class ProductClient : PgTestClientBase<IProduct>, IProduct
{
public ProductClient() : base("/services/api/IProduct.svc")
{
}
public SaveCrmObjectResult SaveProduct(string userName, string password, ProductInfo product)
{
return Channel.SaveProduct(userName, password, product);
}
}

-------------- class test-------
ProductInfo productInfo = new ProductInfo();

productInfo.Code = "2";
productInfo.BuyAble = true;
productInfo.GroupId = null;
productInfo.Name = "تست";
productInfo.UnitPrice = 1000;
productInfo.UnitBuyPrice = 1000;
productInfo.GroupName = "گروه اول";
productInfo.Inventory= true,
productInfo.Brand ="برند تست";
productInfo."MadeIn" = "ایران";
productInfo.Taxable = true;
pro.Description="توضیحات تستی";
var saveProductResult = productWcfServiceTests.SaveProduct_Services(productInfo);
Assert.True(saveProductResult.Success);

mohammadk شروع کننده موضوع 18 آذر 1399 1:42 ب.ظ

API ما با زبان PHP قراره نوشته بشه.لطفا کد PHP بفرستید

0
شروع کننده موضوع

API ما با زبان PHP قراره نوشته بشه.لطفا کد PHP بفرستید

PG-Admin PG-Admin 19 آذر 1399 3:03 ب.ظ

دوست عزیز همانطور که در پاسخ قبلی نوشتم شما در کد ارسالی خودتون بجای productinfo از product استفاده کنید به احتمال زیاد باید مشکلتان حل شود

برای ما امکان ارسال کد php میسر نمیباشد

اشتراک:
پیمایش به بالا