Hi out there,
is it possible to switch all products to one category with one SQL-Query? In this case I want all products in the category "root".
Hope someone could help...
Regards,
Zappodrom
[SMS] SQL-Query to get all products in one category?
[SMS] SQL-Query to get all products in one category?
Regards,
Christian
----
[X] <--- Nail here for new Monitor!
Christian
----
[X] <--- Nail here for new Monitor!
Re: [SMS] SQL-Query to get all products in one category?
In case of failure do SQL backup first.
Create UDT
Edit: fixed typo in UDT.
Create UDT
Execute UDT and all products should be assigned to root category.$cat_id = 0; // root category id
$return = 'All products assigned to root category';
$gCms = cmsms(); //global $gCms;
$db=&$gCms->GetDB();
$query = 'UPDATE '.cms_db_prefix().'module_sms_product_category SET `category_id` = ?';
if($db->Execute($query, array($cat_id))){
echo $return;
}
else{
echo 'Error in : '.($db->sql);
}
Edit: fixed typo in UDT.
Last edited by Peciura on Sat Sep 25, 2010 11:24 am, edited 1 time in total.
Re: [SMS] SQL-Query to get all products in one category?
Thank you, that's really cool! 
Just corrected the typo
Great....

Just corrected the typo
toPeciura wrote: $return = 'All products assigned to root category
and everything went fine!$return = 'All products assigned to root category';
Great....
Regards,
Christian
----
[X] <--- Nail here for new Monitor!
Christian
----
[X] <--- Nail here for new Monitor!