[MSHOP-129] When creating a new shop product no price categories are found - no prices can be entered Created: 13/Mar/14  Updated: 16/Dec/14  Resolved: 05/Dec/14

Status: Closed
Project: Magnolia Shop (closed)
Component/s: None
Affects Version/s: 1.1.4
Fix Version/s: 1.1.5

Type: Bug Priority: Neutral
Reporter: Edgar Vonk Assignee: Robert Šiška
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Magnolia Enterprise 4.5.16


Attachments: PNG File Screen Shot 2014-03-13 at 15.46.03.png    
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Visible to:
Gordon Bentvelzen

 Description   

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 "";
    }


 Comments   
Comment by Edgar Vonk [ 20/Mar/14 ]

Ah, I just found out: it only happens when the shop products are stored in a subfolder inside the shop's products folder. Which in the case our client is always. ;-(

So the issue is simply that the current code assumes that all shop products are stored in the root of the shop's product folder which of course is not always the case.

Generated at Mon Feb 12 07:09:36 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.