Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/05/2021 in all areas

  1. Du kan skjule teksten med css. Du du ikke angiver link til din shop kan svaret ikke blive mere specifikt.
    1 point
  2. Hola @matbalbi si te fue útil, puedes dar un LIKE en la respuesta, abajo el corazón que esta a la derecha saludos
    1 point
  3. Send them the error message "error while sending query packet..."
    1 point
  4. Prestashop and their crapy upgrades ... I've had the same issue, fixed by downloading the exact same version that I have on my website, deleted the src folder and replaced it with the fresh one ! Make a complete backup in case
    1 point
  5. ça c'est la config tordue par excellence. Il faut que prestashop génère des urls en https pour les liens donc activer ssl et ssl_everywhere Mais il ne faut pas qu'il redirige car il voit le mauvais protocole et le mauvais pour donc désactiver les redirections dans SEO&URL S'assurer également qu'il n'y a pas de Redirection https dans le .htaccess
    1 point
  6. Ok, that is it! I was so angry that I can't find any working solution for this so I created my own and it is working. This is the code which You can place in Your file or just download the attached file and put it into main folder of Your shop and run http://yourshop.pl/remove_unused_images.php in Your browser. Things to consider if you are courious but not mandatory: Change $limit value from 19 line when testing, for example like 100, for production mode use $limit = $counted_images; if scan return 0 or there is an error just check if $scan_dir is ok by adding ddd($scan_dir); arround 11 line of code. Upload script again, test it if scan directory is properly created, if not then change $shop_root and $image_folder values from the beginning of the script, remove ddd part, reupload and run script again. It might take a long time so if You will run out of time then just run the script again. Feel free to not ask about anything because I won't support this code, I am not responsible for it and I won't help You. Likes for this post will be appreciated because there are some paid solutions, modules that are doing basically the same thing. This one is free. This will take some time to process - if You have large ammount of files it can exceed your max_execution_time limit on Your hosting. If this will happen You can try to take parts like 5000 or 10 000 and edit for ($i=1 to start with for ($i=5000 and then restart the script again and again with changing the limit <?php ####PUT THIS FILE INTO YOUR MAIN SHOP FOLDER#### // root path of the shop, almost no one needs to change something here. $shop_root = $_SERVER['DOCUMENT_ROOT']."/"; // need to have slash / at the end $image_folder = 'img/p/'; // also needs slash at the ennd $scan_dir = $shop_root.$image_folder; include_once($shop_root.'config/config.inc.php'); include $shop_root . 'config/settings.inc.php'; #---------------------------------------------# $last_id = (int)Db::getInstance()->getValue(' SELECT id_image FROM '._DB_PREFIX_.'image ORDER BY id_image DESC '); $counted_images = Db::getInstance()->executeS(' SELECT count(*) as qnt FROM '._DB_PREFIX_.'image '); $counted_images = (int)$counted_images[0]['qnt']; echo 'There was '.$last_id.' images in database but only '.$counted_images.' is used right now. Lets check how many of them are eating up our storage without no reason.<br>'; //$limit = 150; // for testing $limit = $last_id; // for production $removed_images = 0; for ($i=1; $i <= $limit; $i++) { if (!imageExistsInDB($i)){ $imageDir = str_split($i); $imageDir = implode('/', $imageDir); $path = $scan_dir.$imageDir; deleteImagesFromPath($path); } } function deleteImagesFromPath($path) { global $removed_images; $images = glob($path . '/*.{jpg,png,gif,jpeg}', GLOB_BRACE); if ($images){ foreach ($images as $file) { if (is_file($file)) { unlink($file); } } $removed_images++; echo 'Deleted images from folder ' . $path . '/' ."<br/>"; } } function imageExistsInDB($id_image){ return Db::getInstance()->getValue(' SELECT id_image FROM '._DB_PREFIX_.'image WHERE id_image = '.(int)$id_image ); } echo '--------------------------------------<br>'; if ($removed_images > 0) echo 'Hurray! We removed '.$removed_images.' product images!'; else echo 'Everything is ok with Your images. I did not removed any of them or I made it before. Good Job Presta!'; remove_unused_images.php
    1 point
  7. {if !Context::getContext()->cart->containsProduct(12)} your message {/if}
    1 point
  8. Eliminar la ID de las url trae muchos problemas
    0 points
×
×
  • Create New...