Jump to content
  • 0

Jaki plik / controller odpowiada za Zamówienia -> Zamówienia -> Szczegóły zamówienia po kliknięciu w 1.7.7.3


KamikStudio

Question

Jaki plik / controller odpowiada za Zamówienia -> Zamówienia -> Szczegóły zamówienia po kliknięciu w 1.7.7.3

wcześniej jeszcze w 1.7.7 było w controllers teraz za cholere nie mogę znaleźć. Potrzebuje dodać jeszcze jedną kolumne "cena za jednostkę netto" obecnie pokazuje się tylko brutto.

 

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

Nie jestem pewny, ale chyba dotarłem do źródła

W 1.7.7.3 -> src > PrestaShopBundle > Resources > views > Admin > Sell > Order > Order > Blocks > View > product.html.twig

  <td class="cellProductUnitPrice">{{ product.unitPrice }}</td>
  <td class="cellProductQuantity text-center">
    {% if product.quantity > 1 %}
      <span class="badge badge-secondary rounded-circle">{{ product.quantity }}</span>
    {% else %}
      {{ product.quantity }}
    {% endif %}

Pytanie teraz jaka zmienna {product.unitPrice} nie za wiele mi mówi. Gdzie tax incl i tax exc?

Link to comment
Share on other sites

  • 0
48 minutes ago, atomek said:

Prawdopodobnie będzie to {{ product.unitPriceTaxExclRaw }}

Dodaj w szablonie {{ dump(product) }}


będziesz miał podgląd na wszystkie elementy zmiennej product

 

Niestety nic nie podziałało, żadnego efektu

  <td class="cellProductUnitPrice">{{ product.unitPriceTaxExclRaw }}</td>
  <td class="cellProductUnitPrice">{{ product.unitPrice }}</td>
  <td class="cellProductQuantity text-center">
    {% if product.quantity > 1 %}
      <span class="badge badge-secondary rounded-circle">{{ product.quantity }}</span>
    {% else %}
      {{ product.quantity }}
    {% endif %}

Ten dump w tym samym pliku?

Link to comment
Share on other sites

  • 0

Zamieniłem stronami i zadziałało

preFinalnie kod

  <td class="cellProductUnitPrice">{{ product.unitPrice }}</td>
  <td class="cellProductUnitPrice">{{ product.unitPriceTaxExclRaw }}</td>
  <td class="cellProductQuantity text-center">
    {% if product.quantity > 1 %}
      <span class="badge badge-secondary rounded-circle">{{ product.quantity }}</span>
    {% else %}
      {{ product.quantity }}
    {% endif %}

Tylko że teraz mam zdefiniowanych za tużo td i jest lekko rozsypana tabela

 

Zrzut ekranu 2021-04-22 o 22.16.28.png

Link to comment
Share on other sites

  • 0
3 minutes ago, atomek said:

Musisz poszukać szablonu gdzie jest zdefiniowany nagłówek tej tabelki, i tam dodać kolumnę.

Najprawdopodobniej to będzie \src\PrestaShopBundle\Resources\views\Admin\Sell\Order\Order\Blocks\View\products.html.twig

To już wiem :) I właśnie chce dodać kolumne, bo też wiem że o to chodzi. Tylko nie wiem gdzie ją znaleźc, bo plik zawiera x2 <tr> i reszte <td> gdzie <tr> powinno definiować kolumny a <tr> wiersze

Cały kod

{% set rowIsDisplayed =  (productIndex is defined and paginationNum is defined and productIndex > paginationNum) %}
<tr id="orderProduct_{{ product.orderDetailId }}" class="cellProduct{% if rowIsDisplayed %} d-none d-print-table-row{% endif %}">
  <td class="cellProductImg">
    {% if product.imagePath %}
      <img src="{{ product.imagePath }}" alt="{{ product.name }}" />
    {% endif %}
  </td>
  <td class="cellProductName">
    <a href="{{ path('admin_product_form', {'id': product.id}) }}">
      <p class="mb-0 productName">{{ product.name }}</p>
      {% if product.reference %}
        <p class="mb-0 productReference">
          {{ 'Reference number:'|trans({}, 'Admin.Orderscustomers.Feature') }}
          {{ product.reference }}
        </p>
      {% endif %}
      {% if product.supplierReference is not empty %}
        <p class="mb-0 productSupplierReference">
          {{ 'Supplier reference:'|trans({}, 'Admin.Orderscustomers.Feature') }}
          {{ product.supplierReference }}
        </p>
      {% endif %}
    </a>
    {% if product.type == constant('PrestaShop\\PrestaShop\\Core\\Domain\\Order\\QueryResult\\OrderProductForViewing::TYPE_PACK') and product.customizations is null %}
      <span class="btn-product-pack-modal d-print-none" data-toggle="modal" data-target="#product-pack-modal" data-pack-items="{{ product.packItems|json_encode }}">
        <strong>{{ 'View pack content'|trans({}, 'Admin.Actions') }}</strong>
      </span>
    {% endif %}
  </td>
  <td class="cellProductUnitPrice">{{ product.unitPrice }}</td>
  <td class="cellProductUnitPrice">{{ product.unitPriceTaxExclRaw }}</td>
  <td class="cellProductQuantity text-center">
    {% if product.quantity > 1 %}
      <span class="badge badge-secondary rounded-circle">{{ product.quantity }}</span>
    {% else %}
      {{ product.quantity }}
    {% endif %}

    <div class="d-none js-product-quantity">
      <input type="text" value="{{ product.quantity }}" class="form-control">
    </div>
  </td>
  <td class="cellProductLocation{% if not isColumnLocationDisplayed %} d-none{% endif %}">{{ product.location }}</td>
  <td class="cellProductRefunded{% if not isColumnRefundedDisplayed %} d-none{% endif %}">
    {% if product.quantityRefunded > 0 %}
      {{ product.quantityRefunded }} ({{ product.amountRefunded }} {{ 'Refunded'|trans({}, 'Admin.Orderscustomers.Feature') }})
    {% endif %}
  </td>
  <td class="cellProductAvailableQuantity text-center{% if not isAvailableQuantityDisplayed %} d-none{% endif %}">{{ product.availableQuantity }}</td>
  <td class="cellProductTotalPrice">{{ product.totalPrice }}</td>
  {% if orderForViewing.hasInvoice() %}
    <td>{{ product.orderInvoiceNumber }}</td>
  {% endif %}
  {% if not orderForViewing.delivered %}
    <td class="text-right cellProductActions">
      <button
        type="button"
        class="btn tooltip-link js-order-product-edit-btn"
        data-toggle="pstooltip"
        data-placement="top"
        data-original-title="{{ 'Edit'|trans({}, 'Admin.Actions') }}"
        data-order-detail-id="{{ product.orderDetailId }}"
        data-product-id="{{ product.id }}"
        data-combination-id="{{ product.combinationId }}"
        data-product-quantity="{{ product.quantity }}"
        data-product-price-tax-incl="{{ product.unitPriceTaxInclRaw }}"
        data-product-price-tax-excl="{{ product.unitPriceTaxExclRaw }}"
        data-tax-rate="{{ product.taxRate }}"
        data-location="{{ product.location }}"
        data-available-quantity="{{ product.availableQuantity }}"
        data-available-out-of-stock="{{ product.availableOutOfStock }}"
        data-order-invoice-id="{{ product.orderInvoiceId }}">
        <i class="material-icons">edit</i>
      </button>
      <button
        type="button"
        class="btn tooltip-link js-order-product-delete-btn"
        data-toggle="pstooltip"
        data-placement="top"
        data-order-id="{{ orderForViewing.id }}"
        data-order-detail-id="{{ product.orderDetailId }}"
        data-delete-message="{{ 'Are you sure?'|trans({}, 'Admin.Notifications.Warning') }}"
        data-original-title="{{ 'Delete'|trans({}, 'Admin.Actions') }}">
        <i class="material-icons">delete</i>
      </button>
    </td>
  {% endif %}
  <td class="text-right cancel-product-element">
    <div class="cancel-product-cell cancel-product-element{% if product.refundable == false %} hidden{% endif %}">
      <div class="cancel-product-cell-elements">
        <div class="cancel-product-selector form-group">
          {{ form_widget(cancelProductForm['selected_' ~ product.orderDetailId]) }}
        </div>
        <div class="cancel-product-quantity form-group">
          {{ form_label(cancelProductForm['quantity_' ~ product.orderDetailId]) }}
          <div class="input-group">
            {% set quantityInputOptions = {
              'attr': {
                'data-product-price-tax-incl': product.unitPriceTaxInclRaw,
                'data-product-price-tax-excl': product.unitPriceTaxExclRaw,
                'data-amount-refundable': product.amountRefundableRaw,
                'data-quantity-refundable': product.quantityRefundable,
              }
            } %}
            {{ form_widget(cancelProductForm['quantity_' ~ product.orderDetailId], quantityInputOptions) }}
            <div class="input-group-append"><div class="input-group-text">/ {{ product.quantityRefundable }}</div></div>
          </div>
        </div>
        <div class="cancel-product-amount form-group">
          {{ form_label(cancelProductForm['amount_' ~ product.orderDetailId]) }}
          <div class="input-group">
            {{ form_widget(cancelProductForm['amount_' ~ product.orderDetailId]) }}
            <div class="input-group-append"><div class="input-group-text">{{ orderCurrency.symbol }}</div></div>
            <small class="max-refund text-left">
              {{ '(Max %amount_refundable% %tax_method%)'|trans({
                '%amount_refundable%': product.amountRefundable,
                '%tax_method%': orderForViewing.taxMethod
              }, 'Admin.Orderscustomers.Help')|raw }}
            </small>
          </div>
        </div>
      </div>
    </div>
  </td>
</tr>
{% if product.customizations is not null %}
  <tr class="order-product-customization{% if rowIsDisplayed %} d-none{% endif %}">
    <td class="border-top-0"></td>
    {% set colspan = 8 %}
    {% set colspan = (orderForViewing.hasInvoice() ? colspan + 1 : colspan) %}
    {% set colspan = (not orderForViewing.delivered ? colspan + 1 : colspan) %}
    <td colspan="{{ colspan }}" class="border-top-0 text-muted">
      {% if product.customizations.fileCustomizations %}
        <div class="d-flex flex-row flex-wrap">
          {% for customization in product.customizations.fileCustomizations %}
              <div class="mr-4">
                <p><strong>{{ customization.name }}</strong></p>
                <p>
                  <a href="{{ path('admin_orders_display_customization_image', {'orderId': orderForViewing.id, 'name': customization.name|url_encode|replace({'%': '_'}), "value": customization.value})}}" download>
                    <img src="{{ customization.image }}" alt="{{ customization.name }}">
                  </a>
                </p>
              </div>
          {% endfor %}
        </div>
      {% endif %}
      {% for customization in product.customizations.textCustomizations %}
        <p><strong>{{ customization.name }} :</strong> {{ customization.value }}</p>
      {% endfor %}
      {% if product.type == constant('PrestaShop\\PrestaShop\\Core\\Domain\\Order\\QueryResult\\OrderProductForViewing::TYPE_PACK') %}
        <div class="btn-product-pack-modal mb-3 d-print-none" data-toggle="modal" data-target="#product-pack-modal" data-pack-items="{{ product.packItems|json_encode }}">
          <strong>{{ 'View pack content'|trans({}, 'Admin.Actions') }}</strong>
        </div>
      {% endif %}
    </td>
  </tr>
{% endif %}

 

Link to comment
Share on other sites

  • 0
1 minute ago, atomek said:

Nie w tym pliku szukasz, w tym samym folderze jest jeszcze plik products.html.twig. Jest tam zdefiniowany nagłówek tabeli z id="orderProductsTable"

jeszcze spojrzę, jednak wziąłem się za to inaczej, też wygląda dobrze i jest w porządku

Liniki jednak zmieniłem na

<td class="cellProductUnitPrice">{{ product.unitPrice }} <br><small>{{ product.unitPriceTaxExclRaw }} zł (bez VAT)</small></td>
  <td class="cellProductQuantity text-center">

(chociaż zmienie po prostu napis na 'netto 'efekt:

 

Zrzut ekranu 2021-04-22 o 22.57.58.png

Link to comment
Share on other sites

  • 0

Dobra mam to! Dzięki @atomek

Finalnie wyglada to tak:

\src\PrestaShopBundle\Resources\views\Admin\Sell\Order\Order\Blocks\View\products.html.twig

po

        <th>
          <p class="mb-0">{{ 'Price per unit'|trans({}, 'Admin.Advparameters.Feature') }}</p>
          <small class="text-muted">{{ orderForViewing.taxMethod }}</small>
        </th>

dodaj

        <th>
          <p class="mb-0">{{ 'Price per unit'|trans({}, 'Admin.Advparameters.Feature') }}</p>
          <small>netto</small>
        </th>

ja zdefiniowałem swoją nazwę ręcznie na "netto"

Zrzut ekranu 2021-04-22 o 23.02.48.png

oraz w pliku \src\PrestaShopBundle\Resources\views\Admin\Sell\Order\Order\Blocks\View\product.html.twig

po

<td class="cellProductUnitPrice">{{ product.unitPrice }}</td>

dodaj

<td class="cellProductUnitPrice">{{ product.unitPriceTaxExclRaw }} </td>

 

Zrzut ekranu 2021-04-22 o 23.03.26.png

efekt:

Zrzut ekranu 2021-04-22 o 23.04.09.png

Edited by KamikStudio (see edit history)
Link to comment
Share on other sites

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...