Jump to content

Edit History

Ray UK

Ray UK

I seem to have accomplished this by using the product.availability_message variable.

If anybody needs the code I used, here it is

{if $product.availability_message == 'In Stock.'}
		
		<form action="{$urls.pages.cart}" method="post" id="add-to-cart-or-refresh">
			<input type="hidden" name="token" value="{$static_token}">
			<input type="hidden" name="id_product" value="{$product.id}" id="product_page_product_id">
			<button class="btn btn-block btn-primary add-to-cart {if $product.quantity < 1}out-of-stock{/if}" data-button-action="add-to-cart" type="submit">
				<i class="fal fa-shopping-cart hidden-sm-down"></i>
				{l s='Add to cart' d='Shop.Theme.Actions'}
			</button>
		</form>
		
		{elseif $product.availability_message == 'Product available with different options'}
		<a class="btn btn-block btn-info" href="{$product.url}">View Options</a>
		{else}		
	
		<div class="addtocart">
			<button class="btn btn-block">Out of Stock</button>
		</div>
		{/if}

You can see it working here https://www.nwecigs.co.uk/10-ecigarette-kits?page=2

Ray UK

Ray UK

I seem to have accomplished this by using the product.availability_message variable.

If anybody needs the code I used, here it is

{if $product.availability_message == 'In Stock.'}
		
		<form action="{$urls.pages.cart}" method="post" id="add-to-cart-or-refresh">
			<input type="hidden" name="token" value="{$static_token}">
			<input type="hidden" name="id_product" value="{$product.id}" id="product_page_product_id">
			<button class="btn btn-block btn-primary add-to-cart {if $product.quantity < 1}out-of-stock{/if}" data-button-action="add-to-cart" type="submit">
				<i class="fal fa-shopping-cart hidden-sm-down"></i>
				{l s='Add to cart' d='Shop.Theme.Actions'}
			</button>
		</form>
		
		{elseif $product.availability_message == 'Product available with different options'}
		<a class="btn btn-block btn-info" href="{$product.url}">View Options</a>
		{else}		
	
		<div class="addtocart">
			<button class="btn btn-block">Out of Stock</button>
		</div>
		{/if}

 

×
×
  • Create New...