guest* Posted September 16, 2010 Share Posted September 16, 2010 Can somebody please help me ?The shopping cart shows in the products-line the availability image (green if on stock and red if not on stock). I want to display instead the image the availability_value.My line in product.tpl: <!-- availability --> quantity == 0 && !$product->available_later) || (!$product->available_now && $display_qties != 1) } style="display:none;"{/if}> {l s='Availability:'} [b]quantity == 0} class="warning-inline"{/if}>[/b] {if $product->quantity == 0}{if $allow_oosp}{$product->available_later}{else}{l s='This product is no longer in stock'}{/if}{else}{$product->available_now}{/if} I tried in product_line-tpl cart_availability_value, but no value is showing there. This is my actual code for the shopping-cart-product-line.tpl: {if $product.active AND ($product.allow_oosp OR $product.stock_quantity > 0)} <!-- --> {else}<!---->{/if} It seems that smarty is not assigned for availability value in the cart. Ist this right ? How can I manage it ? I'm not a coder, only an user, so I need help in coding.THXS.Conny Link to comment Share on other sites More sharing options...
shake Posted September 23, 2010 Share Posted September 23, 2010 i've just had a quick look for when the item is available:shopping-cart-product-line.tpl: {if $product.active AND ($product.allow_oosp OR $product.stock_quantity > 0)} {$product.stock_quantity}{l s=' in stock'} {else} same for when unavailable really, either use the image icon to show no stock, or the above which will show "0" add and remove the text line as you please {l s=' in stock'} Link to comment Share on other sites More sharing options...
guest* Posted October 10, 2010 Author Share Posted October 10, 2010 @ shake: Thx for helping. Unfortunately the code you mentioned is showing again if product is in stock or not. This ist not what I want. I want instead showing stock, in stock/no stock, I want there the availability, so if available now, or later.The code in product.tpl is like this, but it does not work on shoppping cart template: <!-- availability --> quantity == 0 && !$product->available_later) OR ($product->quantity != 0 && !$product->available_now)} 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='This product is no longer in stock'}{/if}{else}{$product->available_now}{/if} The same I want in shoppping cart. I tried: quantity == 0 && !$product->available_later) OR ($product->quantity != 0 && !$product->available_now)} 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='This product is no longer in stock'}{/if}{else}{$product->available_now}{/if} but it does not work. Link to comment Share on other sites More sharing options...
guest* Posted October 10, 2010 Author Share Posted October 10, 2010 Now I have this code and it seems I'm coming near to what I want: {if $product.active AND ($product.allow_oosp OR $product.stock_quantity > 0)} {$product->available_later}{l s='Availability'} {else}{/if} Instead of Availability there must be the availabilty VALUE. I think on shopping cart there are the variables missing, but I dont know how and where I can set them:var availableNowValue = '{$product->available_now|escape:'quotes':'UTF-8'}';var availableLaterValue = '{$product->available_later|escape:'quotes':'UTF-8'}'; Link to comment Share on other sites More sharing options...
shake Posted October 10, 2010 Share Posted October 10, 2010 another little mockup for you to see the way i've done it, then you can build from that {if $product.active AND ($product.allow_oosp AND $product.stock_quantity > 0)} {$product.stock_quantity} {l s=' in stock'} {elseif $product.active AND ($product.allow_oosp AND $product.stock_quantity < 1)} {l s=' No stock'} {else} {/if} or {if $product.active AND ($product.allow_oosp AND $product.stock_quantity > 0)} {$product.stock_quantity} {l s=' in stock'} {elseif $product.active AND ($product.allow_oosp AND $product.stock_quantity < 1)} {l s=' No stock'} {else} {/if} edit: forget that, i was mis reading what you needed, i'll leave this post up for anyone needing to edit the availability part though, this modification shows the amount of stock available either in text format, or with an image with the text underneath Link to comment Share on other sites More sharing options...
Dagostino Posted January 29, 2014 Share Posted January 29, 2014 it's an old post, but i was looking for it today and with the part of the author code, i did it. so here the code for display quantity stock in cart : {if $product.active AND ($product.allow_oosp OR $product.stock_quantity > 0)}{$product->available_later}{l s={$product.stock_quantity[spam-filter] {else}{l s='0'}{/if} Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now