Mass Action Products Access Level

  • Posts: 51
  • Thank you received: 0
  • Hikashop Business
1 week 1 day ago #370927

-- HikaShop version -- : 6.4.0
-- Joomla version -- : 4.4.14
-- PHP version -- : 8.2.30

Hi, i need to remove the access level "Public" privilege on all products while keeping privilege to all other profiles.
I'm turning around for quite a while now but can't find the way how so far.
Thanks in advance for your help

Please Log in or Create an account to join the conversation.

  • Posts: 85357
  • Thank you received: 13943
  • MODERATOR
1 week 10 hours ago #370935

Hi,

The `product_access` column stores access levels as a comma-separated list of Joomla user group IDs with commas on both sides, for example `,1,2,3,`. The special value `all` means accessible to everyone.

To remove the "Public" access level (group ID 1) from all your products while keeping the other access levels, you can create a mass action with:

- Filter: Table `product`, Column `product_access`, Operator `contain`, Value `,1,`
- Action: "Update values", Column `product_access`, Type `operation`, Value `REPLACE(product.product_access, ',1,', ',')`

This will turn for example `,1,2,3,` into `,2,3,` on each matching product, removing only the Public group while preserving the rest.

If some of your products have `product_access` set to `all` (which includes Public by definition), you will need a second mass action to handle those separately. In that case, set the filter to match products where `product_access` equals `all`, and the action to set `product_access` to a string value containing the specific groups you want to keep (e.g. `,2,3,`).

After running the mass action, you can verify the results by checking a few products in the backend. The Access Level field on the product edit form should no longer show "Public" in the list.
Note also that you have a "limitations" area in mass actions which limits the amount of elements processed at once. If you have more than 500 products / variants you can increase it a bit or run the mass action several times, changing the limitations each time to process the different batches of products one after the other.
I would recommend you make a backup of your database before you do this. Mass actions are powerful but a small mistake with mass actions can erase hours of work.

You can read more about mass actions here:
www.hikashop.com/support/documentation/167-massaction-form.html
I would recommend you do before using them.

Please Log in or Create an account to join the conversation.

Time to create page: 0.041 seconds
Powered by Kunena Forum