Skip to main content
Question

How to - Filter the categories on BigCommerce Store screen of Default Stock Categories field

  • September 19, 2023
  • 0 replies
  • 28 views

Hi Team,

We are working with BigCommerce connector (build: 23.105). In BigCommerce Stores screen under inventory setting tab, we have Default Stock Categories field (Dropdown field) it loads all item sales categories by default. I want to override this field to load only required categories. We tried with fieldSelecting event but values are not updating in the Default Stock Categories field. Can you please review below details and suggest the best possible way to do that.

 

Graph:

   public class KNBCROBCBigCommerceStoreMaintExt : PXGraphExtension<BCBigCommerceStoreMaint>
    {
        public static bool IsActive() { return true; }
        protected virtual void BCBindingExt_StockSalesCategoriesIDs_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e)

        {
            BCBindingExt row = e.Row as BCBindingExt;
            BCBinding bCBinding = PXSelect<BCBinding, Where<BCBinding.bindingID, Equal<Required<BCBinding.bindingID>>>>.Select(Base, row?.BindingID);
                List<string> allowedValues = new List<string>();
                List<string> allowedLabels = new List<string>();

                INCategory category = PXSelect<INCategory, Where<INCategory.description, Equal<Required<INCategory.description>>>>.Select(Base, bCBinding?.BindingName);
                foreach (INCategory categories in PXSelect<INCategory, Where<INCategory.parentID, Equal<Required<INCategory.parentID>>>>.Select(Base, category?.CategoryID))
                {
                    allowedValues.Add(categories.CategoryID.ToString());
                    allowedLabels.Add(categories.Description.Trim());
                }
                e.ReturnState = PXStringState.CreateInstance(e.ReturnState, 4000, true, typeof(BCBindingExt.stockSalesCategoriesIDs).Name, false, -1, string.Empty, allowedValues.ToArray(), allowedLabels.ToArray(), true, null);
                ((PXStringState)e.ReturnState).MultiSelect = true;
            
        }

    }

Thank you in Advance!
 

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings