Jump to content

Available quantities


mareksmareks

Recommended Posts

Hello.
I need to show in my shop (1.6.1.20) FO only product available quantity if it is less then 100 pieces. If more then 100 then just to hide text.

For products WITHOUT combinations i modified code in product.tpl to this and it works:

	        <p id="pQuantityAvailable"{if $product->quantity <= 0 || $product->quantity >= 100} style="display: none;"{/if}>
                    <span id="quantityAvailable">{$product->quantity|intval}</span>

 

BUT this wont work on products WITH combinations. There I must modify js/product.js and I need help here because im not so familiar with javascripts.

I already found these lines:

		if (quantitiesDisplayAllowed)
		{
			$('#pQuantityAvailable:hidden').show('slow');
			$('#quantityAvailable').text(quantityAvailable);

			if (quantityAvailable < 2) // we have 1 or less product in stock and need to show "item" instead of "items"
			{
				$('#quantityAvailableTxt').show();
				$('#quantityAvailableTxtMultiple').hide();
			}
			else
			{
				$('#quantityAvailableTxt').hide();
				$('#quantityAvailableTxtMultiple').show();
			}
		}

I changed 

		if (quantitiesDisplayAllowed && quantityAvailable < 100)

and it kind of works but when i select combination with more than 100 pieces in quantity the text wont go away. It stays on from last combination what was used with less then 100 pieces.

I tried this and that but as I mentioned I am not so familiar with javascript. 

Can PS gurus help me out here?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...