I want to add a position for products by using category id in the table catalog_category_product, how to bulk update for my 20k products and any best practice for this suggest me thanks.
Solved! Go to Solution.
solved.
<?php
require_once 'app/Mage.php';
umask(0);
Mage::app();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if (($handle = fopen("inputs.csv", "r")) !== FALSE)
{
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
{
$sql='UPDATE catalog_product_entity_media_gallery_value SET label="'.$data[2].'" WHERE value_id = "'.$data[0].'"';
echo $sql.'<br/>';
mysqli_query($sql);
}
fclose($handle);
}
?>
solved.
<?php
require_once 'app/Mage.php';
umask(0);
Mage::app();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if (($handle = fopen("inputs.csv", "r")) !== FALSE)
{
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
{
$sql='UPDATE catalog_product_entity_media_gallery_value SET label="'.$data[2].'" WHERE value_id = "'.$data[0].'"';
echo $sql.'<br/>';
mysqli_query($sql);
}
fclose($handle);
}
?>