Hybris upgrade returning a different response - sap-commerce-cloud

We have recently upgraded our system to the latest patch of Hybris 1808. We noticed that the cmsoccaddon has been moved into a full extension by SAP - so we have defined a dependency from our webservices extension onto this new extension. Since doing this, the content of our /pages endpoint has changed. Specifically, before we patched, custom properties in CMS components were added directly into the JSON representation of the CMS component (example 1 below). After we patched, custom properties are being displayed (in a different structure) within the "otherProperties" property (example 2 below).
Example 1
{
"uid": "SomeCustomCmsComponent1",
"typeCode": "SomeCustomCmsComponent",
...
"customProperty": "customValue"
}
Example 2
{
"uid": "SomeCustomCmsComponent1",
"typeCode": "SomeCustomCmsComponent",
...
"otherProperties": [{ "key": "customProperty", value: {type: "string", value: "customValue"}}]
}
Question:
Was declaring a dependency on the new cmsoccaddon extension the correct thing to do?
Does Spartacus support referencing the properties in "otherProperties" in a transparent way -- or do we have to do additional conversion on the Spartacus side?
Do we need to perform customization/configuration in Hybris to move these custom properties out of the "otherProperties" attribute, directly onto the JSON root of the CMS component?

it was an issue on our side with a previous customization of the cmsoccaddon.

Related

Using a custom table/DAC in a generic inquiry in 2020R2

I am upgrading a customization project from 2019R1 to 2020R2. I have several custom tables/DACs that I reference within generic inquiries. In 2019R1, I'm able to select from these and it works fine without error.
In 2020R2, an obsolete table error is raised for existing customizations and I'm not able to select new custom DACs at all.
Is there an attribute or another way to suppress this error and allow visibility of new custom DACs so they can be used within generic inquiries?
Here is the code for my custom DAC:
namespace P1S
{
[System.SerializableAttribute()]
[PXCacheName("P1S Shipment Serial Nbrs.")]
public class PSSOShipSerialNbrs : PX.Data.IBqlTable
{
... column definitions ...
}
}
Unpublishing all customizations and then re-publishing from the main Customization Project screen (SM.20.45.05) fixes the error. Custom DACs are also now visible in the table selector.

Display custom product association data in a new tab

I wrote an extension to add data to the ProductEntity in Shopware 6 and used the following tutorial:
https://developer.shopware.com/docs/guides/plugins/plugins/framework/data-handling/add-complex-data-to-existing-entities
I also used another tutorial (https://developer.shopware.com/docs/guides/plugins/plugins/administration/add-new-tab) to add a new tab to the product detail view. Everything works so far.
In the product detail view I added a text field in my custom tab. But my problem is: how to get my data into the view? I want to add my new association to the product when the detail view is loaded. Therefore I tried to override the component from Shopware as follows:
Shopware.Component.override('sw-product-detail', {
template,
mounted() {
const criteria = this.productCriteria;
criteria.addAssociation('myNewAssociation');
this.productCriteria =criteria;
},
});
This does not work because productCriteria has no setter (original component can be found here: https://github.com/shopware/platform/blob/6.4.1.0/src/Administration/Resources/app/administration/src/module/sw-product/page/sw-product-detail/index.js)
Does anyone know how I can add a custom association to an existing one in vue.js in Shopware 6? What's the correct way to inject a custom association to the product detail view so I can use data from that in my new custom tab? The documentation always stops when it becomes interesting...
I would suggest to overwrite the productCriteria method and call the parent to not need to fully copying the existing code, like this:
Shopware.Component.override('sw-product-detail', {
template,
computed: {
productCriteria() {
const criteria = this.$super('productCriteria');
criteria.addAssociation('myNewAssociation');
return criteria;
},
},
});
Let me know if it works.
I believe also you don't need to mention the template in the override (when I did this last time, the template was displayed twice)
EDIT: All good with the template.

how to override a shared component in spartacus storefront

I am trying to add more information to the price section in the cx-cart-item component:
cart entries
However, I don't see an outlet so that I can just attach the component "after" or "before" the price
How do I extend the render functionality? I am thinking:
copying and pasting the html and ts to just "append" the functionality - when I tried this I get errors indicating that tags such as cx-media does not exist
find a way to override the component, however, I think this is not possible since I was not able based on the documentation here https://sap.github.io/cloud-commerce-spartacus-storefront-docs/customizing-cms-components/#custom-angular-cms-components
The simplest answer, for now, would be overriding the component, as in the docs you've specified.
You can check the working example here:
https://github.com/tobi-or-not-tobi/spartacus-bootcamp/tree/master/src/app/features/components/banner
In the future, it should be possible to easily replace not only cms components, but also lower-level components.

JSF portlet generating different Id for different environment

I am creating a dynamic form which hides/unhides fields based on selection of radio buttons.
I was using normal javascript function as given below which is working fine in my portal environment(the ids are the JSF ids which i get by viewing source).
function printHiddenValue(){
alert("hello");
alert(document.getElementById('A1938:j_idt4:create-ticket:hiddenId').value);
if(document.getElementById('A1938:j_idt4:create-ticket:j_idt19:0').checked){
alert("incident sellected")
} else
{
alert("change sellected")
}
}
but fails when i deploy the war in different environment as differnrt ids are generated by the portal environment.
You should not rely on dynamic ids, not just A1938 part of id but also j_idt4 may change if you change structure of your page for example. You should assign id to component j_idt4, and for first part you can use EL #{facesContext.externalContext.response.namespace} to get namespace of your portlet:
document.getElementById('#{facesContext.externalContext.response.namespace}:j_idt4:create-ticket:hiddenId')

Is it possible to use a common resource in an non-themed view?

I am using orchard cms v 1.4 and developing some site content that is stand alone and does not use the standard theme. I would like to use some of the resources already declared in manifest files on the non-themed views. However they only render when I apply a theme to the controller or the specific view.
In my view I am including the following:
#{
Script.Require("jQuery").AtHead();
}
This only functions as expected when I include: [Themed]
as an attribute on my controller.
Any idea's on how to get this to work without creating a full theme for my stand alone pages?
Yes, see http://weblogs.asp.net/bleroy/archive/2012/10/20/writing-an-unthemed-view-while-still-using-orchard-shapes-and-helpers.aspx
What's important is that you use a shape as the model. Themed or not doesn't matter then.

Resources