Closed chrisastley closed 3 years ago
I will look into this in a few days.
Thanks for the documentation improvement, Chris!
Hi,
As a temporary workaround I have had to comment out lines in vendor/bigbridge/product-import/Model/Resource/Resolver/CategoryImporter.php
$urlKey = $this->nameToUrlKeyConverter->createUniqueUrlKeyFromName($categoryName, $existingUrlKeys);
//if (count($idPath) === 2) {
$urlPath = $urlKey;
//} else {
// $parentUrlPath = $this->getParentUrlPath($parentId);
// $urlPath = $parentUrlPath . '/' . $urlKey;
//}
$targetPath = "catalog/category/view/id/" . $categoryId;
Hi Chris,
Thanks for the code example, I can use it.
If the categories have flat paths, does that mean that the products should have flat url keys as well?
The importer does not change categories. It only creates them. It identifies them by their admin-name. The code only updates the children_count of existing categories.
I've only ever used flat product paths without the category but can't imagine a scenario where you would have the category path in the product but a flat category structure as you would normally use the full category path and not a single category.
Ok, that was just a thought.
I am working on this feature; hope to complete it somewhere next week. I will not make a habit of supporting third-party extensions, but this one seemed acceptable. :)
Chris, I created release 1.6.0 for this feature.
To activate it, add the url parameter category-url-type=flat
Try it out and let me know if it works as you expect.
Thank you. I have just tried to update via composer but the new version doesn't appear to be available yet. Will try again shortly.
@chrisastley can I close this?
@chrisastley can I close this?
Yes, sorry. All working as expected. Thank you.
Hi,
I've just come across an issue regarding my category URL structure.
Previously when creating/revising products with Magmi, and in combination with using Mirasvit SEO I didn't have this issue. Within the SEO extension, there is a setting to allow a flat URL structure for categories.
So previously I would have; Top Level Category/Child Category/Child Child Category
The URLs would be; domain.com/top-level-category domain.com/child-category domain.com/child-child-category
But since using the module to create/update it is now using default structure again. domain.com/top-level-category domain.com/top-level-category/child-category domain.com/top-level-category/child-category/child-child-category
I appreciate that this is not default functionality, but would it be possible to add an attribute to the
<category_global_names>
XML, for example<category_global_names structure="flat">
Another concern is that when using Magmi if a category already existed then no changes were made to it, so for example.
If I created a product with Magmi and it had a category called 'Special Offers', it would then create a url_key called special-offers. Now if I went into Magento and edited the key to say clearance-items and clicked save I would have a category called 'Special Offers' accessible on domain.com/clearance-items.
If I then added more items to the 'Special Offers' category the url_key would remain as the updated version. But my issue here is that looking at the behaviour and code it appears you reset the category url_key, url_path and rewrite every time the category is passed.
Maybe it could be an option to pass a custom url_key to a category also so it doesn't need to reflect the one generated from the name?