Ejemplo n.º 1
0
        //Products
        public bool ProductsCreateWithInventory(Product item, bool rebuildSearchIndex)
        {
            if (item == null)
            {
                return(false);
            }
            if (item.UrlSlug.Trim().Length < 1)
            {
                item.UrlSlug = MerchantTribe.Web.Text.Slugify(item.ProductName, true, true);
            }

            bool result = this.Products.Create(item);

            if (rebuildSearchIndex)
            {
                SearchManager manager = new SearchManager();
                manager.IndexSingleProduct(item);
            }
            if (result)
            {
                InventoryGenerateForProduct(item);
                UpdateProductVisibleStatusAndSave(item);
            }
            return(result);
        }
Ejemplo n.º 2
0
 // Create or Update
 public override string PostAction(string parameters, System.Collections.Specialized.NameValueCollection querystring, string postdata)
 {
     string data = string.Empty;
     string objecttype = FirstParameter(parameters);
     string objectid = GetParameterByIndex(1, parameters);
     ApiResponse<bool> response = new ApiResponse<bool>();
     
     try
     {
         if (objecttype.Trim().ToLowerInvariant() == "products")
         {
             SearchManager m = new SearchManager();
             Product p = MTApp.CatalogServices.Products.Find(objectid);
             if (p != null)
             {
                 if (p.Bvin.Length > 0)
                 {
                     m.IndexSingleProduct(p);
                     response.Content = true;
                 }
             }                    
         }                                
     }
     catch(Exception ex)
     {
         response.Errors.Add(new ApiError("EXCEPTION", ex.Message));
         return MerchantTribe.Web.Json.ObjectToJson(response);                
     }
                 
     data = MerchantTribe.Web.Json.ObjectToJson(response);            
     return data;
 }
Ejemplo n.º 3
0
        public bool ProductsUpdateWithSearchRebuild(Product item)
        {
            bool success = this.Products.Update(item);

            if (success)
            {
                SearchManager manager = new SearchManager();
                manager.IndexSingleProduct(item);
            }
            return(success);
        }
Ejemplo n.º 4
0
 public bool ProductsUpdateWithSearchRebuild(Product item)
 {
     bool success = this.Products.Update(item);
     if (success)
     {
         SearchManager manager = new SearchManager();
         manager.IndexSingleProduct(item);
     }
     return success;
 }
Ejemplo n.º 5
0
        //Products
        public bool ProductsCreateWithInventory(Product item, bool rebuildSearchIndex)
        {
            if (item == null) return false;
            if (item.UrlSlug.Trim().Length < 1)
            {
                item.UrlSlug = MerchantTribe.Web.Text.Slugify(item.ProductName, true, true);
            }

            bool result = this.Products.Create(item);
            if (rebuildSearchIndex)
            {
                SearchManager manager = new SearchManager();
                manager.IndexSingleProduct(item);
            }
            if (result)
            {
                InventoryGenerateForProduct(item);
                UpdateProductVisibleStatusAndSave(item);
            }
            return result;
        }