Monday, 14 January 2019

category corrupted

Category corruption solution

If we are not able to update category at BCC as child products corrupted, we have to follow the below steps.


Suppose any particular category is corrupted like cat1111 and unable to see the child products in BCC. we have  to verify whether this category is corrupted or not.


Step 1: We need to get approval from the Business team for this activity.  we need the approval for doing the deployment changes in BCC and Dyn admin changes to update in dyn admin.

Once we got approval from Business, we need to start creating the ticket  at  environment support team  tool (like SparkRed) to take a Schema dump. This is nothing but if we modify wrongly or something went wrong that time it will help us restore the old details in the production to avoid the data loss.

Step 2: The environment support team(Sparkred team) will follow the above step by step activity in step 3 is done. They will provide the export the data in CSV file format in the particular FTP location.

Now we have to get the BCC log and then process using some stand alone so that we can get the catId and version number.Again query the DB to return categoryId and version.

Then we have to compare the both standalone o/p and DB o/p.


The DB query is as follows.

select CATEGORY_ID,ASSET_VERSION from pub.dcs_category where category_id in ('cat1001','cat1002','cat3004','cat3004' ) and is_head='1';


Here, we need to check the DB record with the Standalone record whether the asset version value is more than stand-alone means no need to take action. those categories are working as expected but whenever DB value is less than or equal to DB value, we need to correct those categories. 


Example:

This category cat10001 contains asset version 90  for both (DB and standalone program) 
So, we need to correct this category.


Step 3: Meanwhile keep the Category(cat10001 ) child products without duplicate.if you found any duplicate child products in the category need to remove and keep original data with the latest asset version.


To fetch   Category with child products we can use the below Query:-


select * from pub.dcs_cat_chldprd where category_id = 'cat10001 ' and asset_version = '890

Now, we got the Child products for the particular category.


Step 4: Go to Merch instance Dyn admin and search the ProductCatalog-ver to follow the below steps:-

The below we provided the sample print items for reference.

It’s an important step and we need more analyze and update it step by step.

while printing this category(cat10001 ) in the Dyn admin with latest asset version:-

1.<add-item item-descriptor="category" id="cat10001:90">
               <set-property name="fixedChildProducts"><![CDATA[prod3456]]></set-property>
</add-item>
<print-item item-descriptor="category" id = "cat10001:90" />


2.<add-item item-descriptor="category" id="cat10001:90">
               <set-property name="fixedChildProducts">
                  <![CDATA[prod5677,prod878,prod3455

]]></set-property>
</add-item>
- updating existing definition of category:cat10001 :90



Currently, the asset version is 90 which was corrupted now we are getting the child products from this asset version 90 and validate if any duplicate data is available or not. if there is no duplicate we can keep the data.


<add-item item-descriptor="category" id="cat10001:90">
             <set-property name="fixedChildProducts"><![CDATA[]]></set-property>
</add-item>


Here, 90 is the latest asset version this will get once add this category in the BCC via Add to project this new asset version will create automatically.

And some time we are unable to add to project for the particular category means we have followed the below step.

We need to collect the category is_head 1 and do the below print items in the Dyn admin. here, we have 2 categories which have this issue.

<add-item item-descriptor="category" id="cat4567:56">
               <set-property name="fixedChildProducts"><![CDATA[]]></set-property>
</add-item>


<add-item item-descriptor="category" id="cat46777:67">
               <set-property name="fixedChildProducts"><![CDATA[]]></set-property>
</add-item>

Once we push these changes in dyn admin now, we add this category using add to project.now it will create the new asset version for this category.

Using the new asset version we can follow the below our Dyn admin changes. 

Once we completed the above step in the dyn admin we have to do our normal changes like the below 



<add-item item-descriptor="category" id="cat20046:314">
  <set-property name="fixedChildProducts"><![CDATA[prod345,prod567,prod567,..

]]></set-property></add-item>

once we add the item to the category we can deploy BCC.

Step 5: Now in this category we have loaded the child products. make sure we need to validate those products are coming in the BCC while previewing.


If not, delete this project and create the new project select the category(cat100002) and Add to the Project. and could see those child products available in the BCC preview .



If everything looks good we can deploy the BCC project. Once the deployment is completed successfully. Please validate for the particular category those child products are displaying properly(the above image).


Again environment maintain team (like Sparkred team) to rerun the below query and provide the Export data file in the CSC format. this nothing but we wants to confirm after doing this activity if any categories are corrupted or not.

If all looks good, we can inform to environment maintain team ( like  Sparkred team) this BCC cleanup activity has been completed successfully.

After the business needs to confirm if everything looks good. 


No comments:

Post a Comment