-
Bug
-
Resolution: Fixed
-
Neutral
-
1.1.4
-
None
-
Magnolia Enterprise 4.5.16
When first creating a new shop product no price categories for the current shop can be found. The prices tab remains empty and no prices can be entered.
The workaround is to first save the new product and then reopen it. Now you can enter the prices.
The problem is in the DialogProductPrices#findShopName method. When the storageNode is still null it attempts to retrieve the current shop name by going up from the current position (or something). This no longer works. My guess is since the shop was somewhat refactored and the shop products and shop configuration nodes are now in different trees (in the old shop this was different).
Also I think the code does not take into account that shop products may be in folders (in folders in folders etc).
In any case the code does not work. I tested this on a clean Magnolia 4.5.16 install with a clean Magnolia Shop Module with the demo project as well.
protected String findShopName() { String shopName = ShopUtil.getShopName(this.getStorageNode()); if (StringUtils.isNotBlank(shopName)) { return shopName; } DialogControlImpl dialog = this.getParent(); while (dialog != null && !(dialog instanceof Dialog)) { dialog = dialog.getParent(); } if (dialog != null && StringUtils.isNotEmpty(dialog.getConfigValue("path"))) { String path = dialog.getConfigValue("path"); int lastIndex = path.lastIndexOf("/") + 1; if (lastIndex > 0) { return path.substring(lastIndex); } } return ""; }