/// <summary>
        /// The initialize.
        /// </summary>
        private void Initialize()
        {
            var args = new VirtualContentEventArgs(_parent);

            Initializing.RaiseEvent(args, this);
            _parent = args.Parent;

            //// http://issues.merchello.com/youtrack/issue/M-878
            _allLanguages = ApplicationContext.Current.Services.LocalizationService.GetAllLanguages().ToArray();

            _parentCulture = _parent != null?_parent.GetCulture().Name : string.Empty;

            _defaultStoreLanguage = StringExtensions.IsNullOrWhiteSpace(this._parentCulture) ?
                                    _storeSettingService.GetByKey(Constants.StoreSettingKeys.DefaultExtendedContentCulture).Value :
                                    _parentCulture;

            _detachedContentTypes = new Lazy <IEnumerable <IDetachedContentType> >(() => _detachedContentTypeService.GetAll().Where(x => x.ContentTypeKey != null));

            if (_allLanguages.Any())
            {
                _defaultStoreLanguage = _allLanguages.Any(x => x.CultureInfo.Name == _defaultStoreLanguage)
                                            ? _defaultStoreLanguage
                                            : _allLanguages.First().CultureInfo.Name;
            }
        }
Пример #2
0
        /// <summary>
        /// The initialize.
        /// </summary>
        private void Initialize()
        {
            var args = new VirtualContentEventArgs(_parent);

            Initializing.RaiseEvent(args, this);
            _parent = args.Parent;
        }
Пример #3
0
        /// <summary>
        /// The initialize.
        /// </summary>
        private void Initialize()
        {
            var args = new VirtualContentEventArgs(_parent);

            Initializing.RaiseEvent(args, this);
            _parent = args.Parent;

            //// http://issues.merchello.com/youtrack/issue/M-878
            _allLanguages = ApplicationContext.Current.Services.LocalizationService.GetAllLanguages().ToArray();

            _defaultStoreLanguage =
                _storeSettingService.GetByKey(Constants.StoreSettingKeys.DefaultExtendedContentCulture).Value;

            if (_allLanguages.Any())
            {
                _defaultStoreLanguage = _allLanguages.Any(x => x.CultureInfo.Name == _defaultStoreLanguage)
                                            ? _defaultStoreLanguage
                                            : _allLanguages.First().CultureInfo.Name;
            }
        }
Пример #4
0
 //// Event handler methods
 /// <summary>
 /// Handles the <see cref="ProductContentFactory"/> on initializing event.
 /// </summary>
 /// <param name="sender">
 /// The <see cref="ProductContentFactory"/>.
 /// </param>
 /// <param name="e">
 /// The <see cref="VirtualContentEventArgs"/>.
 /// </param>
 /// <remarks>
 /// This is required to set the parent id of the virtual content
 /// </remarks>
 private static void ProductContentFactoryOnInitializing(ProductContentFactory sender, VirtualContentEventArgs e)
 {
     var store = ExampleUiHelper.Content.GetStoreRoot();
     e.Parent = store;
 }
        /// <summary>
        /// The initialize.
        /// </summary>
        private void Initialize()
        {
            var args = new VirtualContentEventArgs(_parent);
            Initializing.RaiseEvent(args, this);
            _parent = args.Parent;

            //// http://issues.merchello.com/youtrack/issue/M-878
            _allLanguages = ApplicationContext.Current.Services.LocalizationService.GetAllLanguages().ToArray();

            _parentCulture = _parent != null ? _parent.GetCulture().Name : string.Empty;

            _defaultStoreLanguage = StringExtensions.IsNullOrWhiteSpace(this._parentCulture) ?
                _storeSettingService.GetByKey(Constants.StoreSettingKeys.DefaultExtendedContentCulture).Value :
                _parentCulture;

            _detachedContentTypes = new Lazy<IEnumerable<IDetachedContentType>>(() => _detachedContentTypeService.GetAll().Where(x => x.ContentTypeKey != null));

            if (_allLanguages.Any())
            {

                _defaultStoreLanguage = _allLanguages.Any(x => x.CultureInfo.Name == _defaultStoreLanguage)
                                            ? _defaultStoreLanguage
                                            : _allLanguages.First().CultureInfo.Name;
            }
        }
Пример #6
0
        /// <summary>
        /// The initialize.
        /// </summary>
        private void Initialize()
        {
            var args = new VirtualContentEventArgs(_parent);
            Initializing.RaiseEvent(args, this);
            _parent = args.Parent;

            //// http://issues.merchello.com/youtrack/issue/M-878
            _allLanguages = ApplicationContext.Current.Services.LocalizationService.GetAllLanguages().ToArray();

            _defaultStoreLanguage =
                _storeSettingService.GetByKey(Constants.StoreSettingKeys.DefaultExtendedContentCulture).Value;

            if (_allLanguages.Any())
            {

                _defaultStoreLanguage = _allLanguages.Any(x => x.CultureInfo.Name == _defaultStoreLanguage)
                                            ? _defaultStoreLanguage
                                            : _allLanguages.First().CultureInfo.Name;
            }
        }
 /// <summary>
 /// Sets the parent of Merchello virtual product content to the Home node.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 private static void ProductContentFactoryOnInitializing(ProductContentFactory sender, VirtualContentEventArgs e)
 {
     e.Parent = ContentResolver.Instance.GetRootContent();
 }
 /// <summary>
 /// The initialize.
 /// </summary>
 private void Initialize()
 {
     var args = new VirtualContentEventArgs(_parent);
     Initializing.RaiseEvent(args, this);
     _parent = args.Parent;
 }