Post by Lorddrk » Sat Jan 13, 2018 11:49 pm

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.

Newbie

Posts

Joined
Sun Sep 13, 2015 9:55 am

Post by straightlight » 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.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Lorddrk » Sun Jan 14, 2018 12:15 am

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!

Newbie

Posts

Joined
Sun Sep 13, 2015 9:55 am

Post by straightlight » Sun Jan 14, 2018 12:18 am

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. ;)

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 15 guests