Jump to content

Changing product "condition" values

Recommended Posts

I have a shop where the customer needs to change the condition options for products. Instead of the standard options "new", "used", and "refurbished". They need "new", "display", "preowned", and "refurbished".
Following the answer for PS 1.6 from https://www.prestashop.com/forums/topic/513876-change-product-condition-labels/, I have been able to change the backend to store these values in the ps_product table (with some adaptations for PS 1.7 - details below).
However, when I save the product with any option besides for the original "new" or "refurbished" conditions, the frontend thinks that there is no condition value for the product and will not display the condition on the product page in the frontend.
Here are the steps I took to get me to this point:

  • Ran this query on my ps_product table:
    ALTER TABLE `ps_product` CHANGE `condition` `condition` ENUM( 'new', 'display', 'refurbished', 'preowned' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'new';
  • Changed code in src/PrestaShopBundle/Form/Admin/Product/ProductOptions.php to reflect the new conditions in the product backend:
    ->add('condition', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array(
      'choices'  => array(
        $this->translator->trans('New', [], 'Shop.Theme.Catalog') => 'new',
        $this->translator->trans('Pre-Owned', [], 'Shop.Theme.Catalog') => 'preowned',
        $this->translator->trans('Display Model', [], 'Shop.Theme.Catalog') => 'display',
        $this->translator->trans('Refurbished', [], 'Shop.Theme.Catalog') => 'refurbished'
      'choices_as_values' => true,
      'required' => true,
      'label' => $this->translator->trans('Condition', [], 'Admin.Catalog.Feature')
  • Changed the code in classes/Product.php to:
    'condition' => array('type' => self::TYPE_STRING, 'shop' => true, 'validate' => 'isGenericName', 'values' => array('new', 'preowned', 'display', 'refurbished'), 'default' => 'new'),
  • Changed src/Core/Product/ProductPresenter.php to:
    private function addConditionInformation(
        array $presentedProduct,
        ProductPresentationSettings $settings,
        array $product
    ) {
        switch ($product['condition']) {
            case 'new':
                $presentedProduct['condition'] = array(
                    'type' => 'new',
                    'label' => $this->translator->trans('New Product', array(), 'Shop.Theme.Catalog'),
                    'schema_url' => 'https://schema.org/NewCondition',
            case 'display':
                $presentedProduct['condition'] = array(
                    'type' => 'display',
                    'label' => $this->translator->trans('Display Model', array(), 'Shop.Theme.Catalog'),
                    'schema_url' => 'https://schema.org/DisplayModelCondition',
            case 'preowned':
                $presentedProduct['condition'] = array(
                    'type' => 'preowned',
                    'label' => $this->translator->trans('Pre-Owned', array(), 'Shop.Theme.Catalog'),
                    'schema_url' => 'https://schema.org/PreOwnedCondition',
            case 'refurbished':
                $presentedProduct['condition'] = array(
                    'type' => 'refurbished',
                    'label' => $this->translator->trans('Refurbished', array(), 'Shop.Theme.Catalog'),
                    'schema_url' => 'https://schema.org/RefurbishedCondition',
                $presentedProduct['condition'] = false;
        return $presentedProduct;

So now, even though the backend works and the new values are being saved correctly in my ps_product table, the frontend will not display any condition value if I choose "preowned" or "display" in the backend.
Any ideas?

Share this post

Link to post
Share on other sites

Got this one to work.

You also need to edit the ps_product_shop table, and if you want the faceted search to work change the code in facetedsearch.php.


as for your code, the schema.org links may be best to keep them to an existing product condition page instead of a non existing page

Edited by jornedr (see edit history)
  • Like 1

Share this post

Link to post
Share on other sites

Hello and thank you for this thread as I just applied this modification for my website with success !


Unfortunately I cannot see the new condition fields as localizable in the classic theme under the Shop > Theme > Catalog translation section. This way the new conditions are in english language despite the website language used :( Am I missing something or do you have the same behaviour with this modification ?

Share this post

Link to post
Share on other sites
Posted (edited)

Hello, thank you for your answer !

Just for your informations in Prestashop (and apparently since 1.7.4) the switch that we have to modify with new condition in src/Core/Product/ProductPresenter.php is now located here /src/Adapter/Presenter/Product/ProductLazyArray.php

Edited by sachacohenfr
information missing (see edit history)

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More