How to duplicate the Category Tree in Shopware 6 for a new sales channel? - content-management-system

We want to open a shop in a new sales channel with a different, but similar category structure.
Is there a built-in or programatic way to duplicate a root category an all it's children so we can assign it to a new sales channel and start translating and modifying?

Related

Is it bad practice to add a relation "type" to a many to many table in SQL? [duplicate]

This question already has answers here:
How can you represent inheritance in a database?
(7 answers)
Closed 2 years ago.
I am building a Postgres database which has the following two tables:
Projects (id, startDate, etc...)
and
Employees (id, name, etc...)
I want to keep track of the types of contributions that an employee adds to a project. For example, employee #1 might be an "engineer" on project 1 and a "manager" on project 2. I also don't want to restrict the number of contributions an employee can make to a certain project. So employee #1 could be both a "engineer" and a "manager" for a single project.
My first instinct was just to have a many to many relation between the two titled ProjectEmployees or something and store the projectId, employeeId, and a contributionType as a string which would only take on values from an enum as to not have to deal with misspellings or any related issues.
My main question is just whether or not this is a bad practice. My other thought was to split up each contribution type to its own table. So instead of an EmployeeProjects table, there would be tables such as ProjectEngineers, ProjectManagers, etc... and instead of storing the contributionType as a column, it would be implicit in the table I'm using, and the table only has to store projectId and employeeId. There are many more tables in this database which have a similar sort of relationship where there are many to many relations between different tables, but each relation could be one of many "types" of relations. Is it wiser to split these all into separate tables for each type of relation? Or is it better to just keep track of the relation type in a more general table like my first idea?
My desired result is to just be able to efficiently see which all project contributions (and types) an employee worked on as well as to see all contributors + contributor types for a project.
Use the many to many relation as in your first idea, which in my opinion is a good practice.
Avoid the creation of one table per contribution type as is not scalable and flexible. I.E. if one day you'll have a new contribution type, with the 2nd option you will need each time
to create a new table
to write the new table management logic
proceed with a new deploy of your sw
About the topic of storing the contribution types on a table (with id and description) or as a constraint with contribution types strings enumerated, in my opinion both are valuable solutions.
But if you think to manage contribution types in your software (in a first release or in the future) maybe having a table with contribution types anagraphics can be better. It depends by your design and requirements
Make a table to store contribution types as strings (manager, engineer, etc) and contribution type id (numeric id). This prevents misspellings.
Make a table to store contributions with columns: employee id, project id, contribution type id (you may want other columns there, but it should be unique on the combination of these 3 columns). Do not store contribution types as strings in a table like this, since, as you correctly mentioned, this may allow misspellings. Another reason is to save disk space. An extra join with a small table of contribution types is a small price to pay.

UML Class Diagram: Attributes and methods dependant on two classes

I am trying to do a simple UML model about a car dealership.
The company has at least one store where in each they sell at least one type of a car. Each store has a name and each car has a name, type, and price. Each outlet also keeps stock of every car they sell.
I have outlined the idea in this image:
In addition to this, after every day, the number of cars sold gets recorded into a database. How would I add this to the model? Also, is there a better way to model the amount of cars in stock than to have it as a separate class? If there is a better diagram to model this type of scenario with I'd also be interested.
Thanks for any help!
There are many ways to model sales records. The simplest and most common is to have a sales ledger. It creates sales entries for items. The item is a separate (association) class that records the number of sold items, the price paid, the sales date, the sales person, and more. Pretty simple and straight forwards, until you get to the gory details. Ask your next dealer...
You can model a sales record as a separate class. Let's call it DaySales. Each day, you have a new instance of DaySales, containing the date and the amount of cars sold. I have given attribute date the data type 'String', because UML does not define a Date type. But if you define it yourself, you could better use Date than String.
I have removed the association between Car and Outlet, because it is already implicitly defined via Stock, but you can keep it as a redundant association, if you like.
I have altered the multiplicity of the association between Car and Stock, because there will be multiple cars in stock.

Show Another Model Data in Admin Grid Magento

I am working on a extension in which Customer subscribe for Promotion, when Customer subscribe I will save user id, product id.
In subscriber module, I have to show Customer Name and Product Name.
So My Question is how can we Show Another Model Data in Grid?
If your extension uses a grid that extends Mage_Adminhtml_Block_Widget_Grid, you can modify the _prepareCollection() function to include data from other source (via joins). Also you will have to add new columns to the grid, which can be done in function __prepareColumns().
For an example look at the grid block of the Mage_Newsletter module Mage_Adminhtml_Block_Newsletter_Subscriber_Grid

OO Design and the data model for change log function

: EJB 3, JPA (EcipseLink) and Oracle Database
An application has two entities: Group and Person. There is a one-to-many relationship.
The requirement is, that every changes of Group and Person must be saved for later to roll or show.
The 1st idea:
make the id and timestamp of the change/create as a composite primary key for Group and Person.
Every change will create a new object with the same id and new timestamp. For Example, a Group hat been changed, then create a new Group. but the relationship between Group and Person unchange. Here hat a problem: the constrait "one-to-many" will breaked!. Now one person hat the relation to two groups with the same id.
The 2nd idea:
for Group and Person create two another Entities GroupArchive and PersonArchive. In Group and Person only the lastest Infomation. Any changes will be copied and saved to Archive Entities. Between Group and GroupArchive hat a one-to-many relationship. And same for Person and PersonArchive.
Are my ideas realizable? Has anybody a better idea?

Trying to control course content visibility to a moodle group

I am using moodle 2.2.4.
I have students in a course from district 1 and district 2. I have a request that the student in district 2 be assigned an advisor in the course. The advisor must only see the data of the student in district 2.
This is how I am trying to accommodate the request.
I created a new role called advisor based on the student role.
I created a new group in the course called group1.
I created a new account called group2_advisor
I enrolled group2_advisor in the role of advisor into group1 in the course.
I moved the student into group1.
When I log in group2_advisor, I can see just the district 1 student (which is great), BUT, I still see district 1 data when I click on the forum or quiz activities.
I initially based the advisor role on the non-editing teacher role, but that still showed both districts even after I had completed steps 1-4. When I based the advisor role on the student role I was only able to see the district 2 data (which is what i am after).
Any insights are very much appreciated.
Look at Moodle group default feature group content visibility.