| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Displaying "item" or "items" in minicart | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Displaying "item" or "items" in minicart
Hi, I'm trying to edit the language variable
lbl_cart_X_items_total which I believe displays "item(s)" in the minicart, so that it displays "item" for one item, and "items" for more than one item. Currently the language variable is: <span class="minicart-items-value">{{x}}</span> <span class="minicart-items-label">item(s)</span> <span class="minicart-items-delim">/</span> <span class="minicart-items-total help-link" onmouseover="javascript: viewTooltip(this, txt_minicart_total_note);">{{total}}</span> and I have used something similar to achieve this effect in another site, on the subcategory page, like this: <td class="P_Count">{if $config.Appearance.count_products eq "Y"}{if $subcat.product_count}{ $subcat.product_count } {$lng.lbl_product}{if $subcat.product_count > 1}s{/if} so I wondered if anybody knew what smarty parameter (sorry if that's the wrong word) I would use instead of &subcat.product_count (which I know is nothing to do with what I want!) I would then just use something like item{if $subcat.product_count > 1}s{/if} instead of item(s) in the language variable shown above. (Obviously with the correct Smarty parameter!) If you could also explain how I find out what Smarty parameter is being used, that would be a great help, so that I can try to find it out for myself next time.
__________________
X-Cart Gold Version 4.3.2 |
|||||||
#2
|
|||||||
|
|||||||
Re: Displaying "item" or "items" in minicart
I tried
item{if $minicart_total_items > 1}s{/if} but that doesn't work - I suspect that Smarty tags don't work within a language variable. I've also never seen a language variable used like this before, i.e. for code, rather than just text.
__________________
X-Cart Gold Version 4.3.2 |
|||||||
#3
|
|||||||
|
|||||||
Re: Displaying "item" or "items" in minicart
Login to your admin panel, go to General settings and near the bottom enable "Debug console". When you go back to your site, you'll get a pop-up which shows all available variables on that specific page.
Keep in mind that to get info from an associative array you will need something such as this: arrayName1.arrayName2.arrayName3 |
|||||||
#4
|
|||||||
|
|||||||
Re: Displaying "item" or "items" in minicart
Thanks for your advice, Tal, I think it's definitely
$minicart_total_items but I don't think I can put the Smarty tags into the language variable, as explained above, so I will somehow have to put the code in the language variable, into minicart_total.tpl, which uses this code: Code:
__________________
X-Cart Gold Version 4.3.2 |
|||||||
#5
|
|||||||||
|
|||||||||
Re: Displaying "item" or "items" in minicart
Please post the code here when you get it figured out. I too want that as well.
__________________
Carl Tice X-Cart 4.6.6 X-Payments 3.0 ReBOOT 3.4.1 PHP 5.6.30 MySQL 5.6.35 Linux 2.6.32-042stab120.18 ionCube PHP Loader v4.7.3 Perl 5.10.1 |
|||||||||
#6
|
|||||||
|
|||||||
Re: Displaying "item" or "items" in minicart
I'm afraid that I am stuck on this one, Vacman, let's hope that somebody else knows the answer! It should be the default on X-Cart anyway, it's very unprofessional looking to have "item(s)".
__________________
X-Cart Gold Version 4.3.2 |
|||||||
#7
|
|||||||||
|
|||||||||
Re: Displaying "item" or "items" in minicart
why not just have 2 language variables, 1 for item and 1 for items, then use the if statement to decide which one to display?
__________________
X-Cart version 5 (Previously 3.5-4) Previous Versions included BCSE Reward Points Mod Altered Cart On Sale Mod Wordpress Plugin Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there. Shout me a Coffee! |
|||||||||
#8
|
|||||||
|
|||||||
Re: Displaying "item" or "items" in minicart
But I don't know how to set up the 'if' statement Amy, that's where I'm having trouble. You don't need to use two language variables, it's easier and clearer to use my method.
__________________
X-Cart Gold Version 4.3.2 |
|||||||
#9
|
|||||||
|
|||||||
Re: Displaying "item" or "items" in minicart
I've found the solution, which is quite simple (but you lose the minicart tooltip, which I don't think anybody will use anyway):
Edit customer/minicart_total.tlp and on line 11 (I think, this may be a few lines out as I've moved things about a bit while working on this), delete the following line: Code:
and insert the following instead: Code:
That works fine, as long as you don't need the Minicart mouseover tooltip, because the label 'lbl_cart_X_items_total' is as follows: Code:
My solution uses the much simpler label 'lbl_item' which is, of course, "item".
__________________
X-Cart Gold Version 4.3.2 |
|||||||
#10
|
|||||||
|
|||||||
Re: Displaying "item" or "items" in minicart
Just to add to your solution, I did the following to also display the words "is" or "are" depending on whether there is 1 or more items in the cart. Doesn't affect the tool tip either.
Code:
__________________
X-Cart Gold 4.3.2 (Windows) X-Cart Gold Plus 4.6.1 (Linux) Magic Toolbox slider and zoom |
|||||||
|
|||
X-Cart forums © 2001-2020
|