Powerful and easy to use cms to build websites, blogs or ecommerce stores.
HTML backendblogblog-engineblog-platformbloggingcmscontent-managementcontent-management-systemecommerceecommerce-platformno-codepage-builderphpphp-cmsphp7php8self-hostedshopping-cartweb-applicationwebsite-builder
Renamed getTotals
givanz6afe67f59c3b
diff --git a/app/component/cart.php b/app/component/cart.phpindex c157580..43fd089 100755--- a/app/component/cart.php+++ b/app/component/cart.php@@ -29,6 +29,7 @@ use Vvveb\System\Event;class Cart extends ComponentBase {public static $defaultOptions = [+ 'cart_id' => null, //cart_id/encrypted_cart_id cart id or encrypted cart id generated by Cart::getEncryptedId'language_id' => null,'site_id' => null,];@@ -45,13 +46,13 @@ class Cart extends ComponentBase {function results() {$site = siteSettings($this->options['site_id'], $this->options['language_id']);$this->options += array_intersect_key($site,- array_flip(['weight_type_id', 'length_type_id', 'currency_id', 'country_id']));+ array_flip(['weight_type_id', 'length_type_id', 'currency_id', 'country_id']));$cart = ShoppingCart::getInstance($this->options);$results['products'] = $cart->getAll();$results['coupons'] = $cart->getCoupons();$results['total_items'] = $cart->getNoProducts();- $results['totals'] = $cart->getTotals();+ $results['totals'] = $cart->getAllTotals();$results['total'] = $cart->getGrandTotal();$results['total_formatted'] = $cart->getGrandTotalFormatted();diff --git a/system/cart/total-trait.php b/system/cart/total-trait.phpindex aa5424f..c1683aa 100644--- a/system/cart/total-trait.php+++ b/system/cart/total-trait.php@@ -29,7 +29,6 @@ trait TotalTrait {$data = ['namespace' => $namespace, 'key' => $key, 'title' => $title, 'value' => $value, 'value_formatted' => $this->currency->format($value), 'text' => $text];$this->totals[$key] = $data;- $this->write();}function removeTotal($namespace, $key = false) {@@ -37,7 +36,9 @@ trait TotalTrait {unset($this->totals[$key]);} else {foreach ($this->totals as $key => $total) {- if ($total['namespace'] == $namespace) unset($this->totals[$key]);+ if ($total['namespace'] == $namespace) {+ unset($this->totals[$key]);+ }}}}@@ -58,16 +59,18 @@ trait TotalTrait {} else if ($namespace) {$totals = [];foreach ($this->totals as $key => $total) {- if ($total['namespace'] == $namespace) $totals[$key] = $total;+ if ($total['namespace'] == $namespace) {+ $totals[$key] = $total;+ }}-+return $totals;}-+return $this->totals;}-- function getAllTotals() {++ function getAllTotals() {//include taxes$this->addTaxTotal();$this->addCouponTotal();