Jump to content

PHP code on pages not working in 7.2


german

Recommended Posts

First of all, sorry if I'm not posting in the right place, I'm quite new when it comes to this developing world. 

The truth is that I'm a beginner (very) programmer and I got a job for a local business. I chose to develop their website on prestashop (1.7.4.2, and I'm doing somehow ok, even without understanding the guts of it. 

The reason I'm posting is that in Pages I have built a gallery where products are shown, using a php that gets the info from the database. Since the web is hosted on 1&1 (there are certain things that the owner wants this way) I had to change from php 5.6 to 7.2 since it has no longer support from them. After the change the code I built is no longer giving result. The rest of the website works without apparent problem, but just the code I built is not working. I tested it on online services that check the code and again, apparently, it shows no problem. So I need some community-human based help and I'm too inexperienced yet to know what to do in this case. 

 

I found that the object producto I'm instantiating from the class below is not being created. It happens just in 7.2

 

I paste you here the code from the php:

 

<?php

class producto implements JsonSerializable
{
    private $precio;
    private $nombre;
    private $imagen;

    /**
     * @return mixed
     */
    public function getPrecio()
    {
        return $this->precio;
    }

    /**
     * @param mixed $precio
     */
    public function setPrecio($precio)
    {
        $this->precio = $precio;
    }

    /**
     * @return mixed
     */
    public function getNombre()
    {
        return $this->nombre;
    }

    /**
     * @param mixed $nombre
     */
    public function setNombre($nombre)
    {
        $this->nombre = $nombre;
    }

    /**
     * @return mixed
     */
    public function getImagen()
    {
        return $this->imagen;
    }

    /**
     * @param mixed $imagen
     */
    public function setImagen($imagen)
    {
        $this->imagen = $imagen;
    }

    /**
     * @return mixed
     */
    public function getUrl()
    {
        return $this->url;
    }

    /**
     * @param mixed $url
     */
    public function setUrl($url)
    {
        $this->url = $url;
    }
    private $url;


    public function __construct($nombre,$precio,$imagen,$url)
    {
        $this->precio = $precio;
        $this->nombre = $nombre;
        $this->imagen = $imagen;
        $this->url = $url;
    }

    public function jsonSerialize()
    { return[
        'nombre'=>$this->nombre,
        'precio'=>$this->precio,
        'imagen'=>$this->imagen,
        'url'=>$this->url,
    ];
    }
}

 

Edited by german (see edit history)
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...