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


C# Product.IsAvailableByStock方法代码示例

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


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

示例1: PrepareProductDetailModel


//.........这里部分代码省略.........
                    }

                    product.MergeWithCombination(model.SelectedCombination);

                    // mark explicitly selected as pre-selected
                    foreach (var attribute in model.ProductVariantAttributes)
                    {
                        foreach (var value in attribute.Values)
                        {
                            if (selectedAttributeValues.FirstOrDefault(v => v.Id == value.Id) != null)
                                value.IsPreSelected = true;

                            if (!_catalogSettings.ShowVariantCombinationPriceAdjustment)
                                value.PriceAdjustment = "";
                        }
                    }
                }
            }

            #endregion

            #region Properties

            if ((productBundleItem != null && !productBundleItem.Item.BundleProduct.BundlePerItemShoppingCart) ||
                (product.ManageInventoryMethod == ManageInventoryMethod.ManageStockByAttributes && !hasSelectedAttributesValues))
            {
                // cases where stock inventory is not functional. determined by what ShoppingCartService.GetStandardWarnings and ProductService.AdjustInventory is not handling.
                model.IsAvailable = true;
                var hasAttributeCombinations = _services.DbContext.QueryForCollection(product, (Product p) => p.ProductVariantAttributeCombinations).Any();
                model.StockAvailability = !hasAttributeCombinations ? product.FormatStockMessage(_localizationService) : "";
            }
            else if (model.IsAvailable)
            {
                model.IsAvailable = product.IsAvailableByStock();
                model.StockAvailability = product.FormatStockMessage(_localizationService);
            }

            model.Id = product.Id;
            model.Name = product.GetLocalized(x => x.Name);
            model.ShowSku = _catalogSettings.ShowProductSku;
            model.Sku = product.Sku;
            model.ShortDescription = product.GetLocalized(x => x.ShortDescription);
            model.FullDescription = product.GetLocalized(x => x.FullDescription);
            model.MetaKeywords = product.GetLocalized(x => x.MetaKeywords);
            model.MetaDescription = product.GetLocalized(x => x.MetaDescription);
            model.MetaTitle = product.GetLocalized(x => x.MetaTitle);
            model.SeName = product.GetSeName();
            model.ShowManufacturerPartNumber = _catalogSettings.ShowManufacturerPartNumber;
            model.ManufacturerPartNumber = product.ManufacturerPartNumber;
            model.ShowDimensions = _catalogSettings.ShowDimensions;
            model.ShowWeight = _catalogSettings.ShowWeight;
            model.ShowGtin = _catalogSettings.ShowGtin;
            model.Gtin = product.Gtin;
            model.HasSampleDownload = product.IsDownload && product.HasSampleDownload;
            model.IsCurrentCustomerRegistered = customer.IsRegistered();
            model.IsBasePriceEnabled = product.BasePriceEnabled;
            model.BasePriceInfo = product.GetBasePriceInfo(_localizationService, _priceFormatter, _currencyService, _taxService, _priceCalculationService, currency);
            model.ShowLegalInfo = _taxSettings.ShowLegalHintsInProductDetails;
            model.BundleTitleText = product.GetLocalized(x => x.BundleTitleText);
            model.BundlePerItemPricing = product.BundlePerItemPricing;
            model.BundlePerItemShipping = product.BundlePerItemShipping;
            model.BundlePerItemShoppingCart = product.BundlePerItemShoppingCart;

            //_taxSettings.TaxDisplayType == TaxDisplayType.ExcludingTax;

            var taxDisplayType = _services.WorkContext.GetTaxDisplayTypeFor(customer, store.Id);
开发者ID:toannguyen241994,项目名称:SmartStoreNET,代码行数:67,代码来源:CatalogHelper.cs


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