Jump to content

Loyalty module and $nbDiscounts issue

Recommended Posts

Hi. I am using Prestashop with the Loyalty Module. I am generating some loyalty points by code using the following lines:
//Suma puntos al recomendante
            $loyalty = new LoyaltyModule();
            $loyalty->id_customer = (int)$customer_gen;
            $loyalty->id_order = (int)$id_parent_r;
            // Debe ajustarse la constante 5 para corresponder a la bonificacion
                    // que se quiere dar al recomendante. El parametro esta en funcion del
                    // valor configurado en el panel de control de Loyalty.
                    $loyalty->points = (int)round(LoyaltyModule::getOrderNbPoints($params['order']) * 5);
                    $loyalty->id_loyalty_state = 2; // Estado inicial de los puntos
The points are being generated without issues. However, when I redeem the points to transform them into a voucher at "My Loyalty Points" section with a user logged in, I can see that the points status change to "redeemed"; just as in the next table.

#000021 17/11/2013 22:44:12 220 Convertidos #000021 17/11/2013 22:57:46 10 Convertidos

However the vouchers area, where the voucher with the points redeemed should appear, is empty... as if there was no voucher, even though a voucher was generated. I can see the voucher on the ps_cart_rule table at the database. I can copy the voucher`s code from the database and paste it on a new order and it validates correctly and provides the associated discount to the cart.
My issue is that the customer, from his/her account, is not able to see the voucher nor the code, and, will not be able to use it and that is bad.
I have looked at modules/loyalty/views/templates/front/loyalty.tpl and around line 140 I found:


{if $nbDiscounts}
<div class="block-center" id="block-history">
    <table id="order-list" class="std">
                <th class="first_item">{l s='Created' mod='loyalty'}</th>
                <th class="item">{l s='Value' mod='loyalty'}</th>
                <th class="item">{l s='Code' mod='loyalty'}</th>
                <th class="item">{l s='Valid from' mod='loyalty'}</th>
                <th class="item">{l s='Valid until' mod='loyalty'}</th>
                <th class="item">{l s='Status' mod='loyalty'}</th>
                <th class="last_item">{l s='Details' mod='loyalty'}</th>


<p class="warning">{l s='No vouchers yet.' mod='loyalty'}</p>
<p class="warning">{l s='No reward points yet.' mod='loyalty'}</p>


I guess $nbDiscounts is not true because the first else contains the "No vouchers yet" message I am receiving. How can $nbDiscounts not be true if the code and vouchers were generated?


Someone can help me out?


It would be really appreciated.

Share this post

Link to post
Share on other sites



have you ever found a solution for your problem? I'm facing this right now.



Share this post

Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More