Jump to content

Edit History

Matt E

Matt E

I'm surprised this is still an issue, but the new Admin Order page does not calculate/display discounted products correctly (or at all). To fix this in 1.7.6.X, I created a general override to the back office order detail page by adding the following lines in (controllers\admin\templates\orders\helpers\view.tpl):

{* CUSTOM column added to show discount *}
{assign var="isDiscount" value="False"}
{foreach from=$products item=product key=k}
  {if $product.reduction_percent > 0}
   {$isDiscount = "True"}
  {/if}
{/foreach}                  
<th class="text-center">
  {if $isDiscount == "True"}
  <span class="title_box ">{l s='Discount' d='product.discount'} %</span>
  {/if}
</th>

I also made the following edits to (controllers\admin\templates\orders\_product_line.tpl) and (controllers\admin\templates\orders\_customized_data.tpl):

Changed from:

<span class="product_price_show">{displayPrice price=$product_price currency=$currency->id}</span>

To:

<span class="product_price_show">{displayPrice price=$orig_price currency=$currency->id}</span>

Added:

  {* CUSTOM column added to show discount *}
  <td class="productQuantity text-center reduction">
    {if $product.reduction_percent > 0}
      {$product.reduction_percent} %
    {/if}
  </td>

This had the overall intended effect of showing the original price before reductions, and then showing the discount only for line items with a specific price reduction.

I recently updated to 1.7.7.1 and noticed the entire back office order detail page has been reworked from Admin template files (.tpl) to Symfony (.twig), so all of those overrides are now obsolete.  It seems this information is now contained within (src\PrestaShopBundle\Resources\views\Admin\Sell\Order\Order\Blocks\View) in the file product.html.twig.

What is the best way to override this file to recreate the same result as the previous overrides (which were working as intended) without directly modifying the core files?

Matt E

Matt E

How to migrate an override from the old Admin Order template (tpl) to the new Symfony (twig) system?

I'm surprised this is still an issue, but the new Admin Order page does not calculate/display discounted products correctly (or at all). To fix this in 1.7.6.X, I created a general override to the back office order detail page by adding the following lines in (controllers\admin\templates\orders\helpers\view.tpl):

{* CUSTOM column added to show discount *}
{assign var="isDiscount" value="False"}
{foreach from=$products item=product key=k}
  {if $product.reduction_percent > 0}
   {$isDiscount = "True"}
  {/if}
{/foreach}                  
<th class="text-center">
  {if $isDiscount == "True"}
  <span class="title_box ">{l s='Discount' d='product.discount'} %</span>
  {/if}
</th>

I also made the following edits to (controllers\admin\templates\orders\_product_line.tpl) and (controllers\admin\templates\orders\_customized_data.tpl):

Changed from:

<span class="product_price_show">{displayPrice price=$product_price currency=$currency->id}</span>

To:

<span class="product_price_show">{displayPrice price=$orig_price currency=$currency->id}</span>

Added:

  {* CUSTOM column added to show discount *}
  <td class="productQuantity text-center reduction">
    {if $product.reduction_percent > 0}
      {$product.reduction_percent} %
    {/if}
  </td>

This had the overall intended effect of showing the original price before reductions, and then showing the discount only for line items with a specific price reduction.

I recently updated to 1.7.7.1 and noticed the entire back office order detail page has been reworked from Admin template files (.tpl) to Symfony (.twig), so all of those overrides are now obsolete.  It seems this information is now contained within (src\PrestaShopBundle\Resources\views\Admin\Sell\Order\Order\Blocks\View) in the file product.html.twig.

What is the best way to override this file to recreate the same result as the previous overrides (which were working as intended) without directly modifying the core files?

×
×
  • Create New...