Jump to content
thirty bees forum
  • 0

Question

Posted (edited)
Hello Thirty Bees community !
I had to come up with a little hack to respond to a problem I found little to no answers on google. So here is a post for people looking for that, and maybe even an idea to integrate in Thirty Bees core (I'll let you decide about that 😉).
 
 
What was the need ?
Some people on my company have to deal with orders but don't have the right to go in the product pages. And since the reduction amount is only displayed there by default in both Prestashop and Thirtybees, I've had to display that information on orders related documents. Hence my decision to display it on both the order mail and the order page.
 
 
Setup the mail
 
The setup for the mail needs two steps. First adding the reduction amount in the email :
public_html/modules/mailalerts/mailalerts.php 
<td style="padding:0.6em 0.4em; text-align:right;">'.Tools::displayPrice($unitPrice, $currency, false).'</td> <!--The line you are looking for-->

<td style="padding:0.6em 0.4em; text-align:center;">'.(int)$product['reduction_percent'].'%</td> <!--The line you add just below-->


Second you need to add the TH so your table mail don't look broken. You need to edit the new_order.html template :
public_html/modules/mailalerts/mails/LANGUAGE/new_order.html
public_html/themes/YOURTHEME/modules/mailalerts/mails/LANGUAGE/new_order.html

<thead>
    <tr>
        <th style="border:1px solid #DDD!important;background-color:#fbfbfb;font-family:Arial;color:#333;font-size:13px;padding:10px">Reference</th>
        <th style="border:1px solid #DDD!important;background-color:#fbfbfb;font-family:Arial;color:#333;font-size:13px;padding:10px">Product</th>
        <th style="border:1px solid #DDD!important;background-color:#fbfbfb;font-family:Arial;color:#333;font-size:13px;padding:10px">Unit price</th>
        <th style="border:1px solid #DDD!important;background-color:#fbfbfb;font-family:Arial;color:#333;font-size:13px;padding:10px">Reduction</th><!--The line you add-->
        <th style="border:1px solid #DDD!important;background-color:#fbfbfb;font-family:Arial;color:#333;font-size:13px;padding:10px">Quantity</th>
        <th style="border:1px solid #DDD!important;background-color:#fbfbfb;font-family:Arial;color:#333;font-size:13px;padding:10px">Total price</th>
    </tr>
</thead>

 

 
Setup for the order page
 
Same thing that the mail you need to first add the reduction amount and then edit the head of the table so it don't look broken :
 
public_html/YOURADMINFOLDER/themes/default/template/controllers/orders/_product_line.tpl
<!--The line you are looking for-->
<td>
	<span class="product_price_show">{displayPrice price=$product_price currency=$currency->id}</span>
  ...
</td>

<!-- Add just below -->
<td>
	<span class="product_price_reduction">{$product.reduction_percent} %</span>
</td>

 

public_html/YOURADMINFOLDER/themes/default/template/controllers/orders/helpers/view/view.tpl
<!--The line you are looking for-->
<th>
	<span class="title_box ">{l s='Unit Price'}</span>
	<small class="text-muted">{$smarty.capture.TaxMethod}</small>
</th>

<!-- Add just below -->
<th>
	<span class="title_box ">Reduction</span>
</th>

 

What are the problems ?
To integrate this code in the Thirty Bees core will require some rewriting since mine is definitely sloppy : 
- no translation for the header of the tables.
- I only display percentage and not the possibility of reduction by amount
- I don't display the original price
- I haven't gone that far but it should be noted that the customer mail should also have info about the original price, the reduction amount and the new price.
 
So, here you have it guys, I do hope this will help some people out there.
 
 
Sources :
Big thanks to Nemo and Peter on this thread which help me a lot
 
Edited by Gotabor

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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