Goal:
I want to hide the panel pane containing a view (containing a product display) when the user has purchased the product.
Set-up:
I have a commerce product entity (not display) which is flagged using Rules on behalf of the user who purchases the product. I've created a view to verify the rule and it works, linking the Prod ID to the User ID correctly.
I then have a view:
View type: 'Content Pane'
Filtered on: 'Content type: Product Display'
With a field 'Content: Product Reference' with 'Add to Cart line item type : Commerce node checkout'
The view is displayed in a panel pane and appears as a standard 'add to cart' button. This is also ok and users are able to purchase the product, (which then provides a link to some premium content).
The problem:
In panels, I have a visibility rule on the pane containing the 'add to cart' button. The visibility rule looks for the flag attached to the product and shows it only if the flag is NOT there.
However, the product is always visible.
I've also tried the same procedure, but flagging the 'product display' instead, but with the same result.
I think it's probably that I'm not using the right context or relationship, either in views, panels or both. I've tried a few, but am now at the stumbling in the dark stage. I'm pretty stumped as I thought panels visibility rules would only offer options that were available/in scope. Any help/guidance much appreciated!
EDIT after comment #1 below:
I've added some screen grabs of the panels settings and output.
1 Panels content screen. Top-right panel shows two ways I tried to put the "add to cart" button in. The views method works, the direct panels method does not.
2 Relationships in Panels. I thought this would make the correct entities available to visibility rules, etc. but apparently not.
3 Panels output. The main content (overriden node type) is at the bottom. The "add to cart" button is on the right, and should only appear before purchase, but is always there. The contact details (left) should, and does, only appear after purchase.
4 Very brief diagram of entity relationships.
Further to the orginal description, the following might be useful:
- Content access module with per-node access control is used to control access to "Contact details" content.
- There is an option in visibility rules that can base visibility on access of current user to a particular bit of content, which I have tried, and seemed to target the correct content, but didn't work (so obviously wasn't).
- This suggests to me that it's a matter of getting the correct vars in scope using panel contexts.