I installed the DemoSite version of Broadleaf. When I try to delete a product from the /admin section. I get the following error message.
org.hibernate.exception.ConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (broadleaf.blc_product, CONSTRAINT FK5B95B7C96D386535 FOREIGN KEY (DEFAULT_SKU_ID) REFERENCES blc_sku (SKU_ID))
I understand that there is a foreign key constraint on SKU table. Shouldn't it auto delete SKU's related whenever I delete a product.
Even if not how can I delete the SKU's first. I tried deleting the product options first. But that dint helped either.
Quite an old post and don't know how relevant it is to you now but might help others. Apart from this workaround Broadleaf supports soft delete as well instead of hard delete.
You can archive a product and it won't show anywhere in admin & site. I found it useful since at times you might require a product again later on in the future and you can just get it back from archive state if you have soft deleted it.
Broadleaf has a column "ARCHIVED" in table BLC_PRODUCT. You just need to add flag "Y" to it in order to archive a product and later on remove it to recover the product back.
Related
I want to update cached content of one custom table when another custom table item is updated.
Let's say I have two Custom Tables: Product and Order.
There are List and Edit pages for both Product and Order.
In DB there is a trigger on Product that updates some data on Order if Product is changed.
My scenario is, when I update lets say Product 1(one of the item of type Product), I want Orders (all orders) cache to refresh and reflect changes made in DB for Order. This is not happening right now.
Global settings are 10 minutes for content caching. But somehow it takes 20 minutes to reflect changes. Not sure why.
Also on Orders' CustomTableRepeater's System Settings->Cache minutes is set to 0 means it should not be caching content at all but it still does so I am at loss here
Answer to this scenario would be setting cache dependency dummy key as per Kentico documentation.
My questions are:
Do I set dependency key of all orders on Product's edit page's web part partial output cache dependency property?
for e.g. orders|all
Will this refresh all order records cached in for custom table data source when any product is modified?
Or I set dependency key of all Products on orders' repeater's System settings->Content Cache Dependency property?
for e.g. products|all
Please note Cache minutes property is set to 0 so ideally this content should not be cached.
Or add above key to Order's Edit page's webpart's partial output dependency?
Also for custom table how to get proper dummy key? Is it
products|all
OR
nodes|corportateside|products|all
OR
customtableitem.products|all
Or I need to add pages' dummy keys that I can see in debug->cache settings?
I have tried setting up all these things but nothing seem to work.
Any help is greatly appreciated.
Okay so it turned out to be a not cache issue.
I was able to resolve my issue. Putting answer here for future reference I will first list down what I tried:
Installed Hotfix
Add Partial Cache Dependency key
Add Cache dependency key for Content caching. Nothing worked.
Got an idea by reading answer from this questions: https://devnet.kentico.com/questions/kentico-8-2-database-caching
When I was updating CustomTable A's data, in DB trigger on A would update data in table B which I needed to refresh in Site's cache.
When I tried 'Clear Cache' from Debug application from Admin, it still did not update data in Site. Also my Custom Table data in Admin was also not getting updated.
So reading one answer from above question, I realized I need to refresh Hashtables for data to be refreshed in admin and subsequently in site.
So I added code to CustomTableForm.aspx.cs in OnAfterSave event handler. Here I am checking if current CustomTable is my table A, then refresh hashtables of B.
This worked.
I used some of the Hybris reserved Deployment code and then later changed to non-reserved deployment type codes. Do I need to Initialize the system in-order to reflect the changes with new deployment code or just an Update works. There are many items that deployment code has been changed. Why update doesn't work?
When you use a reserved code in your deployment table, you're likely to add the attributes of your object in an existing table. If you have attributes with the same name, it'll surely be a mess in the table (I don't know how hybris will choose the table type for example).
When you run an update with the good deployment code, it will create a new table which is just fine. The other table which has been used by two objects will still remain potentially broken because hybris won't delete any column.
That's why you should initialize your system to have a clean DB. The issue is that you'll lose all your data.
If you need to migrate data it will be probably quite hard because you must have to look on the broken table and distinguish between the attributes that should not be there and the others. So I hope for you that it's just a dev issue!
Actually i would suggest you to do initialize rather than update more likely that the update will not work for you in this case and probably you will get some error messages saying invalid pk xxxxxxxxxxxx because of unknown typecode yyyy.
As you may know the typeCode (deployment code) is an essential operator for the generation process of PKs in Hybris and thanks to it Hybris can ensure the uniquenessity of the PKs, so even if you change the old typeCode with a new one it's very likely that Hybris will still keep the old typeCode somewhere hence PKs already generated will never be consistent with the new typeCode.
So that's why you should never change the typecode of an item once given.
My suggestion is :
To make a backup of your existing data (you can export it from HMC,
you may take a look at alain.janinm's answer here).
Then initialize your System.
Then re-import the data again.
Note : that typecodes between 0 and 10000 are already reserved for hybris
particular items.
I'm having a problem with the product list configuration of hybris. I'm more than sure that the answer of this issue is pretty simple, but I can't solve it. So here is the problem.
I have one homepage with one link, assigned to the navigation bar. Whenever the link is pressed I want to get redirected to a product list page where a list of all products of certain category will be displayed. However, I managed to do this, but anytime I change the name of a certain product something happens and the page stops displaying. It throws an error saying it is looking for the old name of the product I've edited.
For example, if the product name is Product1, the page is displayed, then I go and change the name to Product2 and when I press on the link, it throws an error Product with code 'Product1' not found! If I want this to be fixed, I have to create a new Product1 and I'm more than sure that this is not the right way it should work. Is there any synchronization that I need to do after making changes in the catalog or something of this kind? Any help will be appreciated!
I recommend you try two things that may resolve your issue.
When you make a change to a product, you will more than likely do it to the staged catalog. This is your intermediary to ensure information is correct before going live (especially useful if you have a workflow process in place). In order to synchronise this information, you will need to login to the product cockpit (your-server:9000/productcockpit). Find the staged version of the catalog on the left hand menu, right click on it, and select "Sync Selected Versions". This will transfer your information into the Online catalog.
When you arrive on the product listings page and the search results page, the information contained is more than likely indexed by SOLR. In order for any changes to be reflected, you will need to re-index. To do this:
Go to the HMC and login (your-server:9000/hmc/hybris)
In the navigation menu to the left, click on System > Facet Search > Indexer Operation Wizard
A pop-up window will appear. Select the Indexer operation as update and the Solr configuration to the index associated with your website.
Click start and the re-indexing will begin. It shouldn't take too long
If this fails, then you may need a full re-index instead
I hope this will help; I recommend you set up a Cronjob to re-index periodically in future, to keep your website up to date with your product management.
PLP(Product Listing Page) fetches data from Solr. So whenever you are changing anything that is referred in the PLP, you need to update your indexes in Solr.
As you have changed the product name, update the Solr index from hmc.
What is the easiest way to change a field with a whole plethora of dependencies?
In the ‘Company’ section when you add a new call, there a field called ‘Summary’ I want to either amend or replace this with a field that has a drop down menu, but when I looked in to it, that field has some 28 dependencies so if I create a new field, how do I ensure I have got this bit right?
Many thanks
Nick
Not sure there is a quick way to do this - especially when you consider that changes would have to be replicated in any other environment you have deployed to, I would suggest:
Make a new field.
Mark the old field as redundant, e.g. add (REDUNDANT) in front of the name.
Work your way through moving dependencies from the old field to the new. When the old field has no dependencies you know your work is complete.
When you import to any other environment the old field will still exist but will be totally unused.
If the original field was populated perform a data migration to populate the new field.
I'm trying to figure out how ExpressionEngine deletes entries.
I've written an log-like extension that tracks when an entry is created. When I delete an entry through EE's edit section, the entry is also removed from the separate table I created for my extension.
How does EE know to delete the row from my table when the entry is removed? One of the columns in my table is `entry_id`. It would seem like EE automatically checks all tables for a entry_id column and if the value matches the value being deleted, the row is removed. Can anyone confirm this?
It would explain why I didn't have to make a function that hooks into delete_entries_loop to achieve this functionality.
That's very odd. That behavior would be insane if it was indeed the case!
Looking at the delete_entry() method of the Channel Entries API, the deletions are very specifically limited to:
channel_titles
channel_data
category_posts
relationships
comments
comment_subscriptions
channel_entries_autosave
entry_versioning
The Channel Fields API is also called, to let fieldtypes delete what they need to from their own database tables based on the entry being deleted, but only if they contain a delete() method.
I'd suggest turning on the output profiler, then running the deletion routine to see what queries are being run.