Souris Posted May 1, 2015 Share Posted May 1, 2015 Hello Prestashopppers. I have two problems with my horizontal menu. One will be quite specific, and one pretty common/universal. Let's start of with the specific one. We have categories on multiple levels, causing multiple dropdowns to be shown in the horizontal menu. The menu-module is not the default one, it came with a LeoTheme theme. (Yes, I already asked them without much result). As you can see in the image below, the 'third'-level dropdown appeared in an awkward and weird location. Next to that I tried to make clear what result I'm looking for. I have a piece of code that can move the 'second'-level dropdown, so I'm guessing only the object name needs to be changed, but to what? The code (global.css): .dropdown-submenu:hover > .dropdown-menu { top: 100%; left: 0; } Second issue, which I think is pretty common. Despite that I couldn't find a working solution. As you can see in the image above we have some common categories like 'Wheels' and 'Accessories' that we want to use for different makes of vehicles. (Make A -> Wheels is different from Make B -> Wheels). We do not want to change to category names to 'Wheels - Make A' or something to take them apart, we think that it does not look nice. We like to use .csv import for everything and we are on Prestashop 1.5.4.1. Thank you for your time and effort in advance. Link to comment Share on other sites More sharing options...
PascalVG Posted May 2, 2015 Share Posted May 2, 2015 Hi Souris, - Do you have a link to your site. css changes are easier when able to play with the site... - The category is a problem, as by default, the import is on category name, and duplicate names will just take the first one. - Two options: 1) Make an SQL script that temporarily renames the categories in Wheels_A, Wheels_B etc. Then do the import on these categories, so it knows what category is needed. At the end, run another SQL script to reverse the Wheel changes back to all 'Wheels'. 2) Maybe you could patch the import module so that you don't use category names, but ID's instead. This would make each category unique. My 2 cents, let me know your URL. pascal. Link to comment Share on other sites More sharing options...
Souris Posted May 3, 2015 Author Share Posted May 3, 2015 Hello Pascal, thank you for your response! The URL is: buzzracing.co.uk Patching the module sounds very promising. How should I see this? Copy and paste it from a newer version of PS, or is is code work? Thanks Pascal. Link to comment Share on other sites More sharing options...
PascalVG Posted May 4, 2015 Share Posted May 4, 2015 I expect this css code to work: Edit file themes/<your theme folder>/css/global.css .dropdown-submenu .dropdown-submenu:hover ul.dropdown-menu { left: 100%; top: 8px; } Option 2 indeed needs re-programming of the import module. Do you have experience coding in php?? I expect you have to modify file: controllers/admin/AdminImportController.php (It's not the easiest file to go through. Lots of import going on here, easy to get lost in the functions) My 2 cents, pascal Link to comment Share on other sites More sharing options...
Souris Posted May 5, 2015 Author Share Posted May 5, 2015 You're the best Pascal, the CSS worked like a charm! Thank you! Naturally, I tried not to waste my time in the meantime, so after some searching I ended up with this: This is actually by design. PrestaShop doesn't support importing categories with the same name. It has been previously reported as a bug, but PrestaShop simply added a message on the Import tab that says "Note that the category import does not support categories of the same name" and marked the bug as resolved. There is a feature request here for this feature, so you're not alone in wanting this.Looking at the categoryImport() function in admin/tabs/AdminImport.php, it appears it is the following code that checks whether a category with the same name already exists and then changes the category ID to it instead of what is in the CSV file: $categoryAlreadyCreated = Category::searchByName($defaultLanguageId, $category->name[$defaultLanguageId], true);// If category already in base, get id category backif ($categoryAlreadyCreated['id_category']){ $catMoved[$category->id] = intval($categoryAlreadyCreated['id_category']); $category->id = intval($categoryAlreadyCreated['id_category']);}Perhaps commenting out this code will make the CSV import do what you want. In this thread. It looked very promising, but I still haven't figured it out. Because the article is based on a different version of PS, the file pointed out wasn't on my configuration. Instead I tried to delete a very similar code in the file you pointed out.. No luck so far. I applied a temporarily fix ('Wheels (brand A)' and 'Wheels (brand B)' to temporarily satisfy the shop's owner and make a deadline. Nonetheless I really want to figure and sort this out. Since I think my temporarily solution above looks very unprofessional. Steven Link to comment Share on other sites More sharing options...
PascalVG Posted May 6, 2015 Share Posted May 6, 2015 Yes, agree that brand a/brand b doesn't look good. But as said, maybe temporarily rename them to Wheels brand a/ Wheels brand b when doing the import. After that you can again remove the brand a/brand b, so the customer won't see them listed as such. When not too many categories and not too often have an import, you could do this by hand. Otherwise just make some SQL file to rename them back and forth. In the long run the import on ID would be nice :-) If I have time, I may give it another look, but please keep trying! pascal. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now