1 Units in Stock!!

Locked

Views: 994

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
20 Jul 2009, 9:21 PM
#1
fredthefifth avatar

fredthefifth

New Zenner

Join Date:
Jul 2009
Location:
Somerset, UK.
Posts:
70
Plugin Contributions:
0

1 Units in Stock!!

Hi All,

I don't even know which forum to ask this in but as I am a newbie I'll start here.

Is it posible to get it to work so that if only 1 Unit is in stock then it says Unit, but changes to Units when more than one.

Going futher is it posible to change the word 'Unit' depending on the Category that the product.

So for example it says Necklace or Necklaces OR Bracelet or Bracelets and do on.

Thanks for any help.
FTF

20 Jul 2009, 9:35 PM
#2
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: 1 Units in Stock!!

Edit your product_info_display template:
Replace this line

  <?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>'  : '') . "\n"; ?>

with this

  <?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . $products_quantity . ($products_quantity == 1 ? TEXT_PRODUCT_QUANTITY_SINGLE : TEXT_PRODUCT_QUANTITY_PLURAL) . '</li>'  : '') . "\n"; ?>

Then add the two language defines into your custom language file:

define('TEXT_PRODUCT_QUANTITY_SINGLE', 'Unit in Stock');
define('TEXT_PRODUCT_QUANTITY_PLURAL', 'Units in Stock');

Neville
An assumption is what you arrive at when you get tired of thinking...

21 Jul 2009, 9:20 PM
#3
fredthefifth avatar

fredthefifth

New Zenner

Join Date:
Jul 2009
Location:
Somerset, UK.
Posts:
70
Plugin Contributions:
0

Re: 1 Units in Stock!!

Thanks.

Was the request to change the word 'Units' according to the item category a bridge too far??

Cheers.
FTF

21 Jul 2009, 10:26 PM
#4
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: 1 Units in Stock!!

That would prove very tricky if you want the categories displayed as plural in the nav sidebox and product list headings and then as singular/plural in the product counts. It can be done, but you'd need to enter the category titles as singular and then modify places where you need to display plurals - and your code would have to handle situations where the plural is -ies as well as just -s. More than a one-line code change...

Neville
An assumption is what you arrive at when you get tired of thinking...

23 Jul 2009, 9:32 PM
#5
fredthefifth avatar

fredthefifth

New Zenner

Join Date:
Jul 2009
Location:
Somerset, UK.
Posts:
70
Plugin Contributions:
0

Re: 1 Units in Stock!!

Ok, thanks for your help.
FTF