Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

production-1 #2

Open
gelilaa opened this issue Feb 24, 2021 · 0 comments
Open

production-1 #2

gelilaa opened this issue Feb 24, 2021 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@gelilaa
Copy link
Owner

gelilaa commented Feb 24, 2021

Summary

On this feature the search menu was edited to include the parent hierarchy. this was archived by reusing the code of the main category page hierarchy method and adding extra filter to add the last category.
see the changes here

   parent(){

     return getTopLevelCategories(this.getCategories)
       .map(category => {
       const viewAllMenuItem = {
        ...category,
        name: i18n.t('View all'),
        position: 0
       };
    

        const subCategories = category.children_data
        ? category.children_data
          .map(subCategory => prepareCategoryMenuItem(
            this.getCategories.find(category => category.id === subCategory.id)
          ))
          .filter(Boolean)
        : [];

     const last = subCategories.map(category=>{
      const lastCategory= category.children_data
        ? category.children_data
          .map(subCategory => prepareCategoryMenuItem(
            this.getCategories.find(category => category.id === subCategory.id)
          ))
          .filter(Boolean)
        : [];   
         return lastCategory
      })
    

     const change = last.flat(1)
  
      return {
        ...prepareCategoryMenuItem(category),
        items: [prepareCategoryMenuItem(viewAllMenuItem)]
        .concat(subCategories),
        last: change
          .sort((a, b) => a.position - b.position)
     
          
      };
      
    })
    
    .sort((a, b) => a.position - b.position);

  },`

By using event targets the input check box can only render the selected category children.

check
lastCategory

Attaching the event handlers on the right elements with v-for iterations

image

Motivation

the motivation behind this feature is for the reason that the client's web-shop have a high number of products and categories with names that can be quite similar. To be able to select the right product it is important that the customer understands what the category includes, for that knowing the parent category really helps as it gives context to the application.

Unresolved details

  • it was a bit difficult to render the Last-categories right under the sub-categories. Even though parent_id can be used as a foreign key. it was hard to connect them as the first-category and the sub-categories connect.
    capybara theme is not working in github.

Future possibilities

there should be a way to render the last category as the client desire.
fix capybara theme problem

@gelilaa gelilaa added the documentation Improvements or additions to documentation label Feb 24, 2021
@gelilaa gelilaa self-assigned this Feb 24, 2021
@gelilaa gelilaa mentioned this issue Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant