Jump to content

[Solved] Is it posible to discount by history paid ?


Recommended Posts

Hi,

I new for prestashop.

Now i have Idea to give customer discount by his history paid

like

Mr.A bought 3 times total $50, Mr.A will has 5% discount for next buy,
and Mr.B bought 2 times total $100, Mr.B will has 10% discount for next buy.

can anyone guide me do that or do you have suggest module ?


Thank.
Qubew

Link to comment
Share on other sites

Thank you,

I had solved this problem by edited /classes/cart.php related by http://www.prestashop.com/forums/viewthread/46117/P0/third_party_modules/discount_of_total_price

using this code to get history paid.

$querypaid = "SELECT SUM(total_paid_real) AS history_paid  
                                   FROM ps_orders 
                                   WHERE id_customer = '".$this->id_customer."' 
                                     AND id_order IN (
                                                   SELECT id_order 
                                                       FROM ps_order_history 
                                                       WHERE id_order_state IN (2) 
                                                     )
                                "; 
                   $resultpaid = mysql_query($querypaid) or die(mysql_error());
                   $row = mysql_fetch_array($resultpaid);
                   // get money of customer paid
                   $Summary = $row['history_paid'];





then using to make discount

if ($Summary >= 50 && $Summary < 75) {
           $discount_per = 5;
}
       // set discount
       $order_total = $order_total - (($order_total * $discount_per) / 100);

Link to comment
Share on other sites

×
×
  • Create New...