What could be the problem if PriceAgentScheduler
doesn’t pick updates on the products but when we force it by using the query-parameter ?refresh=true
the feeds get updated?
Any idea?
I have also checked these but doesn’t seem to be relevant since the agent gets triggered but the data are not updated.
PriceAgentItemFactory
is extended as below:
public class PriceAgentItemFactoryImpl : PriceAgentItemFactory
{
private readonly LanguageService _languageService;
private readonly ChannelService _channelService;
public PriceAgentItemFactoryImpl(
IPriceCalculator priceCalculator,
IStockStatusCalculator stockStatusCalculator,
ICampaignPriceCalculator campaignPriceCalculator,
IOrderFactory orderFactory,
LanguageService languageService,
UrlService urlService,
CategoryService categoryService,
CurrencyService currencyService,
FieldDefinitionService fieldDefinitionService,
ISettingService settingService,
WebsiteService websiteService,
CountryService countryService,
ChannelService channelService,
DomainNameService domainNameService,
AuthorizationOperationHelperService authorizationOperationHelperService,
AccountService accountService,
AccessControlService accessControlService
)
: base(priceCalculator, stockStatusCalculator, campaignPriceCalculator, orderFactory, languageService, urlService, categoryService, currencyService,
fieldDefinitionService, settingService, websiteService, countryService, channelService, domainNameService, authorizationOperationHelperService,
accountService, accessControlService)
{
_channelService = channelService;
_languageService = languageService;
}
public override PriceAgentItemResult Create(PriceAgentItemArgs priceAgentItemArgs)
{
var channel = _channelService.Get(priceAgentItemArgs.ChannelId);
var channelWebsiteLanguage = _languageService.Get(channel.WebsiteLanguageSystemId.GetValueOrDefault());
priceAgentItemArgs.CountryId = channel.CountryLinks.FirstOrDefault(c => c.CountrySystemId.MapTo<Country>().Id == channelWebsiteLanguage.CultureInfo.GetRegionInfo().TwoLetterISORegionName)?.CountrySystemId ?? priceAgentItemArgs.CountryId;
var result = base.Create(priceAgentItemArgs);
#region Custom properties
result.Properties.Add("CustomLabel1", priceAgentItemArgs.Variant?.Fields?.GetValue<string>(ProductFieldNameConstants.CustomLabel1) ?? string.Empty);
result.Properties.Add("CustomLabel2", priceAgentItemArgs.Variant?.Fields?.GetValue<string>(ProductFieldNameConstants.CustomLabel2) ?? string.Empty);
result.Properties.Add("CustomLabel3", priceAgentItemArgs.Variant?.Fields?.GetValue<string>(ProductFieldNameConstants.CustomLabel3) ?? string.Empty);
result.Properties.Add("CustomLabel4", priceAgentItemArgs.Variant?.Fields?.GetValue<string>(ProductFieldNameConstants.CustomLabel4) ?? string.Empty);
#endregion Custom properties
return result;
}
Litium version: [7.4.2]