Page 1 of 1

Cart item + price

Posted: Sat Jan 13, 2018 11:49 pm
by Lorddrk
Hey guys, i have a template that uses
<span id="cart-total"><?php echo $text_items; ?></span>

This is standard opencart, i guess

But this situation shows both product counter + price as you can see it here Image

How can i change only to product counter?

I changed the language file to %s instead of %s - %s but only has effect when i update the page Image

Thanks in advance, i really appreciate the help.

Re: Cart item + price

Posted: Sun Jan 14, 2018 12:07 am
by straightlight
No OC version posted. Assuming v2.3.0.2, in catalog/controller/checkout/cart.php file,

find:

Code: Select all

$json['total'] = sprintf($this->language->get('text_items'), $this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0), $this->currency->format($total, $this->session->data['currency']));
replace with:

Code: Select all

$json['total'] = sprintf($this->language->get('text_items'), $this->cart->countProducts());
Then, in your catalog/language/<your_language_code>/checkout/cart.php file,

find:

Code: Select all

$_['text_items']               = '%s item(s) - %s';
replace with:

Code: Select all

$_['text_items']               = '%s item(s)';
This should resolve the issue.

Re: Cart item + price

Posted: Sun Jan 14, 2018 12:15 am
by Lorddrk
straightlight wrote:
Sun Jan 14, 2018 12:07 am
No OC version posted. Assuming v2.3.0.2, in catalog/controller/checkout/cart.php file,

find:

Code: Select all

$json['total'] = sprintf($this->language->get('text_items'), $this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0), $this->currency->format($total, $this->session->data['currency']));
replace with:

Code: Select all

$json['total'] = sprintf($this->language->get('text_items'), $this->cart->countProducts());
Then, in your catalog/language/<your_language_code>/checkout/cart.php file,

find:

Code: Select all

$_['text_items']               = '%s item(s) - %s';
replace with:

Code: Select all

$_['text_items']               = '%s item(s)';
This should resolve the issue.
Yes, its v2.3.0.2, sorry i forgot to mention.

This solved the issue, thanks!

Re: Cart item + price

Posted: Sun Jan 14, 2018 12:18 am
by straightlight
No problem. Your description and the images posted with the issue definitely does respect the forum rules, however. :dance:

Just don't forget to post the OC version when creating a new topic. ;)