clerkio / clerk-magento

Other
8 stars 20 forks source link

discount_percent calculated wrongly #47

Closed olzen90 closed 7 years ago

olzen90 commented 7 years ago

The current getDiscountPercent function wrongly calculates the discount to a negative number.

In Productbase.php, replace the getDiscountPercent function with this instead, and it works:

 public function getDiscountPercent()
    {
      if($this->isOnSale()) {
      return round( (($this->getClerkRetailPrice()-$this->getClerkFinalPrice() ) / $this->getClerkRetailPrice())*100 );
      }
      else {
        return 0;
      }
    }