Click on products generate 404 after set language on PRODUCT VIEW (Product list layout) menu voice

Phoca Cart - complex e-commerce extension
morphinestyle
Phoca Professional
Phoca Professional
Posts: 118
Joined: 19 Jan 2022, 19:55

Click on products generate 404 after set language on PRODUCT VIEW (Product list layout) menu voice

Post by morphinestyle »

Hello, i can reproduce a 404 error when clicking on products.

I write the complete annotation, but it is the final step that generates the error:

- change phoca category language to IT
- create new phoca category + assign language to EN
- mutual multilanguage assignment of the newly created categories IT <-> EN

STATUS: click on products is still OK

- change products ordering
- change products name adding IT suffix + regenerate url alias
- BATCH process: SET LANGUAGE -> IT + MOVE to new IT category

STATUS: click on products is still OK

- BATCH process: SET LANGUAGE -> EN + COPY to new EN category
- replace "IT (2)" with EN from every new batched product title + regenerate url alias + set TAX
- publish every these new EN products
- added new EN category to the menu PRODUCT VIEW (Product list layout)
- (actually PRODUCT VIEW (Product list layout) menu voice is still set to "ALL LANGUAGE")

STATUS: click on products is still OK from IT frontend, and also i can see correctly every/only IT products
STATUS: click on products is still OK from EN frontend, and also i can see correctly every/only EN products


- assign PRODUCT VIEW (Product list layout) menu voice to EN language

STATUS: click on products generate a 404 ERROR
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48402
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Click on products generate 404 after set language on PRODUCT VIEW (Product list layout) menu voice

Post by Jan »

Hi, did you follow this advice:
https://www.phoca.cz/blog/1230-how-to-c ... -in-joomla

Jan
If you find Phoca extensions useful, please support the project
morphinestyle
Phoca Professional
Phoca Professional
Posts: 118
Joined: 19 Jan 2022, 19:55

Re: Click on products generate 404 after set language on PRODUCT VIEW (Product list layout) menu voice

Post by morphinestyle »

Hello Jan,
I carefully read the page, but it does not explicitly indicate any information for multilanguage. However, I believe I have understood that there should be a single main shop item.

Currently, I am using Products View (Product list layout). Should it be correct to:
  • Create an item in a HIDDEN main menu set to LANGUAGE ALL with the alias mysite.com/shop.
  • Create an item in the Italian menu set to LANGUAGE IT as a URL REDIRECT to mysite.com/shop with the alias mysite.com/it/shop-it.
  • Create an item in the English menu set to LANGUAGE EN as a URL REDIRECT to mysite.com/shop with the alias mysite.com/en/shop-en.
This way, I can have the shop URL displayed to the user as both /en/shop and /it/shop as desired, and the products won't generate a 404 error as they should.

Is this how Phoca Cart wants the menu and multilanguage management to be?

However, there is a problem: if I change the language while I am inside a Phoca Cart product, it doesn't take me to the equivalent product in the other language; it shows: NO PRODUCTS FOUND.

I see that it is trying to load the product with the name in the requested language, but still with the base suffix of the current language, for example: mysite.com/en/[alias-Italian-product-name].
If I correct the suffix to IT -> mysite.com/it/[alias-Italian-product-name], it loads the product correctly.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48402
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Click on products generate 404 after set language on PRODUCT VIEW (Product list layout) menu voice

Post by Jan »

Hi, hmmm, really hard to say what can be wrong, switching products when switching language is the base function, testing now, see no problem:

Image

The best way is always have only one menu item (and it does not matter if multilangugage or not) :idea:

Jan
If you find Phoca extensions useful, please support the project
morphinestyle
Phoca Professional
Phoca Professional
Posts: 118
Joined: 19 Jan 2022, 19:55

Re: Click on products generate 404 after set language on PRODUCT VIEW (Product list layout) menu voice

Post by morphinestyle »

EDIT: MAYBE I HAVE FOUND THE SOURCE OF THE PROBLEM, see the edit at the bottom of post

Hi Jan,
I removed all the aliases and left only one Phoca Cart menu item in the ITALIAN menu... I'm going crazy trying different approaches, but I can't make it work as you showed: the product doesn't switch to the requested language (for example, when changing from Italian to English, the suffix remains in Italian, and it obviously gives an error: NO PRODUCT FOUND).

What setup are you using?

Moreover, if I follow your advice and use only one SHOP menu item, for example, in the ITALIAN menu, I wonder how English users would reach/know the shop page since they won't see any SHOP menu item on their menu?

It seems impossible to make the multilanguage feature work properly.
I'm using Phoca Cart version 4.0.7 and a single menu item: Products View (Product list layout).
What setup should I use?

Please help!

EDIT: MAYBE I HAVE FOUND THE SOURCE OF THE PROBLEM
I discovered that using Categories View (Category list layout - default view) multilingual product switch WORKS!
While using Products View (Product list layout) multilingual product switch DOES NOT WORK!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48402
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Click on products generate 404 after set language on PRODUCT VIEW (Product list layout) menu voice

Post by Jan »

Hi, thank you for the info, I will take a look at it but as written in the article, really no idea if there will be way to somehow change it (as if the menu links are in conflicts, it can affect this negatively :-( )

Jan
If you find Phoca extensions useful, please support the project
morphinestyle
Phoca Professional
Phoca Professional
Posts: 118
Joined: 19 Jan 2022, 19:55

Re: Click on products generate 404 after set language on PRODUCT VIEW (Product list layout) menu voice

Post by morphinestyle »

Ok Jan, i hope so much you can solve.

Now i'm using only one Phoca Cart menu voice set to ALL LANGUAGE, the simpliest setup: ONE VOICE FOR ALL LANGUAGE, nomore other Phoca Cart menu voice are present now... But only Products View (Product list layout) works, i need to use Categories View (Category list layout - default view).

Try yourself.

EDIT:
I did further tests: the switch between products of different languages ​​(for example: IT<->EN) only works ONLY if the menu voice is Categories View (Category list layout - default view).

It DOESN'T WORK COMPLETELY if I replace the menu item with:
  • Category View (Product list layout)
  • Product View (Product layout)
  • Products View (Product list layout)


Currently I have only one Phoca Cart entry (menu voice), and I'm not using URL or ALIAS: unfortunately it only works with Categories View (Category list layout - default view)
morphinestyle
Phoca Professional
Phoca Professional
Posts: 118
Joined: 19 Jan 2022, 19:55

Re: Click on products generate 404 after set language on PRODUCT VIEW (Product list layout) menu voice

Post by morphinestyle »

EDIT2:
I discovered that product language switching is working (only with Products View (Product list layout) Phoca Cart menu item) also using the setup with URL redirect voices on IT and EN menus (needed to display a menu voice on every language website version).

So, there seems to be something making it not work properly with all the other Phoca Cart menu items: Category View (Product list layout), Product View (Product layout) and Products View (Product list layout)
morphinestyle
Phoca Professional
Phoca Professional
Posts: 118
Joined: 19 Jan 2022, 19:55

Re: Click on products generate 404 after set language on PRODUCT VIEW (Product list layout) menu voice

Post by morphinestyle »

EDIT3:

After confirming that the multilingual product switch is only working on the menu item "Categories View" (Category list layout - default view), I kindly request if it would be possible to create a temporary fix for this menu item by adding an option to display all products within all categories (including nested ones) but without showing the categories themselves. This way, we could emulate the functionality of "Products View" (Product list layout), which is not currently working correctly with multilingual support.


While "Categories View" (Category list layout - default view) works perfectly with multilingual support, it may not be particularly suitable for an ecommerce site with only a few products and a small number of categories (2/3 categories). Displaying just 2 categories with only 1/2 products inside each category might not look appealing. It would be better to show all products together (7/6 products) on a single page.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48402
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Click on products generate 404 after set language on PRODUCT VIEW (Product list layout) menu voice

Post by Jan »

Hi, testing now, I switched from "categories view" to "items view" (in fact items view as main shop link is used often, e.g. here: https://www.phoca.cz/jtd/ )

Image

Testing now, no problems (even there are other Phoca Cart menu links):

Image

See GIF (the main menu link is "Phoca Cart" and it is a "items view" menu link - when clicked - all items displayed). Then if you got to detail, then it normally switches to its assigned product in other language :idea:

Image

BTW the routing used in Phoca Cart for SEF is Joomla routing so even I want to change it, this is not possible as it is a Joomla core function :idea:

Jan
If you find Phoca extensions useful, please support the project
Post Reply