Just wanted to post this info about custom category fields:
In the category tree, we wanted to list the number of products in each category (product count). We used the Emporium Plus Toolkit cxp function to get the product counts. This made the site very slow due to the number of categories. Bill suggested we put the product count in a category custom field to make it faster.
Because we had so many categories to edit, I coded a custom page for the webmaster that lists the category codes, product counts (from cxp) and category names in this format:
Category_Code|Product_Count|Category_Name
The webmaster can periodically display this page (after they refresh the products in the store), copy the content of this page into a text editor, save it, and import it into Miva using the Category import utility. A couple of problems we encountered:
(1) Miva requires the category name to do the import. This should not be required - only the category code should be required. However it was not a big deal to add the category name since we had just pulled all the data from the live site.
(2) The Miva import utility changed our "0" (zero) product counts to null. It should have put the "0" in our custom field. We just coded around it. (It would have been nice to be able to check for null vs 0.)
Another advantage of this is that we can suppress from the category tree the categories that have no products.
The site works much faster now.
Here is the code for pulling the category custom field from Bill's Toolkit page:
In the category tree, we wanted to list the number of products in each category (product count). We used the Emporium Plus Toolkit cxp function to get the product counts. This made the site very slow due to the number of categories. Bill suggested we put the product count in a category custom field to make it faster.
Because we had so many categories to edit, I coded a custom page for the webmaster that lists the category codes, product counts (from cxp) and category names in this format:
Category_Code|Product_Count|Category_Name
The webmaster can periodically display this page (after they refresh the products in the store), copy the content of this page into a text editor, save it, and import it into Miva using the Category import utility. A couple of problems we encountered:
(1) Miva requires the category name to do the import. This should not be required - only the category code should be required. However it was not a big deal to add the category name since we had just pulled all the data from the live site.
(2) The Miva import utility changed our "0" (zero) product counts to null. It should have put the "0" in our custom field. We just coded around it. (It would have been nice to be able to check for null vs 0.)
Another advantage of this is that we can suppress from the category tree the categories that have no products.
The site works much faster now.
Here is the code for pulling the category custom field from Bill's Toolkit page:
Code:
<mvt:item name="toolkit" param="customcategory|cattotal|l.all_settings:category:id|productcount" /> &mvte:global:cattotal;
Comment