Skip to content

Commit

Permalink
Merge pull request #3554 from gRoussac/PSCSX-4260
Browse files Browse the repository at this point in the history
[-] FO : Fix bug #PSCSX-4260, "Free shipping" for virtual products, undefined $virtualCart
  • Loading branch information
Jérôme Nadaud committed Aug 4, 2015
2 parents 4f9fdd9 + 0187bda commit 2d932b6
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 16 deletions.
3 changes: 2 additions & 1 deletion pdf/invoice.total-tab.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</tr>

{/if}

{if !$order->isVirtual()}
<tr>
<td class="grey" width="70%">
{l s='Shipping Cost' pdf='true'}
Expand All @@ -58,6 +58,7 @@
{/if}
</td>
</tr>
{/if}

{if $footer.wrapping_tax_excl > 0}
<tr>
Expand Down
6 changes: 5 additions & 1 deletion themes/default-bootstrap/js/cart-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ function updateCartSummary(json)
}

// Block cart
if (typeof(orderProcess) !== 'undefined' && orderProcess == 'order-opc')
if (typeof(orderProcess) !== 'undefined' && orderProcess == 'order-opc' && !json.is_virtual_cart)
$('.ajax_cart_shipping_cost').parent().find('.unvisible').show();

if (json.total_shipping > 0)
Expand Down Expand Up @@ -980,7 +980,11 @@ function updateCartSummary(json)
else
{
if (json.carrier.id != null || json.free_ship == 1)
{
$('#total_shipping').html(freeShippingTranslation);
if (json.is_virtual_cart)
$('.cart_total_delivery').hide();
}
else if (!hasDeliveryAddress)
$('.cart_total_delivery').hide();
}
Expand Down
2 changes: 1 addition & 1 deletion themes/default-bootstrap/js/modules/blockcart/ajax-cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ var ajaxCart = {
else if (!hasDeliveryAddress)
$('.ajax_cart_shipping_cost').html(toBeDetermined);

if (hasDeliveryAddress)
if (hasDeliveryAddress && !jsonData.isVirtualCart)
$('.ajax_cart_shipping_cost').parent().find('.unvisible').show();

$('.ajax_cart_tax_cost').text(jsonData.taxCost);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"productTotal": {$product_total|json_encode},
"freeShipping": {displayWtPrice|json_encode p=$free_shipping},
"freeShippingFloat": {$free_shipping|json_encode},
"isVirtualCart": {$cart->isVirtualCart()|json_encode},
{if isset($errors) && $errors}
"hasError" : true,
"errors" : [
Expand All @@ -113,4 +114,4 @@
{else}
"hasError" : false
{/if}
{rdelim}
{rdelim}
8 changes: 4 additions & 4 deletions themes/default-bootstrap/modules/blockcart/blockcart.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@
{/if}
<div class="cart-prices">
<div class="cart-prices-line first-line">
<span class="price cart_block_shipping_cost ajax_cart_shipping_cost{if !($page_name == 'order-opc') && $shipping_cost_float == 0 && (!isset($cart->id_address_delivery) || !$cart->id_address_delivery)} unvisible{/if}">
<span class="price cart_block_shipping_cost ajax_cart_shipping_cost{if !($page_name == 'order-opc') && $shipping_cost_float == 0 && (!$cart_qties || $cart->isVirtualCart() || !isset($cart->id_address_delivery) || !$cart->id_address_delivery)} unvisible{/if}">
{if $shipping_cost_float == 0}
{if !($page_name == 'order-opc') && (!isset($cart->id_address_delivery) || !$cart->id_address_delivery)}{l s='To be determined' mod='blockcart'}{else}{l s='Free shipping!' mod='blockcart'}{/if}
{else}
{$shipping_cost}
{/if}
</span>
<span{if !($page_name == 'order-opc') && $shipping_cost_float == 0 && (!isset($cart->id_address_delivery) || !$cart->id_address_delivery)} class="unvisible"{/if}>
<span{if !($page_name == 'order-opc') && $shipping_cost_float == 0 && (!$cart_qties || $cart->isVirtualCart() || !isset($cart->id_address_delivery) || !$cart->id_address_delivery)} class="unvisible"{/if}>
{l s='Shipping' mod='blockcart'}
</span>
</div>
Expand Down Expand Up @@ -279,10 +279,10 @@
</div>
{/if}
<div class="layer_cart_row">
<strong class="dark{if $shipping_cost_float == 0 && (!isset($cart->id_address_delivery) || !$cart->id_address_delivery)} unvisible{/if}">
<strong class="dark{if $shipping_cost_float == 0 && (!$cart_qties || $cart->isVirtualCart() || !isset($cart->id_address_delivery) || !$cart->id_address_delivery)} unvisible{/if}">
{l s='Total shipping' mod='blockcart'}&nbsp;{if $use_taxes && $display_tax_label && $show_tax}{if $priceDisplay == 1}{l s='(tax excl.)' mod='blockcart'}{else}{l s='(tax incl.)' mod='blockcart'}{/if}{/if}
</strong>
<span class="ajax_cart_shipping_cost{if $shipping_cost_float == 0 && (!isset($cart->id_address_delivery) || !$cart->id_address_delivery)} unvisible{/if}">
<span class="ajax_cart_shipping_cost{if $shipping_cost_float == 0 && (!$cart_qties || $cart->isVirtualCart() || !isset($cart->id_address_delivery) || !$cart->id_address_delivery)} unvisible{/if}">
{if $shipping_cost_float == 0}
{if (!isset($cart->id_address_delivery) || !$cart->id_address_delivery)}{l s='To be determined' mod='blockcart'}{else}{l s='Free shipping!' mod='blockcart'}{/if}
{else}
Expand Down
2 changes: 1 addition & 1 deletion themes/default-bootstrap/order-address-advanced.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{/if}
{/foreach}
<h2>{l s='Address(es) Details'}</h2>
{if ((!empty($delivery_option) AND !isset($virtualCart)) OR $delivery->id OR $invoice->id)}
{if ((!empty($delivery_option) AND (!isset($isVirtualCart) || !$isVirtualCart)) OR $delivery->id OR $invoice->id)}
<div class="order_delivery clearfix row">
{if !isset($formattedAddresses) || (count($formattedAddresses.invoice) == 0 && count($formattedAddresses.delivery) == 0) || (count($formattedAddresses.invoice.formated) == 0 && count($formattedAddresses.delivery.formated) == 0)}
{if $delivery->id}
Expand Down
2 changes: 1 addition & 1 deletion themes/default-bootstrap/order-payment-classic.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
{/if}
</td>
</tr>
{if $total_shipping_tax_exc <= 0 && !isset($virtualCart)}
{if $total_shipping_tax_exc <= 0 && (!isset($isVirtualCart) || !$isVirtualCart)}
<tr class="cart_total_delivery">
<td colspan="4" class="text-right">{l s='Total shipping'}</td>
<td colspan="2" class="price" id="total_shipping">{l s='Free Shipping!'}</td>
Expand Down
4 changes: 2 additions & 2 deletions themes/default-bootstrap/shopping-cart-advanced.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
{assign var='rowspan_total' value=$rowspan_total+1}
{/if}

{if $total_shipping_tax_exc <= 0 && !isset($virtualCart)}
{if $total_shipping_tax_exc <= 0 && (!isset($isVirtualCart) || !$isVirtualCart)}
{assign var='rowspan_total' value=$rowspan_total+1}
{else}
{if $use_taxes && $total_shipping_tax_exc != $total_shipping}
Expand Down Expand Up @@ -193,7 +193,7 @@
{/if}
</td>
</tr>
{if $total_shipping_tax_exc <= 0 && !isset($virtualCart)}
{if $total_shipping_tax_exc <= 0 && (!isset($isVirtualCart) || !$isVirtualCart)}
<tr class="cart_total_delivery{if !$opc && (!isset($cart->id_address_delivery) || !$cart->id_address_delivery)} unvisible{/if}">
<td colspan="{$col_span_subtotal}" class="text-right">{l s='Total shipping'}</td>
<td colspan="2" class="price" id="total_shipping">{l s='Free Shipping!'}</td>
Expand Down
7 changes: 3 additions & 4 deletions themes/default-bootstrap/shopping-cart.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
{assign var='rowspan_total' value=$rowspan_total+1}
{/if}

{if $total_shipping_tax_exc <= 0 && !isset($virtualCart)}
{if $total_shipping_tax_exc <= 0 && (!isset($isVirtualCart) || !$isVirtualCart)}
{assign var='rowspan_total' value=$rowspan_total+1}
{else}
{if $use_taxes && $total_shipping_tax_exc != $total_shipping}
Expand Down Expand Up @@ -242,7 +242,7 @@
{/if}
</td>
</tr>
{if $total_shipping_tax_exc <= 0 && !isset($virtualCart)}
{if $total_shipping_tax_exc <= 0 && (!isset($isVirtualCart) || !$isVirtualCart)}
<tr class="cart_total_delivery{if !$opc && (!isset($cart->id_address_delivery) || !$cart->id_address_delivery)} unvisible{/if}">
<td colspan="{$col_span_subtotal}" class="text-right">{l s='Total shipping'}</td>
<td colspan="2" class="price" id="total_shipping">{l s='Free Shipping!'}</td>
Expand Down Expand Up @@ -494,8 +494,7 @@
{$addresses_style.phone_mobile = 'address_phone_mobile'}
{$addresses_style.alias = 'address_title'}
{/if}

{if !$advanced_payment_api && ((!empty($delivery_option) && !isset($virtualCart)) OR $delivery->id || $invoice->id) && !$opc}
{if !$advanced_payment_api && ((!empty($delivery_option) && (!isset($isVirtualCart) || !$isVirtualCart)) OR $delivery->id || $invoice->id) && !$opc}
<div class="order_delivery clearfix row">
{if !isset($formattedAddresses) || (count($formattedAddresses.invoice) == 0 && count($formattedAddresses.delivery) == 0) || (count($formattedAddresses.invoice.formated) == 0 && count($formattedAddresses.delivery.formated) == 0)}
{if $delivery->id}
Expand Down

0 comments on commit 2d932b6

Please sign in to comment.