vue-storefront-api icon indicating copy to clipboard operation
vue-storefront-api copied to clipboard

Import for backwards compatibility

Open nuovecode opened this issue 6 years ago • 2 comments

Hi all,

For a project I need to keep the old vue storefront urls format with the url key but without the category id. For example: /c/my-category instead of /c/my-category-3

I basically need to run the mage2vs import whith the parameter generateUniqueUrlKeys set to false.

I haven't found a way to do it except by editing the mage2vs.js script

        console.log(' == CATEGORIES IMPORTER ==');
        return exec('node', [
          '--harmony',
          'node_modules/mage2vuestorefront/src/cli.js',
          'categories',
          '--removeNonExistent=true',
          '--extendedCategories=true',
          '--generateUniqueUrlKeys=false'
        ], { env: env, shell: true })

Can I make this parameter configurable (I can do it myself and do a PR)? or does anyone know how to suggest another way to do it without touching the core?

Thanks!

nuovecode avatar May 06 '19 11:05 nuovecode

I think this should be added to mage2vs.js either way. Looking at the mage2vuestorefront/src/cli.js function for this, that variable is defaulted to true, and the logic around this value is still checked when creating the url_path that the urlDispatcher uses. So even the new way of creating url paths needs this option.

rain2o avatar Jul 04 '19 13:07 rain2o

@rain2o can you propose a PR with this fix please?

pkarw avatar Jul 04 '19 15:07 pkarw