Category pyramid guide doesn’t handle subcategories correctly.

WCMp Core

Resolved
Viewing 6 reply threads
  • Author
    Posts
    • #214169
      embpri
      Participant

      Namaste,

      The CPG on the vendor dashboard doesn’t handle subcategories correctly. When someone selects a subcategory, the CPG puts the product in every single category in the hierarchy instead of just the last one.

      For example, if my category structure looks like this:

      Music > Classical > Mozart.
      Copy

      Then when the vendor chooses

      Mozart
      Copy

      in the CPG, the product should only be in the category

      Mozart
      Copy

      . However, in its current state, the CPG puts the product in all three categories separately:

      Music AND Classical AND Mozart
      Copy

      This is wrong; could you please tell me how I can fix this?

      Thanks. 🙂

    • #214190

      @embpri I have informed the team about this. We will add a fix for this in our next update.
      You can keep track of the issue from here https://github.com/multivendorx/MultiVendorX/issues/601.

    • #214257

      @embpri Our development team has thoroughly investigated this matter, and they’ve outlined the specified flow for CPG.
      In this context, the coding structure mandates selecting the Parent category first, followed by the Subcategory. Upon selection, you will be directed to the add product page, presenting the categories in a tree-like structure. That’s why you can’t change the category selection here.

      However, if this flow doesn’t align with your flow, you can easily opt for an alternative. By disabling the CPG option in the settings (https://tinyurl.com/yngw5nuw), vendors will gain the flexibility to choose the category for their products directly on the add product page. If they select a subcategory, only that will be displayed as the product category on the frontend.

      If you need any further assistance from our end please let us know.

    • #214267
      embpri
      Participant

      Hi,

      Thank you very much for your reply. I understand what you’re saying, however this still poses a problem.

      If I disable the CPG, then vendors can choose top-level categories (which I don’t want). The way the CPG is structured only allows vendors to select the last subcategory in the tree (which is the desired flow).

      With the CPG’s structure, it makes sense that the product should only belong to the final subcategory selected, and not in each of the categories selected along the way.

      I don’t want to change the CPG’s flow, just the fact that once a category has been selected from the CPG, the product should ONLY be in that category, and not individually in each of its parents.

      If you could please guide me as to how I can change this behaviour on my own, I’ll be very grateful as this is an important requirement. 🙂

      Thanks.

    • #214318

      Dear @embpri, I have shared this with our dev team and they are looking into the coding structure. If possible they will modify the code accordingly. You can keep track of the progress of the issue from here – https://github.com/multivendorx/MultiVendorX/issues/605.

    • #214594
      embpri
      Participant

      Hi,

      Thank you for creating the issue, in the meantime you can mark this topic as closed.

      To resolve the issue on my website, I have currently stopped using the CPG (which is not ideal but that’s okay) and reverted back to the default category picker.

      I had to use some additional JS to make sure that Vendors could only pick categories from the last level of a subcategory tree, and only choose one category at any time.

      In my opinion this is the point of using the CPG, and the flow should be changed.

      For anyone having a similar issue, here’s how I solved it on my website:

      
        document.querySelectorAll('.product_cat ul').forEach( (e) => {
          e.parentElement.firstChild.remove();
        } );
      
        document.querySelectorAll('input[name="tax_input[product_cat][]"]').forEach( (e) => {
          e.type = 'radio';
        } );
      
      Copy

      This JS makes all category checkboxes into radio boxes so that only one can be selected at any time, and then it removes the checkbox input from all parent categories so that only categories from the the last level of a tree can be selected.

    • #214622

      Thanks @embpri, for helping out the community.

Viewing 6 reply threads

The topic ‘Category pyramid guide doesn’t handle subcategories correctly.’ is closed to new replies.