<?php
class ModelExtensionTotalExtraDiscount extends Model {
	public function getTotal($total) {
        $promotion = $this->config->get('promotion');

        if(!empty($promotion['discount_percent'])){
            $cart_total = $this->cart->getSubTotal();

            $discount_percent = !empty($promotion['discount_percent']) ? /*$promotion['discount_percent']/100*/ 0.1 : 1;
            $discount = $cart_total*$discount_percent;
                
            $total['totals'][] = array(
                'code'       => 'extra_discount',
                'title'      => sprintf('Ekstra İndirim'),
                'value'      => -$discount,
                'sort_order' => 2
            );

            $total['total'] -= $discount;
        }       
	}
}
