当前位置: 首页>>代码示例>>C#>>正文


C# Product.GetSeName方法代码示例

本文整理汇总了C#中SmartStore.Core.Domain.Catalog.Product.GetSeName方法的典型用法代码示例。如果您正苦于以下问题:C# Product.GetSeName方法的具体用法?C# Product.GetSeName怎么用?C# Product.GetSeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SmartStore.Core.Domain.Catalog.Product的用法示例。


在下文中一共展示了Product.GetSeName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteProductToXml

		/// <summary>
		/// Writes a single product
		/// </summary>
		/// <param name="writer">The XML writer</param>
		/// <param name="product">The product</param>
		/// <param name="context">Context objects</param>
		public virtual void WriteProductToXml(XmlWriter writer, Product product, XmlExportContext context)
		{
			var culture = CultureInfo.InvariantCulture;
			var productTemplate = context.ProductTemplates.FirstOrDefault(x => x.Id == product.ProductTemplateId);

			writer.Write("Id", product.Id.ToString());
			writer.Write("Name", product.Name);
			writer.Write("SeName", product.GetSeName(0, true, false));

			writer.Write("ShortDescription", product.ShortDescription, null, true);
			writer.Write("FullDescription", product.FullDescription, null, true);

			writer.Write("AdminComment", product.AdminComment);
			writer.Write("ProductTemplateId", product.ProductTemplateId.ToString());
			writer.Write("ProductTemplateViewPath", productTemplate == null ? "" : productTemplate.ViewPath);
			writer.Write("ShowOnHomePage", product.ShowOnHomePage.ToString());
			writer.Write("HomePageDisplayOrder", product.HomePageDisplayOrder.ToString());
			writer.Write("MetaKeywords", product.MetaKeywords);
			writer.Write("MetaDescription", product.MetaDescription);
			writer.Write("MetaTitle", product.MetaTitle);
			writer.Write("AllowCustomerReviews", product.AllowCustomerReviews.ToString());
			writer.Write("ApprovedRatingSum", product.ApprovedRatingSum.ToString());
			writer.Write("NotApprovedRatingSum", product.NotApprovedRatingSum.ToString());
			writer.Write("ApprovedTotalReviews", product.ApprovedTotalReviews.ToString());
			writer.Write("NotApprovedTotalReviews", product.NotApprovedTotalReviews.ToString());
			writer.Write("Published", product.Published.ToString());
			writer.Write("CreatedOnUtc", product.CreatedOnUtc.ToString(culture));
			writer.Write("UpdatedOnUtc", product.UpdatedOnUtc.ToString(culture));
			writer.Write("SubjectToAcl", product.SubjectToAcl.ToString());
			writer.Write("LimitedToStores", product.LimitedToStores.ToString());
			writer.Write("ProductTypeId", product.ProductTypeId.ToString());
			writer.Write("ParentGroupedProductId", product.ParentGroupedProductId.ToString());
			writer.Write("Sku", product.Sku);
			writer.Write("ManufacturerPartNumber", product.ManufacturerPartNumber);
			writer.Write("Gtin", product.Gtin);
			writer.Write("IsGiftCard", product.IsGiftCard.ToString());
			writer.Write("GiftCardTypeId", product.GiftCardTypeId.ToString());
			writer.Write("RequireOtherProducts", product.RequireOtherProducts.ToString());
			writer.Write("RequiredProductIds", product.RequiredProductIds);
			writer.Write("AutomaticallyAddRequiredProducts", product.AutomaticallyAddRequiredProducts.ToString());
			writer.Write("IsDownload", product.IsDownload.ToString());
			writer.Write("DownloadId", product.DownloadId.ToString());
			writer.Write("UnlimitedDownloads", product.UnlimitedDownloads.ToString());
			writer.Write("MaxNumberOfDownloads", product.MaxNumberOfDownloads.ToString());
			writer.Write("DownloadExpirationDays", product.DownloadExpirationDays.HasValue ? product.DownloadExpirationDays.ToString() : "");
			writer.Write("DownloadActivationType", product.DownloadActivationType.ToString());
			writer.Write("HasSampleDownload", product.HasSampleDownload.ToString());
			writer.Write("SampleDownloadId", product.SampleDownloadId.ToString());
			writer.Write("HasUserAgreement", product.HasUserAgreement.ToString());
			writer.Write("UserAgreementText", product.UserAgreementText);
			writer.Write("IsRecurring", product.IsRecurring.ToString());
			writer.Write("RecurringCycleLength", product.RecurringCycleLength.ToString());
			writer.Write("RecurringCyclePeriodId", product.RecurringCyclePeriodId.ToString());
			writer.Write("RecurringTotalCycles", product.RecurringTotalCycles.ToString());
			writer.Write("IsShipEnabled", product.IsShipEnabled.ToString());
			writer.Write("IsFreeShipping", product.IsFreeShipping.ToString());
			writer.Write("AdditionalShippingCharge", product.AdditionalShippingCharge.ToString(culture));
			writer.Write("IsTaxExempt", product.IsTaxExempt.ToString());
			writer.Write("TaxCategoryId", product.TaxCategoryId.ToString());
			writer.Write("ManageInventoryMethodId", product.ManageInventoryMethodId.ToString());
			writer.Write("StockQuantity", product.StockQuantity.ToString());
			writer.Write("DisplayStockAvailability", product.DisplayStockAvailability.ToString());
			writer.Write("DisplayStockQuantity", product.DisplayStockQuantity.ToString());
			writer.Write("MinStockQuantity", product.MinStockQuantity.ToString());
			writer.Write("LowStockActivityId", product.LowStockActivityId.ToString());
			writer.Write("NotifyAdminForQuantityBelow", product.NotifyAdminForQuantityBelow.ToString());
			writer.Write("BackorderModeId", product.BackorderModeId.ToString());
			writer.Write("AllowBackInStockSubscriptions", product.AllowBackInStockSubscriptions.ToString());
			writer.Write("OrderMinimumQuantity", product.OrderMinimumQuantity.ToString());
			writer.Write("OrderMaximumQuantity", product.OrderMaximumQuantity.ToString());
			writer.Write("AllowedQuantities", product.AllowedQuantities);
			writer.Write("DisableBuyButton", product.DisableBuyButton.ToString());
			writer.Write("DisableWishlistButton", product.DisableWishlistButton.ToString());
			writer.Write("AvailableForPreOrder", product.AvailableForPreOrder.ToString());
			writer.Write("CallForPrice", product.CallForPrice.ToString());
			writer.Write("Price", product.Price.ToString(culture));
			writer.Write("OldPrice", product.OldPrice.ToString(culture));
			writer.Write("ProductCost", product.ProductCost.ToString(culture));
			writer.Write("SpecialPrice", product.SpecialPrice.HasValue ? product.SpecialPrice.Value.ToString(culture) : "");
			writer.Write("SpecialPriceStartDateTimeUtc", product.SpecialPriceStartDateTimeUtc.HasValue ? product.SpecialPriceStartDateTimeUtc.Value.ToString(culture) : "");
			writer.Write("SpecialPriceEndDateTimeUtc", product.SpecialPriceEndDateTimeUtc.HasValue ? product.SpecialPriceEndDateTimeUtc.Value.ToString(culture) : "");
			writer.Write("CustomerEntersPrice", product.CustomerEntersPrice.ToString());
			writer.Write("MinimumCustomerEnteredPrice", product.MinimumCustomerEnteredPrice.ToString(culture));
			writer.Write("MaximumCustomerEnteredPrice", product.MaximumCustomerEnteredPrice.ToString(culture));
			writer.Write("HasTierPrices", product.HasTierPrices.ToString());
			writer.Write("HasDiscountsApplied", product.HasDiscountsApplied.ToString());
			writer.Write("Weight", product.Weight.ToString(culture));
			writer.Write("Length", product.Length.ToString(culture));
			writer.Write("Width", product.Width.ToString(culture));
			writer.Write("Height", product.Height.ToString(culture));
			writer.Write("AvailableStartDateTimeUtc", product.AvailableStartDateTimeUtc.HasValue ? product.AvailableStartDateTimeUtc.Value.ToString(culture) : "");
			writer.Write("AvailableEndDateTimeUtc", product.AvailableEndDateTimeUtc.HasValue ? product.AvailableEndDateTimeUtc.Value.ToString(culture) : "");
			writer.Write("BasePriceEnabled", product.BasePriceEnabled.ToString());
			writer.Write("BasePriceMeasureUnit", product.BasePriceMeasureUnit);
//.........这里部分代码省略.........
开发者ID:mandocaesar,项目名称:Mesinku,代码行数:101,代码来源:ExportManager.cs

示例2: AddProductTokens

        public virtual void AddProductTokens(IList<Token> tokens, Product product, int languageId)
        {
            tokens.Add(new Token("Product.ID", product.Id.ToString()));
            tokens.Add(new Token("Product.Sku", product.Sku));
            tokens.Add(new Token("Product.Name", product.GetLocalized(x => x.Name, languageId)));
            tokens.Add(new Token("Product.ShortDescription", product.GetLocalized(x => x.ShortDescription, languageId), true));
            tokens.Add(new Token("Product.StockQuantity", product.StockQuantity.ToString()));

            // TODO: add a method for getting URL (use routing because it handles all SEO friendly URLs)
            var productUrl = string.Format("{0}{1}", _webHelper.GetStoreLocation(false), product.GetSeName());
            tokens.Add(new Token("Product.ProductURLForCustomer", productUrl, true));

            //event notification
            _eventPublisher.EntityTokensAdded(product, tokens);
        }
开发者ID:ejimenezdelgado,项目名称:SmartStoreNET,代码行数:15,代码来源:MessageTokenProvider.cs

示例3: PrepareProductReviewsModel

        public void PrepareProductReviewsModel(ProductReviewsModel model, Product product)
        {
            if (product == null)
                throw new ArgumentNullException("product");

            if (model == null)
                throw new ArgumentNullException("model");

            model.ProductId = product.Id;
            model.ProductName = product.GetLocalized(x => x.Name);
            model.ProductSeName = product.GetSeName();

            var productReviews = product.ProductReviews.Where(pr => pr.IsApproved).OrderBy(pr => pr.CreatedOnUtc);
            foreach (var pr in productReviews)
            {
                model.Items.Add(new ProductReviewModel()
                {
                    Id = pr.Id,
                    CustomerId = pr.CustomerId,
                    CustomerName = pr.Customer.FormatUserName(),
                    AllowViewingProfiles = _customerSettings.AllowViewingProfiles && pr.Customer != null && !pr.Customer.IsGuest(),
                    Title = pr.Title,
                    ReviewText = pr.ReviewText,
                    Rating = pr.Rating,
                    Helpfulness = new ProductReviewHelpfulnessModel()
                    {
                        ProductReviewId = pr.Id,
                        HelpfulYesTotal = pr.HelpfulYesTotal,
                        HelpfulNoTotal = pr.HelpfulNoTotal,
                    },
                    WrittenOnStr = _dateTimeHelper.ConvertToUserTime(pr.CreatedOnUtc, DateTimeKind.Utc).ToString("g"),
                });
            }

            model.AddProductReview.CanCurrentCustomerLeaveReview = _catalogSettings.AllowAnonymousUsersToReviewProduct || !_services.WorkContext.CurrentCustomer.IsGuest();
            model.AddProductReview.DisplayCaptcha = _captchaSettings.Enabled && _captchaSettings.ShowOnProductReviewPage;
        }
开发者ID:toannguyen241994,项目名称:SmartStoreNET,代码行数:37,代码来源:CatalogHelper.cs

示例4: PrepareProductDetailModel


//.........这里部分代码省略.........
                    }
                    else if (attribute.AttributeControlType == AttributeControlType.TextBox || attribute.AttributeControlType == AttributeControlType.MultilineTextbox)
                    {
                        if (hasSelectedAttributes)
                        {
                            var attributeKey = "product_attribute_{0}_{1}_{2}_{3}".FormatInvariant(product.Id, bundleItemId, attribute.ProductAttributeId, attribute.Id);
                            pvaModel.TextValue = selectedAttributes[attributeKey];
                        }
                    }

                    var preSelectedValueId = 0;
                    var pvaValues = (attribute.ShouldHaveValues() ? _productAttributeService.GetProductVariantAttributeValues(attribute.Id) : new List<ProductVariantAttributeValue>());

                    foreach (var pvaValue in pvaValues)
                    {
                        ProductBundleItemAttributeFilter attributeFilter = null;

                        if (productBundleItem.FilterOut(pvaValue, out attributeFilter))
                            continue;

                        if (preSelectedValueId == 0 && attributeFilter != null && attributeFilter.IsPreSelected)
                            preSelectedValueId = attributeFilter.AttributeValueId;

                        var linkedProduct = _productService.GetProductById(pvaValue.LinkedProductId);

                        var pvaValueModel = new ProductDetailsModel.ProductVariantAttributeValueModel();
                        pvaValueModel.Id = pvaValue.Id;
                        pvaValueModel.Name = pvaValue.GetLocalized(x => x.Name);
                        pvaValueModel.Alias = pvaValue.Alias;
                        pvaValueModel.ColorSquaresRgb = pvaValue.ColorSquaresRgb; //used with "Color squares" attribute type
                        pvaValueModel.IsPreSelected = pvaValue.IsPreSelected;

                        if (linkedProduct != null && linkedProduct.VisibleIndividually)
                            pvaValueModel.SeName = linkedProduct.GetSeName();

                        if (hasSelectedAttributes)
                            pvaValueModel.IsPreSelected = false;	// explicitly selected always discards pre-selected by merchant

                        // display price if allowed
                        if (displayPrices && !isBundlePricing)
                        {
                            decimal taxRate = decimal.Zero;
                            decimal attributeValuePriceAdjustment = _priceCalculationService.GetProductVariantAttributeValuePriceAdjustment(pvaValue);
                            decimal priceAdjustmentBase = _taxService.GetProductPrice(product, attributeValuePriceAdjustment, out taxRate);
                            decimal priceAdjustment = _currencyService.ConvertFromPrimaryStoreCurrency(priceAdjustmentBase, currency);

                            if (priceAdjustmentBase > decimal.Zero)
                                pvaValueModel.PriceAdjustment = "+" + _priceFormatter.FormatPrice(priceAdjustment, true, false);
                            else if (priceAdjustmentBase < decimal.Zero)
                                pvaValueModel.PriceAdjustment = "-" + _priceFormatter.FormatPrice(-priceAdjustment, true, false);

                            if (pvaValueModel.IsPreSelected)
                            {
                                preSelectedPriceAdjustmentBase = decimal.Add(preSelectedPriceAdjustmentBase, priceAdjustmentBase);
                                preSelectedWeightAdjustment = decimal.Add(preSelectedWeightAdjustment, pvaValue.WeightAdjustment);
                            }

                            if (_catalogSettings.ShowLinkedAttributeValueQuantity && pvaValue.ValueType == ProductVariantAttributeValueType.ProductLinkage)
                            {
                                pvaValueModel.QuantityInfo = pvaValue.Quantity;
                            }

                            pvaValueModel.PriceAdjustmentValue = priceAdjustment;
                        }

                        if (!_catalogSettings.ShowVariantCombinationPriceAdjustment)
开发者ID:toannguyen241994,项目名称:SmartStoreNET,代码行数:67,代码来源:CatalogHelper.cs

示例5: PrepareProductDetailsPageModel

        public ProductDetailsModel PrepareProductDetailsPageModel(
			Product product, 
			bool isAssociatedProduct = false,
			ProductBundleItemData productBundleItem = null, 
			IList<ProductBundleItemData> productBundleItems = null, 
			NameValueCollection selectedAttributes = null,
			NameValueCollection queryData = null)
        {
            if (product == null)
                throw new ArgumentNullException("product");

            var model = new ProductDetailsModel
            {
                Id = product.Id,
                Name = product.GetLocalized(x => x.Name),
                ShortDescription = product.GetLocalized(x => x.ShortDescription),
                FullDescription = product.GetLocalized(x => x.FullDescription),
                MetaKeywords = product.GetLocalized(x => x.MetaKeywords),
                MetaDescription = product.GetLocalized(x => x.MetaDescription),
                MetaTitle = product.GetLocalized(x => x.MetaTitle),
                SeName = product.GetSeName(),
                ProductType = product.ProductType,
                VisibleIndividually = product.VisibleIndividually,
                //Manufacturers = _manufacturerService.GetProductManufacturersByProductId(product.Id),
                Manufacturers = PrepareManufacturersOverviewModel(_manufacturerService.GetProductManufacturersByProductId(product.Id), null, true),
                ReviewCount = product.ApprovedTotalReviews,
                DisplayAdminLink = _services.Permissions.Authorize(StandardPermissionProvider.AccessAdminPanel),
                //EnableHtmlTextCollapser = Convert.ToBoolean(_settingService.GetSettingByKey<string>("CatalogSettings.EnableHtmlTextCollapser")),
                //HtmlTextCollapsedHeight = Convert.ToString(_settingService.GetSettingByKey<string>("CatalogSettings.HtmlTextCollapsedHeight")),
                ShowSku = _catalogSettings.ShowProductSku,
                Sku = product.Sku,
                ShowManufacturerPartNumber = _catalogSettings.ShowManufacturerPartNumber,
                DisplayProductReviews = _catalogSettings.ShowProductReviewsInProductDetail,
                ManufacturerPartNumber = product.ManufacturerPartNumber,
                ShowGtin = _catalogSettings.ShowGtin,
                Gtin = product.Gtin,
                StockAvailability = product.FormatStockMessage(_localizationService),
                HasSampleDownload = product.IsDownload && product.HasSampleDownload,
                IsCurrentCustomerRegistered = _services.WorkContext.CurrentCustomer.IsRegistered()
            };

            // get gift card values from query string
            if (queryData != null && queryData.Count > 0)
            {
                var giftCardItems = queryData.AllKeys
                    .Where(x => x.EmptyNull().StartsWith("giftcard_"))
                    .SelectMany(queryData.GetValues, (k, v) => new { key = k, value = v.TrimSafe() });

                foreach (var item in giftCardItems)
                {
                    var key = item.key.EmptyNull().ToLower();

                    if (key.EndsWith("recipientname"))
                        model.GiftCard.RecipientName = item.value;
                    else if (key.EndsWith("recipientemail"))
                        model.GiftCard.RecipientEmail = item.value;
                    else if (key.EndsWith("sendername"))
                        model.GiftCard.SenderName = item.value;
                    else if (key.EndsWith("senderemail"))
                        model.GiftCard.SenderEmail = item.value;
                    else if (key.EndsWith("message"))
                        model.GiftCard.Message = item.value;
                }
            }

            // Back in stock subscriptions
            if (product.ManageInventoryMethod == ManageInventoryMethod.ManageStock &&
                 product.BackorderMode == BackorderMode.NoBackorders &&
                 product.AllowBackInStockSubscriptions &&
                 product.StockQuantity <= 0)
            {
                //out of stock
                model.DisplayBackInStockSubscription = true;
                model.BackInStockAlreadySubscribed = _backInStockSubscriptionService
                    .FindSubscription(_services.WorkContext.CurrentCustomer.Id, product.Id, _services.StoreContext.CurrentStore.Id) != null;
            }

            //template
            var templateCacheKey = string.Format(ModelCacheEventConsumer.PRODUCT_TEMPLATE_MODEL_KEY, product.ProductTemplateId);
            model.ProductTemplateViewPath = _services.Cache.Get(templateCacheKey, () =>
            {
                var template = _productTemplateService.GetProductTemplateById(product.ProductTemplateId);
                if (template == null)
                    template = _productTemplateService.GetAllProductTemplates().FirstOrDefault();
                return template.ViewPath;
            });

            IList<ProductBundleItemData> bundleItems = null;
            ProductVariantAttributeCombination combination = null;

            if (product.ProductType == ProductType.GroupedProduct && !isAssociatedProduct)	// associated products
            {
                var searchContext = new ProductSearchContext
                {
                    OrderBy = ProductSortingEnum.Position,
                    StoreId = _services.StoreContext.CurrentStore.Id,
                    ParentGroupedProductId = product.Id,
                    PageSize = int.MaxValue,
                    VisibleIndividuallyOnly = false
                };
//.........这里部分代码省略.........
开发者ID:toannguyen241994,项目名称:SmartStoreNET,代码行数:101,代码来源:CatalogHelper.cs

示例6: ProductDetailUrl

 public string ProductDetailUrl(Store store, Product product)
 {
     return "{0}{1}".FormatWith(store.Url, product.GetSeName(Language.Id));
 }
开发者ID:GloriousOnion,项目名称:SmartStoreNET,代码行数:4,代码来源:PluginHelperFeed.cs

示例7: GetProductDetailUrl

 public string GetProductDetailUrl(Store store, Product product)
 {
     return "{0}{1}".FormatWith(store.Url, product.GetSeName(Language.Id, UrlRecordService, LanguageService));
 }
开发者ID:mandocaesar,项目名称:Mesinku,代码行数:4,代码来源:FeedPluginHelper.cs

示例8: PrepareProductDetailsPageModel

		protected ProductDetailsModel PrepareProductDetailsPageModel(Product product, bool isAssociatedProduct = false,
			ProductBundleItemData productBundleItem = null, IList<ProductBundleItemData> productBundleItems = null, FormCollection selectedAttributes = null)
        {
            if (product == null)
                throw new ArgumentNullException("product");

            var model = new ProductDetailsModel()
            {
                Id = product.Id,
                Name = product.GetLocalized(x => x.Name),
                ShortDescription = product.GetLocalized(x => x.ShortDescription),
                FullDescription = product.GetLocalized(x => x.FullDescription),
                MetaKeywords = product.GetLocalized(x => x.MetaKeywords),
                MetaDescription = product.GetLocalized(x => x.MetaDescription),
                MetaTitle = product.GetLocalized(x => x.MetaTitle),
                SeName = product.GetSeName(),
				ProductType = product.ProductType,
				VisibleIndividually = product.VisibleIndividually,
                //Manufacturers = _manufacturerService.GetProductManufacturersByProductId(product.Id),  /* codehint: sm-edit */
                Manufacturers = PrepareManufacturersOverviewModel(_manufacturerService.GetProductManufacturersByProductId(product.Id)),
                ReviewCount = product.ApprovedTotalReviews,                     /* codehint: sm-add */
                DisplayAdminLink = _permissionService.Authorize(StandardPermissionProvider.AccessAdminPanel),
                EnableHtmlTextCollapser = Convert.ToBoolean(_settingService.GetSettingByKey<string>("CatalogSettings.EnableHtmlTextCollapser")),
                HtmlTextCollapsedHeight = Convert.ToString(_settingService.GetSettingByKey<string>("CatalogSettings.HtmlTextCollapsedHeight")),
				ShowSku = _catalogSettings.ShowProductSku,
				Sku = product.Sku,
				ShowManufacturerPartNumber = _catalogSettings.ShowManufacturerPartNumber,
				ManufacturerPartNumber = product.ManufacturerPartNumber,
				ShowGtin = _catalogSettings.ShowGtin,
				Gtin = product.Gtin,
				StockAvailability = product.FormatStockMessage(_localizationService),
				HasSampleDownload = product.IsDownload && product.HasSampleDownload,
				IsCurrentCustomerRegistered = _workContext.CurrentCustomer.IsRegistered()
            };

			// Back in stock subscriptions
			if (product.ManageInventoryMethod == ManageInventoryMethod.ManageStock &&
				 product.BackorderMode == BackorderMode.NoBackorders &&
				 product.AllowBackInStockSubscriptions &&
				 product.StockQuantity <= 0)
			{
				//out of stock
				model.DisplayBackInStockSubscription = true;
				model.BackInStockAlreadySubscribed = _backInStockSubscriptionService
					.FindSubscription(_workContext.CurrentCustomer.Id, product.Id, _storeContext.CurrentStore.Id) != null;
			}

            //template
            var templateCacheKey = string.Format(ModelCacheEventConsumer.PRODUCT_TEMPLATE_MODEL_KEY, product.ProductTemplateId);
            model.ProductTemplateViewPath = _cacheManager.Get(templateCacheKey, () =>
            {
                var template = _productTemplateService.GetProductTemplateById(product.ProductTemplateId);
                if (template == null)
                    template = _productTemplateService.GetAllProductTemplates().FirstOrDefault();
                return template.ViewPath;
            });

			IList<ProductBundleItemData> bundleItems = null;
            ProductVariantAttributeCombination combination = null;
            var combinationImageIds = new List<int>();

			if (product.ProductType == ProductType.GroupedProduct && !isAssociatedProduct)	// associated products
			{
				var searchContext = new ProductSearchContext()
				{
					StoreId = _storeContext.CurrentStore.Id,
					ParentGroupedProductId = product.Id,
					VisibleIndividuallyOnly = false
				};

				var associatedProducts = _productService.SearchProducts(searchContext);

				foreach (var associatedProduct in associatedProducts)
					model.AssociatedProducts.Add(PrepareProductDetailsPageModel(associatedProduct, true));
			}
			else if (product.ProductType == ProductType.BundledProduct && productBundleItem == null)		// bundled items
			{
				bundleItems = _productService.GetBundleItems(product.Id);

				foreach (var itemData in bundleItems.Where(x => x.Item.Product.CanBeBundleItem()))
				{
					var item = itemData.Item;
					var bundledProductModel = PrepareProductDetailsPageModel(item.Product, false, itemData);

					bundledProductModel.BundleItem.Id = item.Id;
					bundledProductModel.BundleItem.Quantity = item.Quantity;
					bundledProductModel.BundleItem.HideThumbnail = item.HideThumbnail;
					bundledProductModel.BundleItem.Visible = item.Visible;
					bundledProductModel.BundleItem.IsBundleItemPricing = item.BundleProduct.BundlePerItemPricing;

					string bundleItemName = item.GetLocalized(x => x.Name);
					if (bundleItemName.HasValue())
						bundledProductModel.Name = bundleItemName;

					string bundleItemShortDescription = item.GetLocalized(x => x.ShortDescription);
					if (bundleItemShortDescription.HasValue())
						bundledProductModel.ShortDescription = bundleItemShortDescription;

					model.BundledItems.Add(bundledProductModel);
				}
//.........这里部分代码省略.........
开发者ID:GloriousOnion,项目名称:SmartStoreNET,代码行数:101,代码来源:CatalogController.cs

示例9: AddProductTokens

        public virtual void AddProductTokens(IList<Token> tokens, Product product, Language language)
        {
            // TODO: add a method for getting URL (use routing because it handles all SEO friendly URLs)
            var storeLocation = _webHelper.GetStoreLocation(false);
            var productUrl = storeLocation + product.GetSeName();
            var productName = product.GetLocalized(x => x.Name, language.Id);

            tokens.Add(new Token("Product.ID", product.Id.ToString()));
            tokens.Add(new Token("Product.Sku", product.Sku));
            tokens.Add(new Token("Product.Name", productName));
            tokens.Add(new Token("Product.ShortDescription", product.GetLocalized(x => x.ShortDescription, language.Id), true));
            tokens.Add(new Token("Product.StockQuantity", product.StockQuantity.ToString()));
            tokens.Add(new Token("Product.ProductURLForCustomer", productUrl, true));

            var currency = _workContext.WorkingCurrency;

            var additionalShippingCharge = _currencyService.ConvertFromPrimaryStoreCurrency(product.AdditionalShippingCharge, currency);
            var additionalShippingChargeFormatted = _priceFormatter.FormatPrice(additionalShippingCharge, false, currency.CurrencyCode, false, language);

            tokens.Add(new Token("Product.AdditionalShippingCharge", additionalShippingChargeFormatted));

            if (_mediaSettings.MessageProductThumbPictureSize > 0)
            {
                var pictureHtml = ProductPictureToHtml(GetPictureFor(product, null), language, productName, productUrl, storeLocation);

                tokens.Add(new Token("Product.Thumbnail", pictureHtml, true));
            }

            //event notification
            _eventPublisher.EntityTokensAdded(product, tokens);
        }
开发者ID:toannguyen241994,项目名称:SmartStoreNET,代码行数:31,代码来源:MessageTokenProvider.cs


注:本文中的SmartStore.Core.Domain.Catalog.Product.GetSeName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。