Bug reports Found a bug? Post it here please.
Version 4.x > Bug reports > SKU Custom Fields - overwritten View modes: 
User avatar
Member
Member
Ryan - 9/10/2009 6:35:20 AM
   
SKU Custom Fields - overwritten
In my installation of Kentico I have added number of custom fields added to the sku system table.

I currently have a document that is marked as a product and that product has all of its product data populated including its custom fields.

I can edit the custom fields of product(sku) by selecting the document in the tree and then selecting product > custom fields I then click save and my changes are successfully saved to the database. I can see the changes saved in the sku table by querying the database directly.

HOWEVER, if i subsequently return to the page tab of the document, edit some content and then save the document my previous changes to the product(sku) custom fields are lost and have reverted to their previous values.

It appears that somehow when the document is saved it has cached the old values of the associated product(sku) and rewritten them back to the database overwriting my previous change.

Additional Points:

-Only the data in the custom sku fields are lost when saving the document. Updates made to the standard sku fields remain after saving the document.

-If I clear the system cache (Site Manager > Administration > General > Clear Cache) between updating the product (sku) and saving the document, the changes to the custom fields remain and everything is fine.

It appears to me as there is some sort of caching issue going on here.


Any feedback on this issue would be appreciated



User avatar
Kentico Support
Kentico Support
kentico_jurajo - 9/11/2009 5:24:06 AM
   
RE:SKU Custom Fields - overwritten
Hi,

I am sorry for the inconvenience. This bug was already fixed in 4.1 version. I would like to recommend the upgrade. Anyway, I will send you an e-mail in few minutes with easy workaround.

Best Regards,
Juraj Ondrus

User avatar
Member
Member
soft.csharp-yahoo - 11/2/2011 9:44:26 AM
   
RE:SKU Custom Fields - overwritten
Excuse me, i think you have a huge problem because i'm using kenitco 6 version and i'm facing the same problem. So i see you have to carefully review your kentico code.

so my Dear of dears i need to know when exactly do u intend solving this huge bug?but if you don't have enough experiences, you shouldn't lie to others.

thank you for your,erm, actually effort.

Best Regards,
Kentico 6v Customer


User avatar
Member
Member
web.developer89-yahoo - 11/2/2011 10:06:54 AM
   
RE:SKU Custom Fields - overwritten
You are right.i'm facing the same problem in the same version. i think they should back to themselves before answer to people.

because if you see all their answers, it could be very funny , stupid and ...
i advice them to rewrite kentico from A-Z and Release a complete Version.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 11/3/2011 1:33:04 AM
   
RE:SKU Custom Fields - overwritten
Hi,

You posted your issue into 4.x version forum. Next time, please use proper forums for your posts.

This issue has been definitely fixed in version 4.x. However, it is possible that there is a new bug of course. Could you please describe us the exact steps how to reproduce the issue?

Best regards,
Juraj Ondrus

User avatar
Member
Member
soft.csharp-yahoo - 11/3/2011 4:35:26 AM
   
RE:SKU Custom Fields - overwritten
if you looked to first post carefully you wouldnt ask more details.however, i'll describe that just second time.

i have,for eaxmple, two custom attributes on SKU Table and i have custom app which it uses your API Code "SKUInfo class" to update these attributes and when i've finished the updating,i've checked the table COM_SKU,it seems to be correct but when i refresh Product Page i see the same old values but the database has the correct values even if i closed the broswer and clean all history of the broswer and cookies and caches.

in one case your website correctly works,i have to reset IIS before do refresh broswer.

it is not a new bug... please don't say it again!

is it clear now?more details?

please i need a solution as fast as possible because the customer want to see a demo after 3 days from now.if you dont have an ability to provide a solution for me please say "NO" honestly to change our tool to another CMS "Good CMS".

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 11/3/2011 6:20:39 AM
   
RE:SKU Custom Fields - overwritten
Hi,

So, the problem is that the new values are not reflected due to page cache and not that they are being overwritten, correct? So, this is something totally different from the first post, which was a bug, this bug was fixed and it is working fine now.

In your case, could you please let us know the exact code you are using? How are you handling caching in your code? Are you using any cache options? If so, what are their settings? Are you using cache dependencies in order to flush the cache correctly?

User avatar
Member
Member
soft.csharp-yahoo - 11/3/2011 6:35:22 AM
   
RE:SKU Custom Fields - overwritten
i'd thank u so much for ur answer
my code

InfoDataSet<SKUInfo> KenticoSKUs = new InfoDataSet<SKUInfo>(tblKenticoSKU.DataSet);
SKUInfo KenticoSKU = null;
foreach (SKUInfo SKU in KenticoSKUs)
{
KenticoSKU = SKU;
break;
}
#endregion
if (KenticoSKU == null)
{
throw new Exception("this product " + Product.ProductID.ToString() + "could not find in kentico database.Please contact administrator");
continue;
}
foreach (var Store in Product.MarkStores)
{
KenticoSKU.SetValue(Store.Name, Store.Value ? 1.ToString() : 0.ToString());
}
KenticoSKU.Update();

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 11/4/2011 10:04:53 AM
   
RE:SKU Custom Fields - overwritten
Hi,

Your code seems to be OK but the data are displayed on the site somehow - I guess you are using some web part. What are the caching options set for your CMS, page or web part? You may need to add caching logic to your code to flush the cache on the data change for given object.

Best regards,
Juraj Ondrus

User avatar
Member
Member
mnotpit-gmail - 4/5/2012 1:26:09 PM
   
RE:SKU Custom Fields - overwritten
Hi soft.csharp,
I know this post is a few months old now, but I thought I'd contribute for anyone else who runs into issues like this.
First of all, soft, please hold back from releasing your heated comments and assumptions about buggy implementation. Negative attitudes don't encourage people to help you. I know your frustration, because I've been there too, but more often than not the issue is rooted in developer misunderstandings about how to use the API.
Anyways, from my experience, the most reliable way to insert and update records with custom fields (and to ensure the data is properly cached) is to use provider methods, not the built-in instance methods. Yes, I know that in 6.0 the base classes (e.g., BaseInfo) have been updated so that they eventually call the inheriting class's SetObject() implementation, but ultimately it's the static provider methods doing the work.
In other words, for updating SKU objects I would strongly recommend using SKUInfoProvider.SetSKUInfo(customSKUObject), not customSKUObject.Update(). The regular Update() method will update the record in the database, but in the past Kentico versions the cached objects were not updated, and those are where the CMSDesk and other UI actually pulls info from.
All that to say...if you are using 6.0, you *should* be fine with the Update(), but I suggest using the providers directly just to be safe.
Hope that helps!

User avatar
Member
Member
soft.csharp-yahoo - 11/2/2011 11:05:58 AM
   
RE:SKU Custom Fields - overwritten
if i don't honest i said a bad word to you because i spend all this day to diagnose the problem and i found the problem in your services or APIs because if i reset IIS , the <RemovedByAdministrator> page "product" gets new values, if i dont, it still cache the old values.

So what should i do? everytime i change values by your <RemovedByAdministrator> APIs, i have to reset IIS or What?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 11/3/2011 1:34:40 AM
   
RE:SKU Custom Fields - overwritten
Hi,

Is this still related to the custom fields problem?
What API are you using? Where are you using it?
What are your caching options?
Have you read our caching documentation and also seen the blog posts about how to handle the caching in API?

Best regards,
Juraj Ondrus

User avatar
Certified Developer 8
Certified Developer 8
szever-wearei3 - 7/16/2012 10:48:09 AM
   
RE:SKU Custom Fields - overwritten
Hi,

I realise i'm a year and half behind on this but i'm providing support for a website in Kentico 4.0 for a client and i am facing this same issue, upgrading at the moment is not possible.

Would it be possible to get the code fix for this please?

Much appreciated!

Cheeers

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 7/16/2012 9:58:09 PM
   
RE:SKU Custom Fields - overwritten
Hi,

I am sorry but we are not providing fixes for that old versions you are using. The only way is the upgrade to a newer version - I would recommend doing so anyway since you are using really old version.

Best regards,
Juraj Ondrus