Hybris: add attributes to product via Impex - sap-commerce-cloud

I have a product catalog and a classification catalog. The product catalog contains a product and the classification catalog contains attributes, however when I try to insert the product with the attributes it doesn't show when I click the product and go under attributes tab.
How I enter product with attributes:
$lang=en
$productCatalog=productCatalog
$catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default='Staged'])[unique=true,default=$productCatalog:Staged]
$approved=approvalstatus(code)[default='check']
$baseProduct=baseProduct(code,$catalogVersion)
$clAttrModifiers=system='MySystemClassifications',version='General',translator=de.hybris.platform.catalog.jalo.classification.impex.ClassificationAttributeTranslator,lang=nl
$id=#id[$clAttrModifiers];
INSERT_UPDATE Product;code[unique=true];$id;$catalogVersion
;M300047;200.59;
Is there something I have to do after adding it to link it to the product?

There are a lot of pitfalls when working with the classification system. I cannot see an obvious error in your impex script, so I want to ask for every precondition, that has to be fulfilled.
You need a ClassificationSystem (equivalent for Catalog for categories and product)
You need a ClassificationSystemversion (equivalent for CatalogVersion for category and product)
Your product has to be in a category.
This category needs a super category of type ClassificationClass.
You need a ClassificationAttribute.
You need a ClassAttributeAssignment which assigns your ClassificationAttribute to a ClassificationClass.
(Optional) You can create ClassificationAttributeUnits to define the unit of an attribute.
(Optional) You can create ClassificationAttributeValues to define possible values for a ClassificationAttribute.
When these preconditions are met, you can assign values to a product using your impex script.
Since this structure is a bit tricky, let me clarify it with an example:
Consider the ClassificationClasses "Photocameras" and "Videocameras". There are ClassificationAttributes like "Resolution", who are assigned to both ClassificationClasses using a ClassAttributeAssignment. But there might also be a ClassificationAttribute "Shutter Speed" assigned to only photocameras using a ClassAttributeAssignment. For photocameras shutter speed might be measured in milliseconds. So in the ClassAttributeAssignment for photocameras and shutter speed you assign a ClassificationUnit "milliseconds". Now consider a new ClassificationAttribute "Form Factor". There are only a few available form factors, so for each form factor you create one ClassificationAttributeValue. Using a ClassAttributeAssignment, you can assign an ClassificationAttribute "Form Factor" to your "Photocameras" ClassificationClass with the ClassificationValues "Compact Camera", "SLR" and so on. Once again, there might be different form factor values for video cameras.

Related

Dividing an inline form into columns based on model field value in django admin

I'm setting up an an admin page that handles the storage of data of a product, in this case it is shoes which most of you might realize usually comes in pairs of left and right. The shoes have a differing number of fields and that's why i've implemented an eav system where the forms for the shoes are contained in an inline.
All i would like to do now is to group the forms in the inline in two columns depending on the value of the field shoe_side (can be 'L' or 'R' for left and right)
This is regarding the change view since the system is set up so that it creates all the neccessary fields depending on another model we can call a product recipe.
I did this in javascript with templates before in a similar situation but that was without the inline fields so it's not applicable. I think if I could just group the fields of the two columns into two formsets I could edit the template to get the needed layout but I don't know if one can create formsets based on a field in the model, I haven't really grasped the concept of formsets.
# The inline model
class Component(models.Model):
part_name=models.ForeignKey(PartRecipe)
shoe_side=models.CharField(choices=[('L', "Left"),('R', "Right")
product_id = ForeignKey(ProductModel)
....
# The 'parent' model
class ProductModel(models.Model):
product = ForeignKey(Productrecipe)
....
# a lot of not relevant fields
# The admin classes
class ComponentInline(admin.StackedInline):
template = 'admin/componentinline/stacked.html'
model = Component
class ProductAdmin(admin.ModelAdmin):
...
inlines = [ComponentInline,]

Can I see relationships in the list view in KeystoneJS?

In my KeystoneJS (v4) setup I have the following lists:
Stores
Product Categories
Tags
The stores can have categories associated with them.
If I open up a category I can see it's Relationships (stores that use a certain category).
But, is it possible to see these relationships in the list layout as well? Not seeing it in the docs...
Adding the relationship to the column is not possible.

Maximo crossover domain

In Workorder tracking , there is a field "LEAD" which will display ID of lead.
In our requirement we have to display Leadname along with Lead ID.
SO I created a new field for Leadname in Workorder and used crossover domain with a new relation between Wordorder and Person. Relation where clause being personid=:lead
The crossover domain copies over the value of Leadname from Displayname attribute of PERSON object and is working fine when we give an ID in Lead attribute of Workorder.
However in case if I give a Lead ID and then remove the lead ID in WO , then leadname still remains It doesnt get modified to null.
I believe its because the crossover condition (personid=:lead ) is not satisfied and hence no action is being performed. I tried setting condition on Source and Destination as well but that also is not working.
Is there any way to default a field to null in case if crossover where clause condition is not met.
I was able to get this implemented by using automation script , but would like to know whether same can be achieved by some other means.
If it is just displaying the information you should use a multipart textbox to show lead and displayname of the person. You need to add a relation from workorder to person using the lead attribute. Then normal Maximo logic will clear the 'description' when you clear the actual lead field.
There is a way to cross-over fixed values, including null, to clear another field on a crossover action. Just make an ALNDOMAIN with a empty value (leave description empty) In the crossover domain use a relation that points to this specific domain/value and use dot-notation to crossover the description. Use relationname.description as the sourcefield in your crossover
RFE 72680 / crossovers, option to set targets to null or default value when trigger field becomes null is intended to address this shortfall in functionality. Please cast your vote!

how to render custom layout of the projection of known content items

I have defined my own projection by a query which returns a set of content items of known content type. I would like to take pick up certain content parts of these content items and display them in the list. Using shape tracing tool I have found the view template where to write my custom layout:
/Views/Parts.ProjectionPart.cshtml
but from the Model variable in the template I can not get the data I want because it is way too high above from the content parts data.
a good example of what I want: let's say I want to render product catalog as defined in this tutorial:
http://skywalkersoftwaredevelopment.net/blog/writing-an-orchard-webshop-module-from-scratch-part-5
but I want only to render a list which consists from items:
name of the owner who created the product
name of the product.
publish date of the product
and I need to render it at one place, i.e., not separately in their own part views.
Have you tried adding a layout in the projector module? There is a properties mode option that lets you select which fields/data to show. If the data you want is not there, you should be able to implement an IPropertyProvider. There are examples of this in the Projections module code.

Solr Schema Advice for Dynamic Facetable Fields

I haven't used Solr for about three years, and I see that it has now jumped up to 3.5.
The "Documents" that I am trying to add to my Index are properties.
The majority of all properties will have about ten of the same types of fields. Such as
Longitude
Latitude
Name
Location Name.. etc
However, I also want to add in attributes about the property which should be facetable.
Property receive features, which are grouped into ten of so categories. Such as...
(Entertainment, Attractions, General, Kitchen, Spa etc). And then the user when adding their property would select items from a pre defined list.
So that for example, if they are adding General features, they might check:
✓ Heating, ✓ Balcony, ✓ Garage, ✓ Washing Machine etc.
Then on my presentation layer, These options might be displayed under the heading General with all of the available facets that fall within the General category.
So, this is my problem... if I make a facet field called "general" I would actually want to add a lot of values to this field. But then can you facet over a multi valued field?
And then I would want to do exactly the same for "spa" where the user might check that the property has a Swimming Pool, Sauna and a load of other features etc.
Any advice as to how I should construct my schema would be appreciated.
Yes, you can facet over multivalued field. Watch this presentation by Solr's developer about facets:
The Many Facets of Apache Solr by Yonik Seeley
I hope that this will have all answers you need. Only thing you need to do in schema is to set the field as multivalued (and maybe also make some processing if this is text not ids, but this is showed nicely in presentation and slides

Resources