Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wp126/0e726b4a6315275db71a5adb61ba063e to your computer and use it in GitHub Desktop.
Save wp126/0e726b4a6315275db71a5adb61ba063e to your computer and use it in GitHub Desktop.
<?php
if (!defined('_PS_ADMIN_DIR_')) {
define('_PS_ADMIN_DIR_', __DIR__);
}
include _PS_ADMIN_DIR_.'/../config/config.inc.php';
$id_lang=2;
$start=3001;
$limit=4000;
$order_by='id_product';
$order_way='DESC';
$id_category = false;
$only_active =true;
$context = null;
$all_products=Product::getProducts($id_lang, $start, $limit, $order_by, $order_way, $id_category,$only_active , $context );
foreach ($all_products as $keyall_products => $valueall_products) {
echo $valueall_products['id_product'];
$product = new Product($valueall_products['id_product'], false, $id_lang);
//if($valueall_products['id_product']==32611){
/*echo "<pre>";
print_r($product->name);
echo "</pre>";*/
$product->description=$product->name;
$product->meta_description=$product->name;
$product->save();
$productImages = $product->getImages((int) $id_lang);
//$image = Image::getCover($valueall_products['id_product']);
//print_r($productImages);
if(!empty($productImages)){
foreach($productImages as $val_productImages){
$sql = 'UPDATE '._DB_PREFIX_.'image_lang SET legend="'.pSQL($product->name).'" WHERE id_image='.$val_productImages['id_image'];
if (!Db::getInstance()->execute($sql))
die('error!');
}
}
//}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment