Having replicated a site originally on a physical server to azure, I am unable to enter a value using the datatype Tea Commerce Stock Management whereas I can implement this successfully in the original back office.
In my original site the node id is inserted as the SKU along with the stock value (in the table TeaCommerce_Stock) but this does not occur in the azure-based site/db.
The Tea Commerce version is 3.0.7
The Umbraco is 7.3.4
I noticed the field "stock" is not retained in the xml.
I manually entered a value in the stock table but that makes no difference.
Finally, I did a check in the database and the tables cmsPropertyType, cmsPropertyTypeGroup and cmsContentType all match between the working version on the physical server and the non working version on azure.
Furthermore, just did a test to capture the event when Publishing and although it captures the property it does NOT capture the value (it captures the id and the name)
Finally, changing the datatype to a textfield saves the value which is also captured in the event handler therefore it looks like a bug in the teacommerce: stock management data type.
The stock is not saved in the DB as a property value - it is only saved in the special Tea Commerce stock DB table. So that is not a bug - that is by purpose.
You can download the Tea Commerce code for Umbraco here. Maybe you can debug and see what error is thrown. Is pretty weird that it works in one environment, and then you move it and then ti doesnt work anymore :)
Get Error 404 for "backoffice/teacommerce/products/getstock"
(NOTE: one of the constant bugbears of angular is caching. Whether "getstock" or "GetStock" makes any difference I have changed the path and still it displays the same. Event setting web.config to debug. Event using Tools to clear cached and hard reload. It quite often makes no difference. Having to rename files is a joke. So much for progress in programming)
Create my own control part replicating the teacomm process
Error thrown when referencing IXmlNodeProductInformationExtractor
Discovered the current version does not include it.
So created my own process to Get/Post Stock Value
by creating a Controller in App_Code (NewStockApiController.cs)
and a new model (called StockModel.cs)
which works.
NewStockApiController (in App_Code)
[Umbraco.Web.Mvc.PluginController("TPS")]
public class NewStockApiController : UmbracoAuthorizedJsonController
{....
public TeaCommerce.Umbraco.Application.Controllers.ProductsController.Stock GetStock(string pageId)
{
TeaCommerce.Umbraco.Application.Controllers.ProductsController.Stock stock1 = new TeaCommerce.Umbraco.Application.Controllers.ProductsController.Stock();
stock1.Sku = "";
stock1.Value = "";
try
{
YOUR NAMESPACE.Models.StockModel.dbContextShopper stockProperties = new YOUR NAMESPACE.Models.StockModel.dbContextShopper();
var results = stockProperties.Database.SqlQuery<YOURNAMESPACE.Models.StockModel.stockProps>("Select * from [" + dbToUse + "].[dbo].[TeaCommerce_Stock] where StoreID = " + StoreId + " and SKU = '" + pageId + "'");
foreach (var item in results)
{
string[] splitStock = item.stock.ToString().Split('.');
string stockValToUse = splitStock[0];
stock1.Sku = item.SKU.ToString();
stock1.Value = stockValToUse;
}
}
catch (Exception dbEr){ }
return stock1;
}
public string PostStock(string pageId, TeaCommerce.Umbraco.Application.Controllers.ProductsController.Stock stock)
{
string val = "";
long storeId = 1;
decimal stockVal = Decimal.Parse(stock.Value);
ProductService.Instance.SetStock(1, pageId, stockVal);
return val;
}
[Table("TeaCommerce_Stock")]
public class stockProps
{
[Key]
public virtual long storeID { get; set; }
public virtual string SKU { get; set; }
public virtual Decimal stock { get; set; }
}
public class dbContextShopper : DbContext
{
public dbContextShopper() : base("dbContextShopper") { }
public DbSet<stockProps> Stock { get; set; }
}
Originally I thought this had some connection between platforms (physical server and azure) but it is inconsistencies in versions and when paying licence fees I think it is a bit galling to be expected to root out problems and fix them. That is something I would expect Tea Commerce staff/developers to fulfil.
Sse that you solved your issue. What I would like to know is what is different from your local setup that worked and the Azure?
Just downloaded the starter kit running latest Umbraco and Tea Commerce and the products have a stock management data type - and all is working. So just wondering what might be different in your case since you got the 404 error.
Stock Management
Having replicated a site originally on a physical server to azure, I am unable to enter a value using the datatype Tea Commerce Stock Management whereas I can implement this successfully in the original back office.
In my original site the node id is inserted as the SKU along with the stock value (in the table TeaCommerce_Stock) but this does not occur in the azure-based site/db.
The Tea Commerce version is 3.0.7 The Umbraco is 7.3.4
I stephen
Tried to set a specific SKU for a product to see if that will then be saved. Never experienced this before. Anything in the log files?
Kind regards
Anders
Hi No error in log file but it indicates the relevant ID has been published but the Umbraco.config file has not been updated.
I noticed the field "stock" is not retained in the xml.
I manually entered a value in the stock table but that makes no difference.
Finally, I did a check in the database and the tables cmsPropertyType, cmsPropertyTypeGroup and cmsContentType all match between the working version on the physical server and the non working version on azure.
Furthermore, just did a test to capture the event when Publishing and although it captures the property it does NOT capture the value (it captures the id and the name)
Finally, changing the datatype to a textfield saves the value which is also captured in the event handler therefore it looks like a bug in the teacommerce: stock management data type.
The plugin retrieves the sku value from the following
but I cannot find where this is set.
Also if I hard code in a node id the event handler captures the id and the value.
I do not think the angular stock management controller is capturing either the #sku or backoffice/teacommerce/products/poststock?pageid
Error 500 is displayed when the Property Editor is called: http://[name].azurewebsites.net/umbraco/backoffice/teacommerce/products/getstock/?pageId=2366 500 (Internal Server Error)
The stock is not saved in the DB as a property value - it is only saved in the special Tea Commerce stock DB table. So that is not a bug - that is by purpose.
You can download the Tea Commerce code for Umbraco here. Maybe you can debug and see what error is thrown. Is pretty weird that it works in one environment, and then you move it and then ti doesnt work anymore :)
https://github.com/TeaCommerce/Tea-Commerce-for-Umbraco
Kind regards
Anders
cannot find path to nor
which is called in the stock-management.controller.js
And all dll files, javascript files etc have been copied to the Azure site? It did work on the other setup you had - right?
Kind regards
Anders
Hopefully this may be of assistance to others.
(NOTE: one of the constant bugbears of angular is caching. Whether "getstock" or "GetStock" makes any difference I have changed the path and still it displays the same. Event setting web.config to debug. Event using Tools to clear cached and hard reload. It quite often makes no difference. Having to rename files is a joke. So much for progress in programming)
Error thrown when referencing IXmlNodeProductInformationExtractor
Discovered the current version does not include it.
So created my own process to Get/Post Stock Value
by creating a Controller in App_Code (NewStockApiController.cs) and a new model (called StockModel.cs)
which works.
NewStockApiController (in App_Code)
The angular controller path references:
and
The Manifest:
}
The StockModel:
Originally I thought this had some connection between platforms (physical server and azure) but it is inconsistencies in versions and when paying licence fees I think it is a bit galling to be expected to root out problems and fix them. That is something I would expect Tea Commerce staff/developers to fulfil.
Anyway this may be of use to others.
Hi Stephen
Sse that you solved your issue. What I would like to know is what is different from your local setup that worked and the Azure?
Just downloaded the starter kit running latest Umbraco and Tea Commerce and the products have a stock management data type - and all is working. So just wondering what might be different in your case since you got the 404 error.
Use the "dev" branch as that is latest
https://github.com/TeaCommerce/Starter-kit-for-Umbraco
Kind regards
Anders
is working on a reply...