Jump to content

Edit History

ps8modules

ps8modules

Ecco uno script che può essere salvato nella cartella principale di Prestashop ed eseguito da un URL.

<?php
include_once('./config/config.inc.php');

$db = Db::getInstance();
$sql = 'SELECT a.id_product AS product_id_product FROM '._DB_PREFIX_.'product a WHERE a.id_product NOT IN (SELECT b.id_product FROM '._DB_PREFIX_.'image b)';
$products = Db::getInstance()->ExecuteS( $sql );

if ($products) {
    foreach($products as $product) {
        $db->update('product', array('active' => '0'), 'id_product = '.$product['product_id_product']);
        $db->update('product_shop', array('active' => '0'), 'id_product = '.$product['product_id_product']);
        echo 'disabled product: '.$product['product_id_product'].'<br>';
    }
} else {
    echo 'all products have some picture';
}

 

ps8modules

ps8modules

Ecco uno script che può essere salvato nella cartella principale di Prestashop ed eseguito da un URL.

<?php
include_once('./config/config.inc.php');

$db = Db::getInstance();
$sql = 'SELECT a.id_product AS product_id_product FROM '._DB_PREFIX_.'product a WHERE a.id_product NOT IN (SELECT b.id_product FROM '._DB_PREFIX_.'image b)';
$products = Db::getInstance()->ExecuteS( $sql );

if ($products) {
    foreach($products as $product) {
        $db->update('product', array('active' => '0'), 'id_product = '.$product['product_id_product']);
        $db->update('product_shop', array('active' => '0'), 'id_product = '.$product['product_id_product']);
        echo 'disabled product: '.$product['product_id_product'].'<br>';
    }
} else {
    echo 'all products have some picture';
}

deactive-product-without-images.zip

×
×
  • Create New...