Announcement

Collapse
No announcement yet.

Complete reset of the s01_CategoryXProduct disp_order column

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Complete reset of the s01_CategoryXProduct disp_order column

    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:
    1. grab the sort order from Bill's dbf files
    2. 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.
    3. 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
    4. 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)





    Looking for work as of March 2024! I've been a web developer for going on 20 years, with most of that time spent on Miva sites.

    #2
    Mike,

    I've confirmed with one of our lead developers that this would be the optimal process of converting to the native Miva Merchant sorting feature. While it's hard to quantify, reducing a stores dependence on 3rd party modules is always best practice.

    -Sam

    Comment


      #3
      That seems spot on! The only thing I would do is see what your data will look like before pushing it into s01_CategoryXProduct, just to make sure everything looks correct (data/ display order wise). If you have a development/staging store, you may want to run this on there first... just in case. :)

      As long as the StoreKey is updated when you're finished, it should give you the results you are looking for.

      Comment

      Working...
      X