Jump to content

How to Add: Product Conditions in prestashop 1.7


Nico G.

Recommended Posts

Hello,

 

 

i décide to update my Prestashop 1.6 to 1.7 and i need to add Product Conditions in prestashop

 

I work with MarketPlaces WebServices/FTPExchange and i need more than: New, Used, & Refurbished.

 

 

 

 

 

 

I have already modified MySQL Database productshop/product

 

i have already modified Product.php

 

But in V1.7.x.x :        i'm unable to find information.tpl   !!!

 

Please, anyone can 'help me' to find how to add new Conditions with backoffice compatibility ?

 

 

 

 

 

 

i try to search inside files all therms $Condition or Refurbished

But, when i change anything in a /SRC (directory files) i creat a http 500 error when i going in one product

 

No others files was finded.

 

 

 

where can i find the equivalence of file:     information.tpl      please ? 

 

they are no: admin/themes/default/template/controllers /products

 

 

Very big thks :)

 

 

 

Link to comment
Share on other sites

 

they are no: admin/themes/default/template/controllers /products

Hello. Prestashop 1.7 is partially using twig template instead of smarty for admin.

What you're looking for is

prestashop_files/src/PrestaShopBundle/Resources/views/Admin/Product/catalog.html.twig

See other .twig files in the folder

Link to comment
Share on other sites

Maybe... yes, but what information did you think was the right one ?

 

I have not your knowledge to know what i need to find in this file.

 

 

because in the       \src\PrestaShopBundle\Form\Admin\Product\ProductOptions.php

 

(that create a 500 http error if i modify anything) but, i can clearly read:

        ->add('condition', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array(
            'choices'  => array(
                 $this->translator->trans('New', [], 'Shop.Theme.Catalog') => 'new',
                 $this->translator->trans('Used', [], 'Shop.Theme.Catalog') => 'used',
                 $this->translator->trans('Refurbished', [], 'Shop.Theme.Catalog') => 'refurbished'

is a translation file and in top we can watch:

use PrestaShopBundle\Form\Admin\Type\CommonAbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Form\Extension\Core\Type as FormType;

 

Resources/views/Admin/Product/catalog.html.twig

See other .twig files in the folder

 

please, don't tell me it's just the name of the directory that made you "give me that answer" !?
 

Edited by Nico G. (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...
  • 6 years later...

1. Add State in Database:

  - Open the ps_product and ps_product_shop tables in your database.

  - Modify the condition column to include the new state, such as "test".

2. Modify ProductOptions.php File:

  - Open the file src\PrestaShopBundle\Form\Admin\Product\ProductOptions.php.

  - Locate the line with 'condition', FormType\ChoiceType::class.

  - Add the new option to the choices array: $this->translator->trans('Test', [], 'Shop.Theme.Catalog') => 'test',.

3. Update the Product Class:

  - Open the file classes\Product.php.

  - Find the line stating 'condition' => array(...).

  - Add "test" to the list of possible values for condition, e.g., 'values' => array('new', 'used', 'refurbished', 'test').

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...