Jump to content

Show available quantity to a specific group?


mytheory.

Recommended Posts

Hi all,

How would I disable the available quantity display for all groups except for 1 group?

We want to set it up so that group X can see the available qty for all the products when they log in, but for all other groups this stock qty number should not be visible.

Thanks!

Link to comment
Share on other sites

  • 4 weeks later...

Rocky,

I have a similar question I hope you can help with. I want to display available quantity on the product list page. I copied some code from the product.tpl and inserted into the product-list.tpl but it always display 0 in stead of actual quantiy as displayed in the corresponding product page. Do you know why?

Code inserted into the product list page.

<!-- number of item in stock -->

quantity == 0)} style="display:none;"{/if}>
{$product->quantity|intval}
quantity > 1} style="display:none;"{/if} id="quantityAvailableTxt">{l s='item in stock'}
quantity < 2} style="display:none;"{/if} id="quantityAvailableTxtMultiple">{l s='items in stock'}





Thanks in advance for your help

website:

http://1top.co.uk

login: [email protected]
password: demo123

Link to comment
Share on other sites

Hi,

This is what I did... I'm not sure if it will fix your problem, but it works perfectly on our site... so hopefully you find it helpful.

Here's my copy of the same block of code:

                       <!-- number of item in stock -->

                       {if ($product.quantity > 0) || ($product.allow_oosp)}
                           {if $trade}
{$product.quantity|intval}
 1} style="display:none;"{/if} id="quantityAvailableTxt">{l s='item'}
{l s='items'}
                           {/if}
                       {/if}



Also, since I was trying to only show this information to a certain group I applied the code changes from the link from rocky's above post. So within the above code you should see the {if $trade} tag in the above code... if you made the changes from rocky's other post then leave this, otherwise you can take this if statement and it's closing tag out if you want to make this information visible to everybody.

HTH!

Link to comment
Share on other sites

can you post a copy of our product-list.tpl file?

I recently had a similar problem, not exactly with this but with reference numbers (ithink), anyhow, it ended up being a problem with an if statement from somewhere near the beginning of the tpl file. Something was preventing it from calling something to output the right information.

Link to comment
Share on other sites

Here is the full code of product-list

>
{if isset($products)}

   <!-- Products list -->

</pre>
<ul>
   {foreach from=$products item=product name=products}


{if ($product.allow_oosp OR $product.quantity > 0)}{l s='Available'}{else}{l s='Out of stock'}{/if}
<!--{if $product.new == 1}{l s='New'}{/if} -->{$product.name|truncate:43:'...'|escape:'htmlall':'UTF-8'}

getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" />


{$product.description_short|strip_tags:'UTF-8'|truncate:200:'...'}


               {if $product.on_sale}
{l s='On sale!'}
               {elseif ($product.reduction_price != 0 || $product.reduction_percent != 0) && ($product.reduction_from == $product.reduction_to OR ($smarty.now|date_format:'%Y-%m-%d' <= $product.reduction_to && $smarty.now|date_format:'%Y-%m-%d' >= $product.reduction_from))}
{l s='Price lowered!'}
               {/if}


{if $logged} 

               <!-- availability  shan added -->

quantity == 0 && !$product->available_later) || (!$product->available_now && $display_qties != 1) } style="display:none;"{/if}>
{l s='Availability:'}
quantity == 0} class="warning-inline"{/if}>
                   {if $product->quantity == 0}{if $allow_oosp}{$product->available_later}{else}{l s='Out of stock'}{/if}{else}{$product->available_now}{/if}


            <!-- number of item in stock -->

                       {if ($product.quantity > 0) || ($product.allow_oosp)}

{$product.quantity|intval}
 1} style="display:none;"{/if} id="quantityAvailableTxt">{l s='item'}
{l s='items'}

                       {/if}





               <!-- price qty add to cart view  -->
               {if !$priceDisplay || $priceDisplay == 2}{convertPrice price=$product.price}{if $priceDisplay == 2} {l s='+Tx'}{/if}{/if}
               {if $priceDisplay}{convertPrice price=$product.price_tax_exc}{if $priceDisplay == 2} {l s='-Tx'}{/if}{/if}

{l s='View'}

              {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2}
{l s='Qty:'}   
                 <input type="text" name="ajax_qty_to_add_to_cart[{$product.id_product|intval}]" id="quantity_wanted_{$product.id_product|intval}" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="4" /> 
{l s='Add'}{else}
{l s='Add'}
               {/if}


              {else}
Login to see price
{/if} 



 



   {/foreach}
</ul>
<br>   <!-- /Products list --><br>{/if}<br><br

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...