{{var $reservation = $wsInventory.loadReservation($basketItem.id)}}
{{ if $reservation }}
{{ var $inventoryReserveAction = $wsActions.create("InventoryReserve", tag=$basketItem.id) }}
{{ if $reservation.duration > 0 }}
{{ var $sec = $reservation.duration % 60 }}
{{ var $min= ( $reservation.duration - $sec ) / 60 }}
The product is still reserved for you for
{{ if $min > 0 }}
<strong>{{= $min }} minutes</strong> and
{{ /if }}
<strong>{{= $sec }} seconds</strong>
{{ else }}
Unfortunately, your reservation has expired.
<form method="post" action="{{ $wsViews.viewUrl('basket.htm') }}">
<input type="hidden" name="wscsrf" value="{{= $inventoryReserveAction.csrf }}">
<input type="hidden" name="wsact" value="{{= $inventoryReserveAction.id }}">
<input type="hidden" name="wstarget" value="{{= $wsViews.viewUrl('basket.htm') }}">
<input type="hidden" name="basketItemId" value="{{= $basketItem.id }}">
<button>Reserve again</button>
</form>
{{ /if}}
{{ if $inventoryReserveAction.success }}
<div class="alert alert-success">Quantity was successfully reserved again.</div>
{{ if $inventoryReserveAction.successInfo.oldQuantity != $inventoryReserveAction.successInfo.newQuantity}}
<div class="alert alert-warning">The quantity had to be changed due to insufficient stock from
<strong>{{= $inventoryReserveAction.successInfo.oldQuantity | preparedFormat('amount') }}</strong>
to
<strong>{{= $inventoryReserveAction.successInfo.newQuantity | preparedFormat('amount') }}</strong>
</div>
{{ /if }}
{{ /if }}
{{ if $inventoryReserveAction.error }}
<div class="alert alert-danger">
Errors occurred:
<ul>
{{ foreach $error in $inventoryReserveAction.errors }}
{{ if $error.text }}
<li> {{= $error.text }} </li>
{{ else }}
<li> {{= $error.code }} </li>
{{ /if }}
{{ /foreach }}
</ul>
</div>
{{ /if }}
{{ /if }}
Stock
Extend the basket reservation time in WEBSALE templates by loading reservation data via wsInventory.loadReservation for the current basket item.
Example for extending the reservation time in the basket
Verwandte Themen
Storefront API Stock$wsInventory - Stockcontent - Catalogue (categories & products)Storefront API Customer AccountInventory