Hoje você consegue realizar a pesquisa de itens por centro de distribuição na página de detalhe de produto, onde ao realizar o cálculo do frete é retornado os centros de distribuições que tiverem estoque no produto.
O Layout para fazer este retorno é: FlexyFtwoStoreBundle:Include-Product:price-list.html.twig
<div class="price-list-box col-xs-12 col-sm-12 col-md-12" >
{% set variantsByDistributionCenters = flexy_ftwo_variant_distribution_center_list(variant.referenceCode, {'orderBy' : 'price'}) %}
<div class="col-xs-12 col-sm-12 col-md-12 price-list-box-header">
<div class="price-list-box-header-div first-col" >
Vendido Por
</div>
<div class="price-list-box-header-div second-col" >
Frete
</div>
<div class="price-list-box-header-div third-col" >
Preço
</div>
<div class="price-list-box-header-div fourth-col" >
Quantidade
</div>
<div class="price-list-box-header-div fifth-col" >
</div>
</div>
{{% set showPriceList = 1 %}}
{% for variantPriceList in variantsByDistributionCenters|slice(0) %}
<div class="col-xs-12 col-sm-12 col-md-12 price-list-box-body">
<input type="hidden" name="id-{{ variantPriceList.distributionCenterReferenceCode }}" value="{{ variantPriceList.variantId }}">
<input type="hidden" name="distributionCenterReferenceCode" value="{{ variantPriceList.distributionCenterReferenceCode }}">
<div class="price-list-box-row first-col center-element-vertical">
{{ variantPriceList.shoppingStoreCenterName }}
</div>
<div class="price-list-box-row second-col center-element-vertical onoculos-frete-{{ variantPriceList.distributionCenterReferenceCode }}">
</div>
<div class="price-list-box-row third-col center-element-vertical justify-element-center" style="text-align: center;" >
R$ {{ variantPriceList.actualPrice|number_format(2, ',', '.') }}
</div>
<div class="price-list-box-row fourth-col" >
<input type="number" id="quantity_{{ variantPriceList.shoppingStoreReferenceCode }}" name="quantity" class="quantity f2-shipping-estimate-quantity f2-shipping-estimate-quantity-onoculos-{{ variantPriceList.distributionCenterReferenceCode }} product-quantity number form-control quantity-onoculos" min="1" value="1" data-maximum-quantity="{{ variant.stock.hasStockControl ? variant.stock.quantity : '' }}">
</div>
<div class="price-list-box-row fifth-col" >
<button type="button" class="btn flexy-add-to-cart main_cart btn-light-blue button-onoculos" data-variant-id="{{ variantPriceList.variantId }}" data-product-quantity="#quantity_{{ variantPriceList.shoppingStoreReferenceCode }}" data-distributioncenter="{{ variantPriceList.shoppingStoreReferenceCode }}">
<div class="desktop-button">
<i class="fa fa-shopping-cart d_inline_m m_right_9"></i> Comprar
</div>
<div class="mobile-button">
<i class="fa fa-shopping-cart d_inline_m m_right_9"></i>
</div>
</button>
</div>
</div>
{% endfor %}
<div class="row">
<div class="col-sm-6"> <br>
<span>Frete e prazo:</span>
<div class="input-group">
<input type="text" name="zipCode" id="zipCode" placeholder="CEP" value="{{ app.request.get('zipCode')}}" class="form-control cep f2-shipping-estimate-postcode" maxlength="9">
<span class="input-group-btn">
<button class="btn btn-light-blue btn-onoculos f2-multiple-cd-shipping-estimate-action" type="submit" >Calcular</button>
</span>
</div>
</div>
</div>
</div>
<script>
$('.f2-multiple-cd-shipping-estimate-action').on('click', function (e) {e.preventDefault();
shippingCalculation()
});
function shippingCalculation()
{
var postcode = $('.f2-shipping-estimate-postcode').val();
if (postcode == undefined || postcode === "") {
alert('Informe o CEP');
return;
}
$("input[name='distributionCenterReferenceCode']").each(function()
{
var dcRefCode = $(this).val();
var variantId = $("input[name='id-" + dcRefCode + "']").val();
$.calculate_shipping_by_variant('html',
function (data)
{
$('.onoculos-frete-' + dcRefCode).html('<i class="fa fa-spinner fa-spin"></i> Calculando...')
},
function (data)
{
$('.onoculos-frete-' + dcRefCode).html(data);
},
postcode,
$('.f2-shipping-estimate-quantity-multiploscds-' + dcRefCode ).val(),
variantId, dcRefCode );
});
}
</script>
Comentários
0 comentário
Artigo fechado para comentários.