Jump to content

[SOLVED] Order Reference in My Loyalty


zAy

Recommended Posts

Hello,

 

Noticed a small problem with loyalty history, under vouchers sections, the "more" link that usually shows the orders from which this voucher has been generated.

 

It is showing the same 2 orders to the exception of the price: (for example)

Order #4 (300 USD) : 30 points

Order #4 (3000 USD) : 30 points

While the second one should be order #5 and 300 points.

 

I looked at /modules/loyalty/views/templates/front/loyalty.tpl (line 165)

<td class="history_method">
 <a href="{$smarty.server.SCRIPT_NAME|escape:'htmlall':'UTF-8'}" onclick="return false" class="tips" title="
 {l s='Generated by these following orders' mod='loyalty'}|{foreach from=$discount->orders item=myorder name=myLoop}
 {l s='Order #%d' sprintf=$myorder.id_order mod='loyalty'}
 ({displayPrice price=$myorder.total_paid currency=$myorder.id_currency}) :
 {if $myorder.points > 0}{l s='%d points.' sprintf=$myorder.points mod='loyalty'}{else}{l s='Cancelled' mod='loyalty'}{/if}
 {if !$smarty.foreach.myLoop.last}|{/if}{/foreach}">{l s='more...' mod='loyalty'}</a></td>

 

It doesn't seem to be problematic, so i guess the problem could be in some php file ??

 

 

Another thing, what if someone wants the order reference instead of order ID to be displayed ?

on the same file (line 50):

 <tbody>
 {foreach from=$displayorders item='order'}
  <tr class="alternate_item">
<td class="history_link bold">{l s='#' mod='loyalty'}{$order.id|string_format:"%06d"}</td>
<td class="history_date">{dateFormat date=$order.date full=1}</td>
<td class="history_method">{$order.points|intval}</td>
<td class="history_method">{$order.state|escape:'htmlall':'UTF-8'}</td>
  </tr>
 {/foreach}
 </tbody>

 

I tried $order.reference with no result, i found that reference is not even in the loyalty table in db.

Anyone can help with this ? like adding reference to the loyalty table so we can call it as $order.reference instead of $order.id

 

Thank you all for reading, and any help is much appreciated.

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

Ok, i couldn't wait for it, i found temporary solution for part 1 of my question above. And a Solution to part 2.

 

Part 1: about the "more" link that usually shows the orders from which this voucher has been generated (in my loyalty page)

Temp solution: I Removed it (coz simply not very important to know from which orders this voucher was created )

 

Part 2: about order reference instead of order ID to be displayed (in my loyalty page)

Solution:

 {foreach from=$displayorders item='order'}
  <tr class="alternate_item">
	<td class="history_link bold">{l s='#' mod='loyalty'}{$order.id|string_format:"%06d"}</td>
	<td class="history_date">{dateFormat date=$order.date full=1}</td>
	<td class="history_method">{$order.points|intval}</td>
	<td class="history_method">{$order.state|escape:'htmlall':'UTF-8'}</td>
  </tr>
 {/foreach}
 </tbody>

 

replaced <td class="history_link bold">{l s='#' mod='loyalty'}{$order.id|string_format:"%06d"}</td>

with <td class="history_link bold">{Order::getUniqReferenceOf($order.id)}</td>

 

Hope it is understandable.

  • Like 2
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...