Display Restrictions on Products

Write restriction notices and link each notice to the product codes that must show it.

Script Overview

This screen keeps the product restriction notices used on the store. Each notice is saved with its wording, then linked to one or more product codes. The list is short and curated, so every notice appears on this page. Saving, editing, deleting, and product-link changes are written through parameterized database helpers.

Operator Workflow
Step 1
Write the Notice
  • Type the restriction wording in the editor at the top of the page.
  • Use Add Restriction for a new notice.
Step 2
Edit an Existing Notice
  • Choose Edit on the notice you want to change.
  • The wording loads into the editor. Choose Update Restriction to save it.
Step 3
Link a Product Code
  • Enter the catalog product code beside that notice.
  • Choose Add. The code must already exist on a product.
Step 4
Remove a Product Link
  • Check the product codes that should no longer use the notice.
  • Choose Delete Link on that same notice.
Step 5
Delete a Notice
  • Choose Delete on the notice row.
  • Confirm the prompt. The notice is removed from the list.
Technical Reference & Safeguards
  • Data Read: pd_restrictions ordered by description, pd_restrictions_product for linked models, and oc_product.model when a product code is added.
  • Database Writes: pd_restrictions.description and pd_restrictions.sort_order on save. pd_restrictions_product receives the restriction id, product id, and model. Deletes remove the notice row or the selected product link.
  • Safeguards & Notifications: Writes go through InsertRecord(), UpdateTable(), and DeleteTable() inside a transaction. A new notice is created only when the save control posts 0. Product links are matched by restriction id and product id so a repeat add updates the same link. Delete asks for confirmation. Failures are written with error_log() and shown in the page alert. Navigation stays on. The full list stays on one page.
Notice Linked products Actions
No restriction notices are on file.