Translations seems to be broken in the modal. It seems like translations inside a controller called by a custom route, don't work. More about that here https://github.com/concrete5/concrete5/issues/4680
The code below fixes this, but only in a very ugly way. I'm just keeping this here to track the state of the problem. I'd love to have a better solution in the core, but right now it's simply broken.
<?php
namespace Concrete\Package\CommunityStore\Src\CommunityStore\Cart;
use Concrete\Core\Controller\Controller as RouteController;
use View;
use Illuminate\Filesystem\Filesystem;
use Concrete\Package\CommunityStore\Src\CommunityStore\Cart\Cart as StoreCart;
use Concrete\Package\CommunityStore\Src\CommunityStore\Utilities\Calculator as StoreCalculator;
use Localization;
use Session;
class CartModal extends RouteController
{
public function getCartModal()
{
$prevLocale = Session::get('previous_locale');
if ($prevLocale) {
Localization::changeLocale($prevLocale);
}
$cart = StoreCart::getCart();
$discounts = StoreCart::getDiscounts();
$totals = StoreCalculator::getTotals();
$total = $totals['subTotal'];
if (Filesystem::exists(DIR_BASE.'/application/elements/cart_modal.php')) {
View::element('cart_modal', array('cart' => $cart, 'total' => $total, 'discounts' => $discounts, 'actiondata' => $this->post()));
} else {
View::element('cart_modal', array('cart' => $cart, 'total' => $total, 'discounts' => $discounts, 'actiondata' => $this->post()), 'community_store');
}
}
}
Translations seems to be broken in the modal. It seems like translations inside a controller called by a custom route, don't work. More about that here https://github.com/concrete5/concrete5/issues/4680
The code below fixes this, but only in a very ugly way. I'm just keeping this here to track the state of the problem. I'd love to have a better solution in the core, but right now it's simply broken.