Link to home
Start Free TrialLog in
Avatar of thebest8
thebest8

asked on

How to disable checkbox for a restricted category to be selected by customers

Hello Experts,

Here is my situation, I have a list of categories, my users can list their products but I have 3 categories I want them to be untouched or disabled for them to select. "Hot deals" "Ending Soon" "New deals" I want these to be exclusive to the admin from the backend, I'm using Prestashop 1.7.1.1, I need technical help with coding solving.

The page is using jstree, is there anyway I can hardcode the value to disable the checkbox on those categories?

check screenshot


thank you
capture-1.JPG
Avatar of HainKurt
HainKurt
Flag of Canada image

add disabled to the check box based on admin or not...

<input type=checkbox disabled>

Open in new window

Avatar of thebest8
thebest8

ASKER

Thank you,

What about to remove those first 3 categories then remove the spacing between Home and Electronics categories
I meant to hide those first 3 cat and remove the spacing
use jQuery

https://jsfiddle.net/cgdus3q8/

html
<ul id=categories>
  <li>
    <input type=checkbox> Cat 1
    <ul>

      <li>
        <input type=checkbox> Ending soon</li>
      <li>
        <input type=checkbox> New Deal</li>
      <li>
        <input type=checkbox> Hot Deal</li>
      <li>
        <input type=checkbox> Electronics</li>
      <ul>
        <li>
          <input type=checkbox> Phones</li>
        <li>
          <input type=checkbox> Audio</li>
        <li>
          <input type=checkbox> Visual</li>
      </ul>
    </ul>

  </li>
  <li>
    <input type=checkbox> Cat 2
    <ul>

      <li>
        <input type=checkbox> Blue</li>
      <li>
        <input type=checkbox> Red</li>
      <li>
        <input type=checkbox> Black</li>
    </ul>
  </li>
</ul>

<button id=btnDemo>demo</button>

Open in new window


js
$("#btnDemo").on("click", function() {
  $("#categories li:eq(0) ul li:lt(3)").hide();
})

Open in new window

Hello dear HainKurt,
I apologize for this delay to respond, I would like to share a js file and if you can tell me how to edit it, it would be great
jstree.js
wk_jstree.js
another screenshot to help you understand better
Capture.JPG
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.