Jump to content

Problem to initialize my dev environnement with PS 1.7.8.3


Anthony Voilet
 Share

Recommended Posts

Hi Prestashop Community !

I'm Anthony, some kind of fullstack web developer from France, main developer of a prestashop french platform about good, local, durable food ...

Actually, we use a very old prestashop as a base for our website (1.5.2 ... 10 years from now!), and i'm trying to begin a reboot of the site. So i forked the 1.7.8.3 version from github, and i'm facing some problems.
I checked and tried a lot of things to solve it by myself, but i failed ... so i come to you to get some help !

What i have :

  • i think i have correct web server configuration, good PHP version, MySQL also ... i used the phppsinfo.php script, and everything looks fine. I just did not install the PhpImagick library, but it's not required so it should be fine.
  • i installed the "dev" version using the "install-dev" directory, and everything looked fine.

At this point, everything looked OK, but ...

I've tried to build the front using the "./tools/assets/build.sh" script , and there was a problem about some "tether.js" library or something. After googling it, i solved it adding a "preferRelative : true" in my webpack config file.

But i have other problems :

  • if i keep the "_PS_MODE_DEV_" param to true, i have this error trying to access my Front Office : "Notice: Undefined offset: 0 in ImageRetriever.php line 305" Any idea ?
  • if i turn it to "false", i can access my Front Office, but i have no product images. I don't know why. (it works fine if i don't install the dev version)
  • in my Backoffice, i can't add "Images" to my products, check the first screenshot above. I have a lot of javascript errors in my console (please check the second screenshot) , and i think there is a link between these problems, but i can't solve it.

At this point, i'm stucked with these images problems and i can't go ahead because maybe there is a lot more problems i did not notice yet. I have to be confident about the initialisation of the project because it will be a long long long development task, so if any of you can help me, i would be very very grateful.

Also, maybe i did not post in the right forum channel or something, please forgive me. Thanks a lot for your time,
Have a nice day,
Anthony

9f8c66ccd44147d6612878fa06e9b67e.png

462cf6d984a2dcdaedc1a11c18b0381c.png

Share this post


Link to post
Share on other sites

I would strongly recommend using docker to spin up a PrestaShop development environment. I resisted myself for a long time but the move has been transformational to my workflow. It will set up the server, mysql database and all the source for the version you want to work on. All you need to do is run the installer. Better still you can have multiple different versions running and test out your code with different php versions etc. with just a few commands and an edit of the docker-compose.yml file.

All the code is exposed on your local filesystem so you can access it with your usual IDE.

Edited by Paul C
typos (see edit history)

Share this post


Link to post
Share on other sites

Hi there.

I use docker-compose (which you need to install separate from docker itself) as that allows you to specify the storage volume locations and all the other project info in a single file. I use a local linux machine where I store all my docker instances but it can work on other machine architectures too. In my home directory (/home/paul) I create a subdirectory for a particular project, so for example the directory prestashop_1.7 where I might want to have the latest version to test things out with:

Example docker-compose.yml file in /home/paul/prestashop_1.7:

version: "3"
services:
  presta17:
    image: prestashop/prestashop:latest
    networks:
      ps17:
    ports:
      - 8282:80
    links:
      - mariadb:mariadb
    depends_on:
      - mariadb
    volumes:
      - /home/paul/prestashop_1.7/src:/var/www/html
      - /home/paul/prestashop_1.7/src/modules:/var/www/html/modules
      - /home/paul/prestashop_1.7/src/themes:/var/www/html/themes
      - /home/paul/prestashop_1.7/src/override:/var/www/html/override
    environment:
      - PS_DEV_MODE=1
      - DB_SERVER=mariadb
      - DB_USER=root
      - DB_PASSWD=pickapassword
      - DB_NAME=ps17dev
      - PS_INSTALL_AUTO=0

  mariadb:
    image: mariadb
    networks:
      ps17:
    volumes:
      - /home/paul/prestashop_1.7/db/PrestaShop:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=pickapassword
      - MYSQL_DATABASE=ps17dev

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    networks:
      ps17:
    links:
      - mariadb:mariadb
    ports:
      - 1236:80
    depends_on:
      - mariadb
    environment:
      - PMA_HOST=mariadb
      - PMA_USER=root
      - PMA_PASSWORD=pickapassword

networks:
  ps17:
    external: true

You then run:

docker-compose up -d

The internal files are exposed via the volume paths on the left in the yml file above, including the database, and they will be created on first run but then persist. For example /home/paul/prestashop_1.7/src will be the root of the prestashop site.

You can easily use your own prestashop environment by just changing the image in the docker-compose.yml file.

Have fun :)

EDIT: It will complain about the external network which you will need to create before bringing it up with:

 

docker network create ps17

You could just use a default network but I also use Nginx Proxy Manager so I can expose the sites externally with a domain name.

Edited by Paul C
Added eternal network (see edit history)

Share this post


Link to post
Share on other sites

okay so i followed the advices of a mate on slack, and set up a working Debian virtual machine to check if the problem was Windows, and it was ... 
The build now works.

Thanks for all your explanations about Docker, but i have to learn more about Docker to manage it. Your advices will be usefull in the future for sure! 

 

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

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