I am doing pessimistic stock keeping with Tea Commerce. I am maintaining stock across multiple nodes where this product is. In other words, the products are in the master catalog and an instance exists in 3 places in the content tree. These prodcuts have only a stock of 1 so when someone adds it to their cart it needs to be reflected immediately on the front end and from different pages.
So I can see from inside the CMS backend that the stock values have been changed. The issue is that the front end is not reflecting that which I imagine is a caching issue. I have read this:
I was either already doing what it said or added it but the front end still doesn't update until after a few minutes. When I change a stock value in the orderline added and removed events I am:
1. Calling order.Save()
2. Republishing the document by calling this function:
void PublishUpdate(int NodeId)
{
System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
Document tempDoc = new Document(NodeId);
User author = User.GetUser(0);
tempDoc.Publish(author);
tempDoc.XmlGenerate(xd);
umbraco.library.UpdateDocumentCache(tempDoc.Id);
umbraco.library.RefreshContent();
}
3. Calling umbraco.library.RefreshContent(); after all changes have been made.
Any advice? Is there something else I can do? Republishing the entire site seems to work but it takes so long who knows if it really helped or it just took so long it was refreshed already anyway.
This didn't work for me. And actually I was already doing that if you look at the code above. But that did give me the idea that I should try republishing the parent node. That didn't work though.
However, this isn't an issue for me now because the the latest build of Tea Commerce fixed a properties bug so I was able to revert back to managing the products solely in the master catalog.
Content changes not updating/refreshing
Hi,
I am doing pessimistic stock keeping with Tea Commerce. I am maintaining stock across multiple nodes where this product is. In other words, the products are in the master catalog and an instance exists in 3 places in the content tree. These prodcuts have only a stock of 1 so when someone adds it to their cart it needs to be reflected immediately on the front end and from different pages.
So I can see from inside the CMS backend that the stock values have been changed. The issue is that the front end is not reflecting that which I imagine is a caching issue. I have read this:
http://our.umbraco.org/wiki/reference/api-cheatsheet/publishing-and-republishing
I was either already doing what it said or added it but the front end still doesn't update until after a few minutes. When I change a stock value in the orderline added and removed events I am:
1. Calling order.Save()
2. Republishing the document by calling this function:
void PublishUpdate(int NodeId)
{
System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
Document tempDoc = new Document(NodeId);
User author = User.GetUser(0);
tempDoc.Publish(author);
tempDoc.XmlGenerate(xd);
umbraco.library.UpdateDocumentCache(tempDoc.Id);
umbraco.library.RefreshContent();
}
3. Calling umbraco.library.RefreshContent(); after all changes have been made.
Any advice? Is there something else I can do? Republishing the entire site seems to work but it takes so long who knows if it really helped or it just took so long it was refreshed already anyway.
Carlos
Hi Carlos,
Try something like that:
more at
http://our.umbraco.org/wiki/reference/api-cheatsheet/creating-a-document
Hi Alex,
Thanks but I am not creating a new document just updating an existing one. Any other ideas? Thanks.
Carlos
Just add Save method before publishing:
Document test = new Document(1100);
test.Save();
User author = User.GetUser(0);
test.Publish(author);
Hi Guys,
You might also want to update the document cache after publishing. That should make sure that your changes are updated on the website.
umbraco.library.UpdateDocumentCache( node.Id );
/Rune
Hi Rune,
This didn't work for me. And actually I was already doing that if you look at the code above. But that did give me the idea that I should try republishing the parent node. That didn't work though.
However, this isn't an issue for me now because the the latest build of Tea Commerce fixed a properties bug so I was able to revert back to managing the products solely in the master catalog.
Thanks for everyone's help.
Carlos
Weird :)
If by any chance that you find one of the answers as a solution for your question. Could you please mark it - thanks :)
Kind regards
Anders
is working on a reply...