translate product in car. Fix #416
This commit is contained in:
@@ -8,6 +8,7 @@ use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Base\CartItem as BaseCartItem;
|
||||
|
||||
use Thelia\Core\Event\Cart\CartEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\TaxEngine\Calculator;
|
||||
|
||||
class CartItem extends BaseCartItem
|
||||
@@ -89,6 +90,23 @@ class CartItem extends BaseCartItem
|
||||
return $this->getPromo() == 1 ? $this->getPromoPrice() : $this->getPrice();
|
||||
}
|
||||
|
||||
public function getProduct(ConnectionInterface $con = null, $locale = null)
|
||||
{
|
||||
$product = parent::getProduct($con);
|
||||
|
||||
$translation = $product->getTranslation($locale);
|
||||
|
||||
if ($translation->isNew()) {
|
||||
if (ConfigQuery::getDefaultLangWhenNoTranslationAvailable()) {
|
||||
$locale = Lang::getDefaultLanguage()->getLocale();
|
||||
}
|
||||
}
|
||||
|
||||
$product->setLocale($locale);
|
||||
|
||||
return $product;
|
||||
}
|
||||
|
||||
public function getRealTaxedPrice(Country $country)
|
||||
{
|
||||
return $this->getPromo() == 1 ? $this->getTaxedPromoPrice($country) : $this->getTaxedPrice($country);
|
||||
|
||||
Reference in New Issue
Block a user