How to add custom field on product details without adding database column?

Posted: July 17, 2019 at 9:25 AM Quote #242605
Hello, I need to add a custom field to product catalog without adding a new column in database or without using existing field. How can I do it?
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: July 17, 2019 at 11:08 PM Quote #242629
What are the fields for? Are they just information only?


This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Lam Woon Cherk
https://www.pronopcommerce.com

Looking to double your store's sale? Check out this plugin: http://bit.ly/2YVP8GT
(And no, it's not about putting more marketing money to get more traffics)

Sign up to my mailing list for tons of tips on nopCommerce: http://bit.ly/2fg5fMy
Posted: July 18, 2019 at 3:10 AM Quote #242642
If it is for information display you could use settings
You can create a new setting called Product.CustomFieldName.X where X is the product Id
Then to access the field for say product Id 20 then get the value for the Setting Product.CustomerFieldName.20

      string CustomFieldName = string.Format("Product.CustomFieldName.{0}", productId);
      int CustomFieldValue = _settingService.GetSetting(CustomFieldName, ...

Otherwise if it is to store a customer value use Product Attributes
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
www.SelectSystems.com.au
Select Systems International is a computer systems technology solution developer and integration service provider.
Posted: July 19, 2019 at 9:03 AM Quote #242683
Could you provide further details for what the fields will be used for?

Keep in mind if you use the approach offered by Yidna, you want to keep your settings clean, insure to delete values when deleting products but this may lead to loss of information. You'll need to consider whether the information may be needed for future reference.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: July 20, 2019 at 1:55 PM Quote #242719
Use GenericAttribute
Modify the model/view/controller, or the workaround (i.e. without modifying core .cs code) can resolve the service in the view:
https://www.nopcommerce.com/boards/t/35022/is-there-a-way-to-access-product-generic-atributes-in-a-view-.aspx
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
www.noptools.com
Premium support services
  • Dedicated premium support services provided by core developers are intended for persons who run mission critical websites, work on projects with tight deadlines, or want to get dedicated support.
Professional services
  • Want to open a new store? Want to take your store to the next level? Need a custom extension? We can customize nopCommerce to fit your store perfectly. Request a quote to get started.
eCommerce CONFERENCE 2019
Learn more