November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
I think you have two options:
Hi Quan,
When i set the IsActive of the entry to false it lead to product no longer display on front-end, is there any way to leave it as draff version like in a "AwaitingApproval/CheckedIn?
Thanks,
Thao Pham
It should be still visible in Catalog UI. if you want it to be visible in view mode (For end users) then you would have to change the code to not filter it.
Hi Quan,
As i understand, if IsActive set to false, then entry will be change status publish to checkout. But i still want to keep the publish version in order to display on www and just create a draft version to pending aprroval
I try to decombine the code of episerver i can see two flash NeedToSyncDraft/NeedToSyncDraft
So can i use this flash to solve my issue?
/// <summary>Updates the catalog.</summary>
public void Save()
{
if (this.CurrentDto.Catalog == null || this.CurrentDto.Catalog.Count <= 0)
return;
CatalogAdmin.EnsureLanguagesContainsDefault(this.CurrentDto);
this.EnsureUriSegment(this.CurrentDto);
using (TransactionScope transactionScope = new TransactionScope())
{
HashSet<int> source = new HashSet<int>((IEnumerable<int>) this.CurrentDto.Catalog.Where<CatalogDto.CatalogRow>((Func<CatalogDto.CatalogRow, bool>) (row =>
{
if (row.RowState != DataRowState.Deleted)
return row.RowState != DataRowState.Added;
return false;
})).Select<CatalogDto.CatalogRow, int>((Func<CatalogDto.CatalogRow, int>) (row => row.CatalogId)));
IEnumerable<IBulkChangeItem<CatalogEntryChange>> changes = this.GetCatalogEntryChanges(this.CurrentDto);
DataHelper.SaveDataSetSimple(CatalogDataHelper.CreateDataCommand(), (DataSet) this.CurrentDto, CatalogAdmin._tableNames);
if (!CatalogContext.DisableVersionSync && (!this.CurrentDto.Items.Contains((object) CatalogEventArgs.NeedToSyncDraft) || (bool) this.CurrentDto.Items[(object) CatalogEventArgs.NeedToSyncDraft]))
{
this._catalogContentSync.CreateDraft(this.CurrentDto, PrincipalInfo.CurrentPrincipal.Identity.Name);
this._catalogContentSync.DeletePublishedVersionsOfInactiveContents(this.CurrentDto.Catalog.Where<CatalogDto.CatalogRow>((Func<CatalogDto.CatalogRow, bool>) (row => !row.IsActive)).Select<CatalogDto.CatalogRow, int>((Func<CatalogDto.CatalogRow, int>) (row => row.CatalogId)).ToArray<int>(), CatalogContentType.Catalog);
}
else if (CatalogContext.DisableVersionSync && !this.CurrentDto.Items.Contains((object) CatalogEventArgs.NeedToSyncDraft))
this._catalogContentSync.DeleteAllVersions(source.ToArray<int>(), CatalogContentType.Catalog);
TransactionScope.OnCommit((System.Action) (() => this._changeManager.NotifyChanges(changes)));
transactionScope.Complete();
}
}
Thanks,
Thao Pham
Hi Quan,
The second option is import one by one, that is not good solution, i prefer using CatalogImportExport to import by bactch
Any suggestion?
Thanks,
Thao Pham
Hi,
I am trying to write a custom import tool use CatalogImportExport to import product to eppiserver and leave it as draft version, but i did not see any option to do it
Can anyone please give me the solution to this problem?
Here is my code
// Start import
using (var catalogXmlStream = new MemoryStream())
{
catalogXDoc.Save(catalogXmlStream);
// set stream pointer to beginning
catalogXmlStream.Seek(0, SeekOrigin.Begin);
// import back by episerver import export
CatalogImportExport cie = new CatalogImportExport();
cie.ImportExportProgressMessage += progressHandler.Invoke;
cie.Import(catalogXmlStream, true);
}
Thanks,
Thao Pham