Object design with lately added attribute - oop

In my E-commerce application, I want to add a attribute to a Product, only after it was added to a Category.(Not all Products are in a Category here). How can I design the Product class?
Thanks in advance!

// Or am I missing something?
if (_category != null)
AddAttribute(...);

Related

Podio - Is it possible to assign an owner/creator to items?

I have looked in the documentation regarding this and haven't been able to find anything. If it is possible, I would appreciate if you let me know where
Thank you
You cannot assign a creator to an item. The item_creator is the authenticated Podio entity that created the item.
You could add member fields to the app and assign anyone you want in that.

API to fetch Oro Commerce Attribute list and details

We are searching for REST API to get all Attributes in OroCommerce
Thank you in Advance for help
Regards
Satish
You can use
GET /index.php/admin/api/entitystructures/product
All the attributes will be listed in the "fields" section along with other product entity fields.

Right way to model relationship in Entity Framework Core

I'm working on an ASP.Net Core MVC 2.0 application using Entity Framework Core 2.0. I need to upload a file related to an entity that is getting created by this application.
For example, imagine having to upload an invoice PDF as part of creating a payment entity. This should be a one-to-one relationship.
I'm having some trouble deciding how this should be represented in the Entity Framework data (and object) model. I found some guidelines that say that the entity foreign key should exist on the dependent object. In this case, the invoice would be the dependent object, so I should add the payment ID to the invoice object.
But I won't be downloading the invoice object as often as I would the payment object. And I was planning on a flow where the payment view would have a link to an action on the invoice controller to download the invoice using the invoice ID. So having the Invoice ID on the Payment object would make sense.
So I'm not sure of the best way to handle this.
As an aside, I've seen plenty of samples with uploading/downloading files, but not many that shows them how this might look when the files are associated with an entity in the database.
Does anyone have any suggestions?
I don't have any code that I can share at the moment; if anyone thinks code might help, I can throw something together.
Thanks in advance!
Just wanted to point out that Gert Arnold's comment was the correct answer; the following has examples of how to model one-to-one relationships.
https://learn.microsoft.com/en-us/ef/core/modeling/relationships
Thanks Gert!

Create Magento category with assigned id using SOAP api

I am working on a script (which is in Python) for doing some management on our Magento environment.
Now I am wondering if I can create categories with assigned ID.
I think this might be impossible due to key constraints. But is there a way?
Just putting category_id in the parameter list in catalog_category.create, it does not work, it just skips the parameter.
The main reason of wanting this is because I need to know the category ID in order to create the subcategories.
I do know the Magento API returns the ID of the created category. But, I have no way of knowing what subcategories are supposed to go to that created category. (Or I can rewrite a load of code, which I am not too fond of...).
So I was thinking this was the easiest way to go with right now.
Any suggestions, comments, answers? Anything is appreciated!
No, you can't. Magento's entity IDs are for Magento so you cannot specify what you'd like them to be.
When you create an entity with the API it will return the new ID, as you've said.
For your use case it might be easiest to add a new attribute to your categories in Magento, call it "my_category_id" or something and allow your API to set that instead.

I want to use custom payment method in prestashop

I am using prestashop for my online shop. I want to use custom payment option. feature would be similar like cash on delivery. what should i do.
Thank you
I have got the answer.
I just duplicate a module and it just work. Thanks to all.