Jump to content

Admin, ocultar precio de compra a empleados [Resuelto]


Eutanasio

Recommended Posts

Para Prestashop 1.7.6, puedes probar asi. En

src/PrestaShopBundle/Controller/Admin/ProductController.php

Añadiendo en el return [ ]  de function formAction

'employeeAccess' => $this->getContext()->employee->isSuperAdmin() ? true : false,

Para hacerlo por perfiles de usuario, siendo SuperAdmin el ID 1, lo mismo pero asi:

'employeeAccess' =>  in_array($this->getContext()->employee->id_profile, array(1, 3, 4)) ? true : false,

1,3,4 serian los IDs de los perfiles de usuario permitidos

 

 

 

Luego en 

src/PrestaShopBundle/Resources/views/Admin/Product/ProductPage/Panels/pricing.html.twig

Se deja esta parte asi

{% if employeeAccess %}
          <div class="col-md-12">
            <div class="row mb-3">
              <div class="col-md-12">
                <h2>
                  {{ 'Cost price'|trans({}, 'Admin.Catalog.Feature') }}   
                  <span class="help-box" data-toggle="popover"
                    data-content="{{ "The cost price is the price you paid for the product. Do not include the tax. It should be lower than the retail price: the difference between the two will be your margin."|trans({}, 'Admin.Catalog.Help') }}" ></span>
                </h2>
              </div>
              <div class="col-xl-2 col-lg-3 form-group">
                <label class="form-control-label">{{ pricingForm.wholesale_price.vars.label|raw }}</label>
                {{ form_errors(pricingForm.wholesale_price) }}
                {{ form_widget(pricingForm.wholesale_price) }}
              </div>
            </div>
          </div>
 {% endif %}

Borrar cache desde Parámetros avanzados > Rendimiento  -- Borrar cache

Y el resultado debería de ser el que aparece en la imagen

spacer.png

 

  • Like 2
Link to comment
Share on other sites

  • Eutanasio changed the title to Admin, ocultar precio de compra a empleados [Resuelto]

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...