logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
judy at Web2Market  
#1 Posted : Thursday, September 9, 2021 11:50:10 AM(UTC)
judy at Web2Market

Rank: Advanced Member

Groups: Developers
Joined: 11/7/2018(UTC)
Posts: 303

Thanks: 21 times
Was thanked: 5 time(s) in 5 post(s)
I am upgrading code from one of our plugins to AC9 and there are a lot of configuration settings stored in the ac_storesettings table.
One of them, at least, is not getting saved correctly.
The view code is
@Html.DropDownListFor(model => model.MomVersionId, new SelectList(
new[]
{

new { Value = "1", Text="Standard(DBF)"},
new { Value = "2", Text="MomXL(Sql)"},

},
"Value",
"Text",
Model.MomVersionId), new { @class = "form-control", style = "width:300px;" })

The controller picks up the selected value of 1 OK
options.MomVersion = ((MOMVersion)AlwaysConvert.ToByte(configModel.MomVersionId)); --value is XBase
Then there is a an options.Save() method that uses
StoreSettingsManager settings = AbleContext.Current.Store.Settings;

settings.SetValueByKey("W2M_MOMInventory_MomVersion", _MomVersionId.ToString());

I save using this code, which I picked up elsewhere in AC:
Store store = AbleContext.Current.Store;
store.Settings.Save();
IStoreRepository _storeRepo = AbleContext.Resolve<IStoreRepository>();
_storeRepo.Save(store);

The value of _MOMVersionId here is 1, which is correct. But it gets saved as 0. When I step through the code, the settings show all the AC store settings, then there is a _settingMap, which shows a value of 0. See image. How can I fix this?
Thanks
2021-09-09_12-49-01.png (14kb) downloaded 0 time(s).

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

judy at Web2Market  
#2 Posted : Thursday, September 9, 2021 12:15:44 PM(UTC)
judy at Web2Market

Rank: Advanced Member

Groups: Developers
Joined: 11/7/2018(UTC)
Posts: 303

Thanks: 21 times
Was thanked: 5 time(s) in 5 post(s)
Well, never mind. It's working now after I selected a different value in the dropdown and saved, then selected the one I wanted and saved again.
The screenshot of the settings was for a different setting.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.