Jump to content

Display quantity in a different style on product order page.


-M-

Recommended Posts

Hi all,

 

I wanted to make a small cosmetic change on how quantities (from stock control) are being displayed on the product ordering page.

 

Currently it shows a number how many are available. For example: 50 available, 12 available, 2 available, etc.

 

However I want it to look differently. Instead of giving exact details I want to have it look like this:

 

In case there are 5 or more available it should display: 5 or more available

When there are 5 or less available it should display: 4 or less available

 

Is this possible?

 

The class name is "qty" and it's located (for example) in products.tpl (standard_cart).

 

I think it's possible to make a rule with smart based on this, but wondering. If someone could point me in the right direction, that would be sweet and highly appreciated.

 

Reason for this (if someone cares) is that I personally don't like it to give exact amounts of what you have available (in regards to servers). But that's just me. :)

 

Thanks in advance.

Link to comment
Share on other sites

it should be straightforward as qty (if it exists) will be an integer, so you should just be able to use an {if} statement in products.tpl...

 

                                    <span id="product{$product@iteration}-name">{$product.name}</span>
                                   {if $product.qty}
                                       <span class="qty">
                                           {if $product.qty gte 5}5 or more available{else}4 or less available{/if}
                                       </span>
                                   {/if}

Link to comment
Share on other sites

Thanks Brian! Highly appeciated.

Will give it a go when I am back at work tomorrow.

 

Note to myself: should type "Hi Brian!", instead of "Hi all!". :lol:

 

Update: It worked flawlessly. Many thanks!

Edited by MvdL1979
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated