fix(spa): remove html in price for some opencart custom themes
This commit is contained in:
@@ -3,17 +3,20 @@
|
||||
namespace App\Services;
|
||||
|
||||
use Cart\Cart;
|
||||
use Cart\Currency;
|
||||
use Openguru\OpenCartFramework\OpenCart\Decorators\OcRegistryDecorator;
|
||||
|
||||
class CartService
|
||||
{
|
||||
private OcRegistryDecorator $oc;
|
||||
private Cart $cart;
|
||||
private Currency $currency;
|
||||
|
||||
public function __construct(OcRegistryDecorator $registry, Cart $cart)
|
||||
public function __construct(OcRegistryDecorator $registry, Cart $cart, Currency $currency)
|
||||
{
|
||||
$this->oc = $registry;
|
||||
$this->cart = $cart;
|
||||
$this->currency = $currency;
|
||||
}
|
||||
|
||||
public function getCart(): array
|
||||
@@ -138,8 +141,8 @@ class CartService
|
||||
$priceNumeric = $unit_price;
|
||||
$totalNumeric = $unit_price * $product['quantity'];
|
||||
|
||||
$price = $this->oc->currency->format($unit_price, $this->oc->session->data['currency']);
|
||||
$total = $this->oc->currency->format($totalNumeric, $this->oc->session->data['currency']);
|
||||
$price = $this->currency->format($unit_price, $this->oc->session->data['currency']);
|
||||
$total = $this->currency->format($totalNumeric, $this->oc->session->data['currency']);
|
||||
} else {
|
||||
$price = false;
|
||||
$total = false;
|
||||
@@ -159,7 +162,7 @@ class CartService
|
||||
if ($product['recurring']['trial']) {
|
||||
$recurring = sprintf(
|
||||
$this->oc->language->get('text_trial_description'),
|
||||
$this->oc->currency->format(
|
||||
$this->currency->format(
|
||||
$this->oc->tax->calculate(
|
||||
$product['recurring']['trial_price'] * $product['quantity'],
|
||||
$product['tax_class_id'],
|
||||
@@ -176,7 +179,7 @@ class CartService
|
||||
if ($product['recurring']['duration']) {
|
||||
$recurring .= sprintf(
|
||||
$this->oc->language->get('text_payment_description'),
|
||||
$this->oc->currency->format(
|
||||
$this->currency->format(
|
||||
$this->oc->tax->calculate(
|
||||
$product['recurring']['price'] * $product['quantity'],
|
||||
$product['tax_class_id'],
|
||||
@@ -191,7 +194,7 @@ class CartService
|
||||
} else {
|
||||
$recurring .= sprintf(
|
||||
$this->oc->language->get('text_payment_cancel'),
|
||||
$this->oc->currency->format(
|
||||
$this->currency->format(
|
||||
$this->oc->tax->calculate(
|
||||
$product['recurring']['price'] * $product['quantity'],
|
||||
$product['tax_class_id'],
|
||||
@@ -281,14 +284,14 @@ class CartService
|
||||
'title' => $total['title'],
|
||||
'value' => $total['value'],
|
||||
'sort_order' => $total['sort_order'],
|
||||
'text' => $this->oc->currency->format($total['value'], $this->oc->session->data['currency']),
|
||||
'text' => $this->currency->format($total['value'], $this->oc->session->data['currency']),
|
||||
];
|
||||
}
|
||||
|
||||
$lastTotal = $totals[count($totals) - 1] ?? false;
|
||||
$data['total'] = $lastTotal ? $lastTotal['value'] : 0;
|
||||
$data['total_text'] = $lastTotal
|
||||
? $this->oc->currency->format($lastTotal['value'], $this->oc->session->data['currency'])
|
||||
? $this->currency->format($lastTotal['value'], $this->oc->session->data['currency'])
|
||||
: 0;
|
||||
$data['total_products_count'] = $this->oc->cart->countProducts();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user