fettah666 Posted April 10, 2009 Posted April 10, 2009 My friend was filing the catalogue while I was away and simply forgot to add weight to the products so my question is very simple: can you add weight to a whole category? We have several categories but I have no idea how to correct his mistake. Sorta related but less important, how do you add a date to a whole category? He forgot that too! Yeah, I know, gotta change my friends...
natashome Posted April 11, 2009 Posted April 11, 2009 i would edit each product and add the weight to them
♥geoffreywalton Posted April 11, 2009 Posted April 11, 2009 you could You could write some sql to set all the wts in a category to the same wt or install a contribution called EasyPopulate and use that Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile Virus Threat Scanner My Contributions Basic install answers. Click here for Contributions / Add Ons. UK your site. Site Move. Basic design info. For links mentioned in old answers that are no longer here follow this link Useful Threads. If this post was useful, click the Like This button over there ======>>>>>.
fettah666 Posted April 11, 2009 Author Posted April 11, 2009 Unfortunately, we didn't have any files to use along easy populate so that's outta question and well, let's say my sql knowledge is close to zero (actually, it's IS nil) so I have no way to write such thing.
♥geoffreywalton Posted April 11, 2009 Posted April 11, 2009 Install EP download a file which will contain all your current products. Edit the file and add the wts. Import the file or go to www.w3schools.com You will need something along the linews of... update product set product_wt = 1.0 where product_caegory_id = 17 Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile Virus Threat Scanner My Contributions Basic install answers. Click here for Contributions / Add Ons. UK your site. Site Move. Basic design info. For links mentioned in old answers that are no longer here follow this link Useful Threads. If this post was useful, click the Like This button over there ======>>>>>.
♥FWR Media Posted April 11, 2009 Posted April 11, 2009 Try the following: Edit the $category, $weight, $date as required .. then .. Save it as a file in shop root (cat_update.php or something) then browse to the file, it will show a list of queries that it WOULD run. If you are happy with those queries then edit the file and set $testrun = false; run it again and the queries will be actioned. <?php require_once 'includes/application_top.php'; // User settings $testrun = true; $category = 10; $weight = 1.0; $date = '2009-04-11 00:00:00'; // date("d-m-Y h:i:s") // End user settings $sql = " SELECT products_id FROM " . TABLE_PRODUCTS_TO_CATEGORIES . " WHERE categories_id = $category"; $result = tep_db_query($sql); while ( $row = tep_db_fetch_array($result) ){ if ( false !== $testrun ){ echo "UPDATE " . TABLE_PRODUCTS . " SET products_weight = '" . (float)$weight . "', products_date_available = '" . $date . "' WHERE products_id = " . $row['products_id'] . "" . '<br>'; } else { $sql = "UPDATE " . TABLE_PRODUCTS . " SET products_weight = '" . (float)$weight . "', products_date_available = '" . $date . "' WHERE products_id = " . (int)$row['products_id'] . ""; tep_db_query($sql); } } tep_db_free_result($result); ?> Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.