From a1311dba2d846476fd5e4b02bacf8eaa9fa36f64 Mon Sep 17 00:00:00 2001 From: mDeflotte Date: Thu, 5 Jul 2012 12:40:40 +0000 Subject: [PATCH] [-] BO : #PSCFV-3055 - Part 1 : Improving displaying of resume cart (payment step) [-] BO : #PSCFV-3055 - Part 1 : If there is a rules with free shipping, shipping prices are not displayed git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16234 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/Cart.php | 1 - controllers/front/OrderController.php | 19 +++++-- controllers/front/OrderOpcController.php | 10 ++++ themes/default/css/global.css | 9 ++-- themes/default/order-carrier.tpl | 2 +- themes/default/order-payment.tpl | 54 ++++++++++++------- themes/default/shopping-cart-product-line.tpl | 14 ++--- 7 files changed, 77 insertions(+), 32 deletions(-) diff --git a/classes/Cart.php b/classes/Cart.php index a5199ef97..6669be219 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -2797,7 +2797,6 @@ class CartCore extends ObjectModel 'formattedAddresses' => $formatted_addresses, 'products' => array_values($products), 'gift_products' => $gift_products, - //'products_raw' => $this->getProducts(false), 'discounts' => $cart_rules, 'is_virtual_cart' => (int)$this->isVirtualCart(), 'total_discounts' => $total_discounts, diff --git a/controllers/front/OrderController.php b/controllers/front/OrderController.php index fb9cc3724..b9c1b9be9 100644 --- a/controllers/front/OrderController.php +++ b/controllers/front/OrderController.php @@ -238,7 +238,7 @@ class OrderControllerCore extends ParentOrderController } } - /* + /** * Manage address */ public function processAddress() @@ -328,8 +328,21 @@ class OrderControllerCore extends ParentOrderController parent::_assignCarrier(); // Assign wrapping and TOS $this->_assignWrappingAndTOS(); - - $this->context->smarty->assign('is_guest', (isset($this->context->customer->is_guest) ? $this->context->customer->is_guest : 0)); + + // If a rule offer free-shipping, force hidding shipping prices + $free_shipping = false; + foreach ($this->context->cart->getCartRules() as $rule) + if ($rule['free_shipping']) + { + $free_shipping = true; + break; + } + + $this->context->smarty->assign( + array( + 'free_shipping' => $free_shipping, + 'is_guest' => (isset($this->context->customer->is_guest) ? $this->context->customer->is_guest : 0) + )); } /** diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index d6129d2df..bf50e8441 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -294,8 +294,18 @@ class OrderOpcControllerCore extends ParentOrderController $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true); else $countries = Country::getCountries($this->context->language->id, true); + + // If a rule offer free-shipping, force hidding shipping prices + $free_shipping = false; + foreach ($this->context->cart->getCartRules() as $rule) + if ($rule['free_shipping']) + { + $free_shipping = true; + break; + } $this->context->smarty->assign(array( + 'free_shipping' => $free_shipping, 'isLogged' => $this->isLogged, 'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0, 'countries' => $countries, diff --git a/themes/default/css/global.css b/themes/default/css/global.css index 8fd3d8ff6..aeee4e5da 100644 --- a/themes/default/css/global.css +++ b/themes/default/css/global.css @@ -242,7 +242,8 @@ table.table_block { margin-bottom:20px; width:100%; border:1px solid #999; - border-bottom:none + border-bottom:none; + background:white; } table.std th, table.table_block th { @@ -675,7 +676,7 @@ table#cart_summary td { vertical-align:top } table#cart_summary td.cart_delete, -table#cart_summary td.price_discount_del {border-right:none} +table#cart_summary td.price_discount_del {border-right:none;text-align: center} table#cart_summary .last_item td {border-bottom:1px solid #999} @@ -699,9 +700,11 @@ table#cart_summary tr.customization.even { table#cart_summary tr ul { list-style: none; } -table#cart_summary .cart_product { +table#cart_summary .cart_product { width:80px; text-align:center +}table#cart_summary tbody tr:last-child td { + border-bottom: 1px solid #999; } table#cart_summary .cart_product img {border:1px solid #ccc} table#cart_summary .cart_description { diff --git a/themes/default/order-carrier.tpl b/themes/default/order-carrier.tpl index 5b6aa58c3..8a2c52f34 100644 --- a/themes/default/order-carrier.tpl +++ b/themes/default/order-carrier.tpl @@ -158,7 +158,7 @@
- {if $option.total_price_with_tax} + {if $option.total_price_with_tax && !$free_shipping} {if $use_taxes == 1} {convertPrice price=$option.total_price_with_tax} {l s='(tax incl.)'} {else} diff --git a/themes/default/order-payment.tpl b/themes/default/order-payment.tpl index c441586d1..6cfb2e0fa 100644 --- a/themes/default/order-payment.tpl +++ b/themes/default/order-payment.tpl @@ -64,7 +64,6 @@ {l s='Product'} {l s='Description'} - {l s='Ref.'} {l s='Avail.'} {l s='Unit price'} {l s='Qty'} @@ -75,23 +74,23 @@ {if $use_taxes} {if $priceDisplay} - {if $display_tax_label}{l s='Total products (tax excl.):'}{else}{l s='Total products:'}{/if} + {if $display_tax_label}{l s='Total products (tax excl.):'}{else}{l s='Total products:'}{/if} {displayPrice price=$total_products} {else} - {if $display_tax_label}{l s='Total products (tax incl.):'}{else}{l s='Total products:'}{/if} + {if $display_tax_label}{l s='Total products (tax incl.):'}{else}{l s='Total products:'}{/if} {displayPrice price=$total_products_wt} {/if} {else} - {l s='Total products:'} + {l s='Total products:'} {displayPrice price=$total_products} {/if} - + {if $use_taxes} {if $priceDisplay} {if $display_tax_label}{l s='Total vouchers (tax excl.):'}{else}{l s='Total vouchers:'}{/if} @@ -115,7 +114,7 @@ - + {if $use_taxes} {if $priceDisplay} {if $display_tax_label}{l s='Total gift-wrapping (tax excl.):'}{else}{l s='Total gift-wrapping:'}{/if} @@ -141,18 +140,18 @@ {if $use_taxes} {if $priceDisplay} - {if $display_tax_label}{l s='Total shipping (tax excl.):'}{else}{l s='Total shipping:'}{/if}} + {if $display_tax_label}{l s='Total shipping (tax excl.):'}{else}{l s='Total shipping:'}{/if}} {displayPrice price=$shippingCostTaxExc} {else} - {if $display_tax_label}{l s='Total shipping (tax incl.):'}{else}{l s='Total shipping:'}{/if} + {if $display_tax_label}{l s='Total shipping (tax incl.):'}{else}{l s='Total shipping:'}{/if} {displayPrice price=$shippingCost} {/if} {else} - {l s='Total shipping:'} + {l s='Total shipping:'} {displayPrice price=$shippingCostTaxExc} {/if} @@ -223,6 +222,7 @@ {assign var='quantityDisplayed' value=0} {assign var='cannotModify' value=1} {assign var='odd' value=$product@iteration%2} + {assign var='noDeleteButton' value=1} {* Display the product line *} {include file="$tpl_dir./shopping-cart-product-line.tpl"} {* Then the customized datas ones*} @@ -234,12 +234,25 @@ {if $type == $CUSTOMIZE_FILE}
    - {foreach from=$datas item='picture'}
  • {/foreach} + {foreach from=$datas item='picture'} +
  • + +
  • + {/foreach}
{elseif $type == $CUSTOMIZE_TEXTFIELD} {/if} {/foreach} @@ -287,18 +300,23 @@ {include file="./shopping-cart-product-line.tpl" productLast=$product@last productFirst=$product@first} {/foreach} - {if sizeof($discounts)} + {if count($discounts)} {foreach from=$discounts item=discount name=discountLoop} {$discount.name} {$discount.description} - {l s='Delete'} - - {if $discount.value_real > 0} - {if !$priceDisplay}{displayPrice price=$discount.value_real*-1}{else}{displayPrice price=$discount.value_tax_exc*-1}{/if} - {/if} - + + + {if $discount.value_real > 0} + {if !$priceDisplay} + {displayPrice price=$discount.value_real*-1} + {else} + {displayPrice price=$discount.value_tax_exc*-1} + {/if} + {/if} + + {/foreach} diff --git a/themes/default/shopping-cart-product-line.tpl b/themes/default/shopping-cart-product-line.tpl index cedc291a1..38874eb0b 100644 --- a/themes/default/shopping-cart-product-line.tpl +++ b/themes/default/shopping-cart-product-line.tpl @@ -93,11 +93,13 @@ {/if} - - {if (!isset($customizedDatas.$productId.$productAttributeId) OR $quantityDisplayed) > 0 && empty($product.gift)} -
- {l s='Delete'} -
+ {if !isset($noDeleteButton) || !$noDeleteButton} + + {if (!isset($customizedDatas.$productId.$productAttributeId) OR $quantityDisplayed) > 0 && empty($product.gift)} +
+ {l s='Delete'} +
+ {/if} + {/if} -