Our sites have been using Bill Weiland's "Sort Categories and Products" module for years. We've had no real problems with the module, so never changed it, but I'd like to switch to Miva's built-in method of editing a category's product display order instead. I'm planning to write a PHP script that will update the s01_CategoryXProduct table for me (I know, this is the MivaScript forum, but I'm not nearly as fluent in MivaScript as I am in PHP).
Can anyone give me an idea of what the "gotcha's" might be for a script like this? My plan is along these lines:
Once that's done, I'd uninstall the "Sort Categories and Products" module, which should allow Miva's sorting to take over (which at this point should match what we had in the module, and therefore the site should look exactly the same as it did before).
Thanks in advance for any input and suggestions. I'm also a bit curious as to whether this will have a positive impact on category page load time (just one less module to process)
Can anyone give me an idea of what the "gotcha's" might be for a script like this? My plan is along these lines:
- grab the sort order from Bill's dbf files
- temporarily set s01_CategoryXProduct.disp_order to 0
- this step isn't really necessary but I'd like to make sure everything is refreshed. When the bulk of the script is done, maybe I'll come back and find any that are still 0 (for whatever strange reason) and update them, this way I will know that every single product was adjusted.
- loop through the categories, starting with cat_id 1, and assign disp_order for each contained product, starting with 1 and incrementing by 1 after each update
- when I'm done, my final disp_order shouldn't be too much different than s01_StoreKeys.maxvalue for CategoryXProductDisplayOrder, but regardless, I will update that maxvalue to whatever the final disp_order value is
Once that's done, I'd uninstall the "Sort Categories and Products" module, which should allow Miva's sorting to take over (which at this point should match what we had in the module, and therefore the site should look exactly the same as it did before).
Thanks in advance for any input and suggestions. I'm also a bit curious as to whether this will have a positive impact on category page load time (just one less module to process)
Comment