Kingsman-The-Secret-Service / prestashop-17-category-wise-products-display

Prestashop 1.7 Module Category Wise Product Display
3 stars 8 forks source link

Category name not translating #1

Open oterox opened 6 years ago

oterox commented 6 years ago

Hi, really nice module ;) I have the module working on a multilingual site (spanish/english) and it always show the category name in english. The categories are translated in the backend and working perfect everywhere. Any idea why?

kaviarasankk commented 6 years ago

In this module the multilingual is not handled. Please if anyone can implement and make pull request

On Tue, 7 Aug 2018 at 17:58, Javier Otero notifications@github.com wrote:

Hi, really nice module ;) I have the module working on a multilingual site (spanish/english) and it always show the category name in english. The categories are translated in the backend and working perfect everywhere. Any idea why?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Kingsman-The-Secret-Service/prestashop-17-category-wise-products-display/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/ACIwiunlqCJJhcokHzqT9v_JfOsFrW11ks5uOYfRgaJpZM4VyECv .

grojof commented 5 years ago

Hi, for the problem of the name of category:

First On the kk_categorywiseproducts.php file, in this part of code (line 292):

{        foreach ($categoryIds as $categoryId) {

            $category = new Category((int) $categoryId);

            $products[$categoryId]['category'] = $category;
            $products[$categoryId]['categoryLink'] = Context::getContext()->link->getCategoryLink($categoryId);
            $products[$categoryId]['product'] = $this->getProducts($category);
        }

You can add this line at the end: $products[$categoryId]['id_language'] = $this->context->language->id;

Then you get the active language id. With code edited:

{        foreach ($categoryIds as $categoryId) {

            $category = new Category((int) $categoryId);

            $products[$categoryId]['category'] = $category;
            $products[$categoryId]['categoryLink'] = Context::getContext()->link->getCategoryLink($categoryId);
            $products[$categoryId]['product'] = $this->getProducts($category);
            $products[$categoryId]['id_language'] = $this->context->language->id;
        }

Second Edit views\templates\hook\kk_categorywiseproducts.tpl

Modify: line 29

<h1 class="text-uppercase">{$product['category']->name[1]}</h1>

With this:

<h1 class="text-uppercase">{$product['category']->name[$product['id_language']]}</h1>

line 39

<a class="btn btn-secondary" href="{$product['categoryLink']}">View All {$product['category']->name[1]}</a>

With this: NOTE: Added option to translate by Prestashop module

<a class="btn btn-secondary" href="{$product['categoryLink']}">  {l s= 'View All ' d='Shop.Theme.Catalog'}{$product['category']->name[1]}</a>
AldeaG commented 4 years ago

Hi. I´m using the latest version of this module in Prestashop 1.7.6.3 which already has those modifications. But still is not able to translate. I don´t even see the option in backend in Prestashop. It is always redirecting me to "Modules" again and again. I still see "View all "