Skip to content

Commit 2ea72fb

Browse files
committed
MC-5373: Product couldn't be pulled to CMS Page when it was assigned to a specific website
Use preview_converter for html to inject store_id and prevent storage in master format
1 parent 0e194da commit 2ea72fb

File tree

5 files changed

+91
-4
lines changed

5 files changed

+91
-4
lines changed

app/code/Magento/PageBuilder/view/adminhtml/pagebuilder/content_type/products.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<style name="padding" storage_key="margins_and_padding" reader="Magento_PageBuilder/js/property/paddings" converter="Magento_PageBuilder/js/converter/style/paddings"/>
3535
<attribute source="data-role" name="name"/>
3636
<attribute source="data-appearance" name="appearance"/>
37-
<html name="html"/>
37+
<html name="html" preview_converter="Magento_PageBuilder/js/converter/attribute/preview/store-id"/>
3838
<css name="css_classes"/>
3939
</element>
4040
</elements>

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/products/mass-converter/widget-directive.js

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/js/converter/attribute/preview/store-id.js

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/products/mass-converter/widget-directive.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export default class WidgetDirective extends BaseWidgetDirective {
4242
products_count: data.products_count,
4343
type_name: "Catalog Products List",
4444
conditions_encoded: this.encodeWysiwygCharacters(data.conditions_encoded || ""),
45-
store_id: 0,
4645
};
4746

4847
if (attributes.conditions_encoded.length === 0) {
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
import {DataObject} from "../../../data-store";
7+
import ConverterInterface from "../../converter-interface";
8+
9+
/**
10+
* @api
11+
*/
12+
export default class CreateValueForStoreId implements ConverterInterface {
13+
14+
/**
15+
* Convert value to internal format
16+
*
17+
* @param value string
18+
* @returns {string | object}
19+
*/
20+
public fromDom(value: string): string | object {
21+
return value;
22+
}
23+
24+
/**
25+
* Convert value to knockout format
26+
*
27+
* @param name string
28+
* @param data Object
29+
* @returns {string}
30+
*/
31+
public toDom(name: string, data: DataObject): string {
32+
if (typeof data[name] !== "string") {
33+
return "";
34+
}
35+
36+
return (data[name] as string).replace(/\}\}$/, " store_id=\"0\"}}");
37+
}
38+
}

0 commit comments

Comments
 (0)