Jump to content

Edit History

Tomasci

Tomasci

On 10/21/2019 at 10:56 AM, dsolsona said:

Hi,

I've this problem at Prestashop 1.7.6.1. 

Is not fixed yet?

 

David

Hi David,

I guess not. I also still had the problem. I've written a small script as a work around. Here it is:

<?php
$servername = "localhost";
$username = "***";
$password = "***";
$dbname = "***";

$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

$sql = "DELETE FROM ps_product WHERE id_category_default = 2 AND price = 0 AND redirect_type = ' ' AND state = 0";

if ($conn->query($sql) === TRUE) {
    echo "Products cleaned up successfully";
} else {
    echo "Error: " . $conn->error;
}

$conn->close();
?>

Just replace the *** with respective DB username, password and name and save the script via FTP.
Next you can call the script manually on it's location or via cronjob.

For example: I have the script in  rootfolder/crons/clean-products.php.
And I have a cronjob calling mywebsite.com/crons/clean-products.php every night.
And if needed I can always call the script manually during the day.

 

Hope this helps.

 

Cheers

Tomasci

Tomasci

1 hour ago, dsolsona said:

Hi,

I've this problem at Prestashop 1.7.6.1. 

Is not fixed yet?

 

David

Hi David,

I guess not. I also still had the problem. I wrote a small script as a work around. Here it is:

<?php
$servername = "localhost";
$username = "***";
$password = "***";
$dbname = "***";

$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

$sql = "DELETE FROM ps_product WHERE id_category_default = 2 AND price = 0 AND redirect_type = ' ' AND state = 0";

if ($conn->query($sql) === TRUE) {
    echo "Products cleaned up successfully";
} else {
    echo "Error: " . $conn->error;
}

$conn->close();
?>

Just replace the *** with respective DB username, password and name and save the script via FTP.
Next you can call the script manually on it's location or via cronjob.

For example: I have the script in  rootfolder/crons/clean-products.php.
And I have a cronjob calling mywebsite.com/crons/clean-products.php every night.
And if needed I can always call the script manually during the day.

 

Hope this helps.

 

Cheers

×
×
  • Create New...