Post by jerdna » Wed Sep 18, 2013 4:49 pm

Simple question.....is ist possible to call different words to the cart text based on quantity.
I our cuntry we also have special word for 2 products.

1 product...product
2 products.... in SLOVENIA diferent word
3 and more products...products

Is there a simple code that would pull the corect word based on quantity that is in cart from language file.

Thanx in advance Andrej

Newbie

Posts

Joined
Fri Nov 12, 2010 8:18 pm

Post by Lucmac » Mon May 20, 2019 3:32 am

För that u would have to edit the common cart files, if you're still interested I can help

New member

Posts

Joined
Mon Apr 22, 2019 5:29 pm

Post by cedcommerceteam » Tue May 21, 2019 2:00 pm

Hello Jerdna,

You need to add custom JS through which you can add different text in cart according to quantity, as this is a modification in core file so you need to use vQmod or Ocmod file (according to your OC Version) to add a JS into core file.

Thanks.

Call us at : (+91) -8765210318 , Skype: live:carlmorgan.cedcommerce , Email: support@cedcommerce.com
CedCommerece : Officail Opencart Partners
CedCommerce Official : www.cedcommerce.com
Opencart Services : www.cedcommerce/opencart-services.com
Sell On various Marketplace Integration : Opencart-Extensions
Magenative Mobile App/IOS Development : magenative.com
Webinar : Power up Your holiday season marketing with the Automation tool


User avatar
Active Member

Posts

Joined
Wed Aug 09, 2017 9:02 pm

Post by rndmizer » Sat Feb 01, 2020 10:37 am

For those who need a custom solution (no perfect but works for me)

//in language files define plural like below

Code: Select all

$_['text_reviews']  = '%s reviews|%s review';
//in system/general.php add

Code: Select all

if(!function_exists('returnPlural')){
    function returnPlural($message, $count, $delimiter="|"){
        return strpos($message, $delimiter) !== false ?
            str_replace($delimiter, '', substr(stristr(sprintf($message, $count, $count), $delimiter, ($count <= 1 ? 0 : 1)), 0)) :
            sprintf($message, $count);
    }
}
//usage

Code: Select all

$reviews = returnPlural($this->language->get('text_reviews'), (int)$result['reviews']);

Newbie

Posts

Joined
Sat Feb 01, 2020 10:28 am
Who is online

Users browsing this forum: No registered users and 97 guests