Moncef Grey Posted October 24, 2021 Share Posted October 24, 2021 i added new conditions to condition list and everythins works fine except the translation ( I wanna translate the new conditons from English to French ) Here's what i did: in classes/Product.php i added the new conditions: 'condition' => array('type' => self::TYPE_STRING, 'shop' => true, 'validate' => 'isGenericName', 'values' => array('new', 'latest_available', 'pre_order', 'used', 'refurbished'), 'default' => 'new'), in js/admin/products.js i did this: tabs_manager.onLoad('Informations', function(){ $('#condition').attr('disabled', true); $('#condition option[value=latest_available]').removeAttr('selected'); $('#condition option[value=pre_order]').removeAttr('selected'); $('#condition option[value=refurbished]').removeAttr('selected'); $('#condition option[value=used]').removeAttr('selected'); }); in src/Adapter/Presenter/Product/ProductLazyArray.php i added these new cases: case 'latest_available': return array( 'type' => 'latest_available', 'label' => $this->translator->trans('Latest available', array(), 'Shop.Theme.Catalog'), 'schema_url' => 'https://schema.org/latest_availableCondition', ); break; case 'pre_order': return array( 'type' => 'pre_order', 'label' => $this->translator->trans('Pre-order', array(), 'Shop.Theme.Catalog'), 'schema_url' => 'https://schema.org/pre_orderCondition', ); break; and finally in src/PrestaShopBundle/Form/Admin/Product/ProductOptions.php i added this: ->add('condition', FormType\ChoiceType::class, [ 'choices' => [ $this->translator->trans('New', [], 'Shop.Theme.Catalog') => 'new', $this->translator->trans('Latest available', [], 'Shop.Theme.Catalog') => 'latest_available', $this->translator->trans('Pre-order', [], 'Shop.Theme.Catalog') => 'pre_order', $this->translator->trans('Used', [], 'Shop.Theme.Catalog') => 'used', $this->translator->trans('Refurbished', [], 'Shop.Theme.Catalog') => 'refurbished', ], 'attr' => [ 'class' => 'custom-select', ], 'required' => true, 'label' => $this->translator->trans('Condition', [], 'Admin.Catalog.Feature'), ]) yet the translation isn't working even the whole website and the BO are in French ! Link to comment Share on other sites More sharing options...
Moncef Grey Posted October 24, 2021 Author Share Posted October 24, 2021 Anyone? Link to comment Share on other sites More sharing options...
ps8modules Posted October 25, 2021 Share Posted October 25, 2021 And where is the problem? Administration> International> Translations. You have a clear path to translation. Shop.Theme.Catalog 1 Link to comment Share on other sites More sharing options...
ps8modules Posted October 25, 2021 Share Posted October 25, 2021 https://doc.prestashop.com/m/mobile.action#page/51184320 1 Link to comment Share on other sites More sharing options...
Moncef Grey Posted October 25, 2021 Author Share Posted October 25, 2021 I wanted Latest available to be translated to french since the website is in french Latest available to Derniers dispos Link to comment Share on other sites More sharing options...
ps8modules Posted October 25, 2021 Share Posted October 25, 2021 1 Link to comment Share on other sites More sharing options...
ps8modules Posted October 25, 2021 Share Posted October 25, 2021 These are the very basics. How can you make adjustments in the e-shop if you don't know the basics? Programming is not just Ctrl + C and Ctrl + V !!! Link to comment Share on other sites More sharing options...
iinmass Posted October 25, 2021 Share Posted October 25, 2021 What Moncef Grey is trying to ask exactly is how to add a new string into the translation, a new custom string. In this example, the string "latest available" is a custom value that isn't provided within the translated strings of prestashop themes 1 Link to comment Share on other sites More sharing options...
ps8modules Posted October 25, 2021 Share Posted October 25, 2021 And I repeat that new translations will be loaded automatically. Read the next articlehttps://devdocs.prestashop.com/1.7/themes/reference/theme-translation/ Link to comment Share on other sites More sharing options...
Moncef Grey Posted October 25, 2021 Author Share Posted October 25, 2021 Thanks it worked! I appreciate your help 1 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