Jump to content

Error when I try to edit a product in backend


Dan Gavrila

Recommended Posts

18 minutes ago, ComGrafPL said:

Hello,

Debug show more issues? Is it only on one, specific product? Any changes / updates before issue? Have you tried to switch to PHP 8? ( as it is recommended for PS 1.8+ )

Hello,

Thank you for your reply. This is the only one, and if I create a new product it works. I'll try to switch to php 8.

Link to comment
Share on other sites

23 minutes ago, ComGrafPL said:

Hello,

Debug show more issues? Is it only on one, specific product? Any changes / updates before issue? Have you tried to switch to PHP 8? ( as it is recommended for PS 1.8+ )

I updated to php 8.2, nothing changed. If I duplicate the product is working, I attached prod.log to see the errors.

prod.log

Link to comment
Share on other sites

4 hours ago, TiaNex Shopping said:

maybe you can try to  modify the parameter to be optional or have a default value,

i don't have a prestashp instance, now,

public function __construct(

string $isbn ='',

string $upc='',

string $ean13='',

string $mpn='',

string $reference='',

)

 

It worked! Thanks a lot! This is the final code:

declare(strict_types=1);

namespace PrestaShop\PrestaShop\Core\Domain\Product\QueryResult;

/**
 * Holds product details
 */
class ProductDetails
{
    /**
     * @var string|null
     */
    private $isbn;

    /**
     * @var string|null
     */
    private $upc;

    /**
     * @var string|null
     */
    private $ean13;

    /**
     * @var string|null
     */
    private $mpn;

    /**
     * @var string|null
     */
    private $reference;

    /**
     * @param string|null $isbn
     * @param string|null $upc
     * @param string|null $ean13
     * @param string|null $mpn
     * @param string|null $reference
     */
    public function __construct(
        ?string $isbn = null,
        ?string $upc = null,
        ?string $ean13 = null,
        ?string $mpn = null,
        ?string $reference = null
    ) {
        $this->isbn = $isbn;
        $this->upc = $upc;
        $this->ean13 = $ean13;
        $this->mpn = $mpn;
        $this->reference = $reference;
    }

    /**
     * @return string|null
     */
    public function getIsbn(): ?string
    {
        return $this->isbn;
    }

    /**
     * @return string|null
     */
    public function getUpc(): ?string
    {
        return $this->upc;
    }

    /**
     * @return string|null
     */
    public function getEan13(): ?string
    {
        return $this->ean13;
    }

    /**
     * @return string|null
     */
    public function getMpn(): ?string
    {
        return $this->mpn;
    }

    /**
     * @return string|null
     */
    public function getReference(): ?string
    {
        return $this->reference;
    }
}
 

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...