Beispiel #1
0
 public CopyArticleService(IArticleService articleService,
                           IArticleAttributeService articleAttributeService,
                           ILanguageService languageService,
                           ILocalizedEntityService localizedEntityService,
                           ILocalizationService localizationService,
                           IPictureService pictureService,
                           ICategoryService categoryService,
                           IPublisherService publisherService,
                           ISpecificationAttributeService specificationAttributeService,
                           IDownloadService downloadService,
                           IArticleAttributeParser articleAttributeParser,
                           IUrlRecordService urlRecordService,
                           IStoreMappingService storeMappingService)
 {
     this._articleService                = articleService;
     this._articleAttributeService       = articleAttributeService;
     this._languageService               = languageService;
     this._localizedEntityService        = localizedEntityService;
     this._localizationService           = localizationService;
     this._pictureService                = pictureService;
     this._categoryService               = categoryService;
     this._publisherService              = publisherService;
     this._specificationAttributeService = specificationAttributeService;
     this._downloadService               = downloadService;
     this._articleAttributeParser        = articleAttributeParser;
     this._urlRecordService              = urlRecordService;
     this._storeMappingService           = storeMappingService;
 }
Beispiel #2
0
        /// <summary>
        /// Get article picture (for shopping cart and subscription details pages)
        /// </summary>
        /// <param name="article">Article</param>
        /// <param name="attributesXml">Atributes (in XML format)</param>
        /// <param name="pictureService">Picture service</param>
        /// <param name="articleAttributeParser">Article attribute service</param>
        /// <returns>Picture</returns>
        public static Picture GetArticlePicture(this Article article, string attributesXml,
                                                IPictureService pictureService,
                                                IArticleAttributeParser articleAttributeParser)
        {
            if (article == null)
            {
                throw new ArgumentNullException("article");
            }
            if (pictureService == null)
            {
                throw new ArgumentNullException("pictureService");
            }
            if (articleAttributeParser == null)
            {
                throw new ArgumentNullException("articleAttributeParser");
            }

            Picture picture = null;

            //first, let's see whether we have some attribute values with custom pictures
            var attributeValues = articleAttributeParser.ParseArticleAttributeValues(attributesXml);

            foreach (var attributeValue in attributeValues)
            {
                var attributePicture = pictureService.GetPictureById(attributeValue.PictureId);
                if (attributePicture != null)
                {
                    picture = attributePicture;
                    break;
                }
            }

            //now let's load the default article picture
            if (picture == null)
            {
                picture = pictureService.GetPicturesByArticleId(article.Id, 1).FirstOrDefault();
            }

            //let's check whether this article has some parent "grouped" article
            if (picture == null && !article.VisibleIndividually && article.ParentGroupedArticleId > 0)
            {
                picture = pictureService.GetPicturesByArticleId(article.ParentGroupedArticleId, 1).FirstOrDefault();
            }

            return(picture);
        }
Beispiel #3
0
        public SubscriptionModelFactory(IAddressModelFactory addressModelFactory,
                                        ISubscriptionService subscriptionService,
                                        IWorkContext workContext,
                                        ICurrencyService currencyService,
                                        IPriceFormatter priceFormatter,
                                        ISubscriptionProcessingService subscriptionProcessingService,
                                        IDateTimeHelper dateTimeHelper,
                                        IPaymentService paymentService,
                                        ILocalizationService localizationService,
                                        ICountryService countryService,
                                        IArticleAttributeParser articleAttributeParser,
                                        IDownloadService downloadService,
                                        IStoreContext storeContext,
                                        ISubscriptionTotalCalculationService subscriptionTotalCalculationService,
                                        IRewardPointService rewardPointService,
                                        CatalogSettings catalogSettings,
                                        SubscriptionSettings subscriptionSettings,
                                        TaxSettings taxSettings,
                                        AddressSettings addressSettings,
                                        RewardPointsSettings rewardPointsSettings,
                                        PdfSettings pdfSettings)
        {
            this._addressModelFactory                 = addressModelFactory;
            this._subscriptionService                 = subscriptionService;
            this._workContext                         = workContext;
            this._currencyService                     = currencyService;
            this._priceFormatter                      = priceFormatter;
            this._subscriptionProcessingService       = subscriptionProcessingService;
            this._dateTimeHelper                      = dateTimeHelper;
            this._paymentService                      = paymentService;
            this._localizationService                 = localizationService;
            this._countryService                      = countryService;
            this._articleAttributeParser              = articleAttributeParser;
            this._downloadService                     = downloadService;
            this._storeContext                        = storeContext;
            this._subscriptionTotalCalculationService = subscriptionTotalCalculationService;
            this._rewardPointService                  = rewardPointService;

            this._catalogSettings      = catalogSettings;
            this._subscriptionSettings = subscriptionSettings;
            this._taxSettings          = taxSettings;
            this._addressSettings      = addressSettings;
            this._rewardPointsSettings = rewardPointsSettings;
            this._pdfSettings          = pdfSettings;
        }
Beispiel #4
0
 public PriceCalculationService(IWorkContext workContext,
                                IStoreContext storeContext,
                                ICategoryService categoryService,
                                IPublisherService publisherService,
                                IArticleAttributeParser articleAttributeParser,
                                IArticleService articleService,
                                ICacheManager cacheManager,
                                ShoppingCartSettings shoppingCartSettings,
                                CatalogSettings catalogSettings)
 {
     this._workContext            = workContext;
     this._storeContext           = storeContext;
     this._categoryService        = categoryService;
     this._publisherService       = publisherService;
     this._articleAttributeParser = articleAttributeParser;
     this._articleService         = articleService;
     this._cacheManager           = cacheManager;
     this._shoppingCartSettings   = shoppingCartSettings;
     this._catalogSettings        = catalogSettings;
 }
Beispiel #5
0
 public ArticleAttributeFormatter(IWorkContext workContext,
                                  IArticleAttributeService articleAttributeService,
                                  IArticleAttributeParser articleAttributeParser,
                                  ICurrencyService currencyService,
                                  ILocalizationService localizationService,
                                  ITaxService taxService,
                                  IPriceFormatter priceFormatter,
                                  IDownloadService downloadService,
                                  IWebHelper webHelper,
                                  IPriceCalculationService priceCalculationService,
                                  ShoppingCartSettings shoppingCartSettings)
 {
     this._workContext             = workContext;
     this._articleAttributeService = articleAttributeService;
     this._articleAttributeParser  = articleAttributeParser;
     this._currencyService         = currencyService;
     this._localizationService     = localizationService;
     this._taxService              = taxService;
     this._priceFormatter          = priceFormatter;
     this._downloadService         = downloadService;
     this._webHelper               = webHelper;
     this._priceCalculationService = priceCalculationService;
     this._shoppingCartSettings    = shoppingCartSettings;
 }
Beispiel #6
0
        /// <summary>
        /// Formats the stock availability/quantity message
        /// </summary>
        /// <param name="article">Article</param>
        /// <param name="attributesXml">Selected article attributes in XML format (if specified)</param>
        /// <param name="localizationService">Localization service</param>
        /// <param name="articleAttributeParser">Article attribute parser</param>
        /// <param name="dateRangeService">Date range service</param>
        /// <returns>The stock message</returns>
        public static string FormatStockMessage(this Article article, string attributesXml,
                                                ILocalizationService localizationService, IArticleAttributeParser articleAttributeParser)
        {
            if (article == null)
            {
                throw new ArgumentNullException("article");
            }

            if (localizationService == null)
            {
                throw new ArgumentNullException("localizationService");
            }

            if (articleAttributeParser == null)
            {
                throw new ArgumentNullException("articleAttributeParser");
            }



            string stockMessage = string.Empty;


            return(stockMessage);
        }
Beispiel #7
0
        /// <summary>
        /// Formats GTIN
        /// </summary>
        /// <param name="article">Article</param>
        /// <param name="attributesXml">Attributes in XML format</param>
        /// <param name="articleAttributeParser">Article attribute service (used when attributes are specified)</param>
        /// <returns>GTIN</returns>
        public static string FormatGtin(this Article article, string attributesXml = null, IArticleAttributeParser articleAttributeParser = null)
        {
            if (article == null)
            {
                throw new ArgumentNullException("article");
            }

            string sku;
            string publisherPartNumber;
            string gtin;

            article.GetSkuMpnGtin(attributesXml, articleAttributeParser,
                                  out sku, out publisherPartNumber, out gtin);

            return(gtin);
        }
Beispiel #8
0
        /// <summary>
        /// Gets SKU, Publisher part number and GTIN
        /// </summary>
        /// <param name="article">Article</param>
        /// <param name="attributesXml">Attributes in XML format</param>
        /// <param name="articleAttributeParser">Article attribute service (used when attributes are specified)</param>
        /// <param name="sku">SKU</param>
        /// <param name="publisherPartNumber">Publisher part number</param>
        /// <param name="gtin">GTIN</param>
        private static void GetSkuMpnGtin(this Article article, string attributesXml, IArticleAttributeParser articleAttributeParser,
                                          out string sku, out string publisherPartNumber, out string gtin)
        {
            if (article == null)
            {
                throw new ArgumentNullException("article");
            }

            sku = null;
            publisherPartNumber = null;
            gtin = null;



            if (String.IsNullOrEmpty(sku))
            {
                sku = article.Sku;
            }
            if (String.IsNullOrEmpty(publisherPartNumber))
            {
                publisherPartNumber = article.PublisherPartNumber;
            }
            if (String.IsNullOrEmpty(gtin))
            {
                gtin = article.Gtin;
            }
        }