示例#1
0
        public override PushState Update(string destinationId = null)
        {
            var destId    = !string.IsNullOrWhiteSpace(destinationId) ? destinationId : IndexedItem.GetDestinationId();
            var pushState = PushState.Success;

            soap.SetOptions(Adapter.Options);
            try
            {
                var websiteIds = Regex.Split(Options.FirstOrDefault(o => o.Name == "website_ids").Value, "[,;|]", RegexOptions.Multiline | RegexOptions.IgnoreCase);
                var storeIds   = Regex.Split(Options.FirstOrDefault(o => o.Name == "store_ids").Value, "[,;|]", RegexOptions.Multiline | RegexOptions.IgnoreCase);

                soap.Begin();
                var client = soap.GetClient();
                foreach (var storeId in storeIds)
                {
                    client.catalogProductMultiUpdateAsync(soap.GetSession(), new[] { destId },
                                                          new[]
                    {
                        new catalogProductCreateEntity
                        {
                            website_ids = websiteIds,
                            status      = "1"
                        }
                    },
                                                          storeId,
                                                          "id");
                }
            }
            finally
            {
                soap.End();
            }
            return(pushState);
        }
 public override PushState Update(string destinationId = null)
 {
     destinationId = string.IsNullOrWhiteSpace(destinationId) ? IndexedItem.GetDestinationId() : destinationId;
     return(UpdateProduct(destinationId));
 }
        public override PushState Create(out string destinationId)
        {
            destinationId = IndexedItem.GetDestinationId();

            return(UpdateProduct(destinationId));
        }
 public override string GetDestinationId()
 {
     return(IndexedItem.GetDestinationId());
 }
示例#5
0
 public override PushState Update(string destinationId = null)
 {
     destinationId = !string.IsNullOrWhiteSpace(destinationId) ? destinationId : IndexedItem.GetDestinationId();
     return(UpdateStock(destinationId));
 }