// BugFix id_carrier in cart not defined + choosing address delivery for multishiping on opc

This commit is contained in:
mDeflotte
2011-11-22 09:28:22 +00:00
parent 5ad28daf47
commit 415619f50e
9 changed files with 271 additions and 166 deletions
+45
View File
@@ -734,3 +734,48 @@ $(function() {
});
});
function multishippingMode(it)
{
if (!$(it).hasClass('on'))
{
$('#address_delivery').hide();
$('#address_invoice').removeClass('alternate_item').addClass('item');
$(it).addClass('on');
$('#link_multishipping_form').show();
$('#link_multishipping_form').fancybox({
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'type' : 'ajax',
'onClosed' : function()
{
// Relaod the cart
$.ajax({
url: orderOpcUrl,
data: 'ajax=true&method=cartReload',
dataType : 'html',
success: function(data) {
$('#cart_summary').replaceWith($(data).find('#cart_summary'));
}
})
updateCarrierSelectionAndGift();
},
'onStart' : function()
{
// Removing all ids on the cart to avoid conflic with the new one on the fancybox
// This action could "break" the cart design, if css rules use ids of the cart
$.each($('#cart_summary *'), function(it, el) {
$(el).attr('id', '');
});
}
});
}
else
{
$('#address_delivery').show();
$('#address_invoice').removeClass('item').addClass('alternate_item');
$(it).removeClass('on');
$('#link_multishipping_form').hide();
}
}
@@ -0,0 +1,101 @@
{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<p>{l s='Choose the delivery addresses:'}</p>
<div id="order-detail-content" class="table_block">
<table id="cart_summary" class="std">
<thead>
<tr>
<th class="cart_product first_item">{l s='Product'}</th>
<th class="cart_description item">{l s='Description'}</th>
<th class="cart_ref item">{l s='Ref.'}</th>
<th class="cart_quantity item">{l s='Qty'}</th>
<th class="shipping_address last_item">{l s='Shipping address'}</th>
</tr>
</thead>
<tbody>
{foreach from=$products item=product name=productLoop}
{assign var='productId' value=$product.id_product}
{assign var='productAttributeId' value=$product.id_product_attribute}
{assign var='quantityDisplayed' value=0}
{* Display the product line *}
{include file="$tpl_dir./order-address-product-line.tpl" productLast=$smarty.foreach.productLoop.last productFirst=$smarty.foreach.productLoop.first}
{* Then the customized datas ones*}
{if isset($customizedDatas.$productId.$productAttributeId)}
{foreach from=$customizedDatas.$productId.$productAttributeId[$product.id_address_delivery] key='id_customization' item='customization'}
<tr id="product_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" class="product_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval} alternate_item cart_item">
<td colspan="4">
{foreach from=$customization.datas key='type' item='datas'}
{if $type == $CUSTOMIZE_FILE}
<div class="customizationUploaded">
<ul class="customizationUploaded">
{foreach from=$datas item='picture'}<li><img src="{$pic_dir}{$picture.value}_small" alt="" class="customizationUploaded" /></li>{/foreach}
</ul>
</div>
{elseif $type == $CUSTOMIZE_TEXTFIELD}
<ul class="typedText">
{foreach from=$datas item='textField' name='typedText'}<li>{if $textField.name}{$textField.name}{else}{l s='Text #'}{$smarty.foreach.typedText.index+1}{/if}{l s=':'} {$textField.value}</li>{/foreach}
</ul>
{/if}
{/foreach}
</td>
<td class="cart_quantity">
{if isset($cannotModify) AND $cannotModify == 1}
<span style="float:left">{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}</span>
{else}
<div style="float:right">
<a rel="nofollow" class="cart_quantity_delete" id="{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "delete&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_customization={$id_customization}&amp;id_address_delivery={$product.id_address_delivery}&amp;token={$token_cart}")}"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete'}" title="{l s='Delete this customization'}" width="11" height="13" class="icon" /></a>
</div>
<div id="cart_quantity_button" style="float:left">
<a rel="nofollow" class="cart_quantity_up" id="cart_quantity_up_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "add&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery}&amp;id_customization={$id_customization}&amp;token={$token_cart}")}" title="{l s='Add'}"><img src="{$img_dir}icon/quantity_up.gif" alt="{l s='Add'}" width="14" height="9" /></a><br />
{if $product.minimal_quantity < ($customization.quantity -$quantityDisplayed) OR $product.minimal_quantity <= 1}
<a rel="nofollow" class="cart_quantity_down" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "add&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery}&amp;id_customization={$id_customization}&amp;op=down&amp;token={$token_cart}")}" title="{l s='Subtract'}">
<img src="{$img_dir}icon/quantity_down.gif" alt="{l s='Subtract'}" width="14" height="9" />
</a>
{else}
<a class="cart_quantity_down" style="opacity: 0.3;" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" href="#" title="{l s='Subtract'}">
<img src="{$img_dir}icon/quantity_down.gif" alt="{l s='Subtract'}" width="14" height="9" />
</a>
{/if}
</div>
<input type="hidden" value="{$customization.quantity}" name="quantity_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}_hidden"/>
<input size="2" type="text" value="{$customization.quantity}" class="cart_quantity_input" name="quantity_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}"/>
{/if}
</td>
<td class="cart_total"></td>
</tr>
{assign var='quantityDisplayed' value=$quantityDisplayed+$customization.quantity}
{/foreach}
{* If it exists also some uncustomized products *}
{if $product.quantity-$quantityDisplayed > 0}
{include file="$tpl_dir./order-address-product-line.tpl" productLast=$smarty.foreach.productLoop.last productFirst=$smarty.foreach.productLoop.first}
{/if}
{/if}
{/foreach}
</tbody>
</table>
</div>
@@ -152,82 +152,7 @@
{include file="$tpl_dir./order-steps.tpl"}
{include file="$tpl_dir./errors.tpl"}
<p>{l s='Choose the delivery addresses:'}</p>
<div id="order-detail-content" class="table_block">
<table id="cart_summary" class="std">
<thead>
<tr>
<th class="cart_product first_item">{l s='Product'}</th>
<th class="cart_description item">{l s='Description'}</th>
<th class="cart_ref item">{l s='Ref.'}</th>
<th class="cart_quantity item">{l s='Qty'}</th>
<th class="shipping_address last_item">{l s='Shipping address'}</th>
</tr>
</thead>
<tbody>
{foreach from=$products item=product name=productLoop}
{assign var='productId' value=$product.id_product}
{assign var='productAttributeId' value=$product.id_product_attribute}
{assign var='quantityDisplayed' value=0}
{* Display the product line *}
{include file="$tpl_dir./order-address-product-line.tpl" productLast=$smarty.foreach.productLoop.last productFirst=$smarty.foreach.productLoop.first}
{* Then the customized datas ones*}
{if isset($customizedDatas.$productId.$productAttributeId)}
{foreach from=$customizedDatas.$productId.$productAttributeId[$product.id_address_delivery] key='id_customization' item='customization'}
<tr id="product_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" class="product_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval} alternate_item cart_item">
<td colspan="4">
{foreach from=$customization.datas key='type' item='datas'}
{if $type == $CUSTOMIZE_FILE}
<div class="customizationUploaded">
<ul class="customizationUploaded">
{foreach from=$datas item='picture'}<li><img src="{$pic_dir}{$picture.value}_small" alt="" class="customizationUploaded" /></li>{/foreach}
</ul>
</div>
{elseif $type == $CUSTOMIZE_TEXTFIELD}
<ul class="typedText">
{foreach from=$datas item='textField' name='typedText'}<li>{if $textField.name}{$textField.name}{else}{l s='Text #'}{$smarty.foreach.typedText.index+1}{/if}{l s=':'} {$textField.value}</li>{/foreach}
</ul>
{/if}
{/foreach}
</td>
<td class="cart_quantity">
{if isset($cannotModify) AND $cannotModify == 1}
<span style="float:left">{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}</span>
{else}
<div style="float:right">
<a rel="nofollow" class="cart_quantity_delete" id="{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "delete&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_customization={$id_customization}&amp;id_address_delivery={$product.id_address_delivery}&amp;token={$token_cart}")}"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete'}" title="{l s='Delete this customization'}" width="11" height="13" class="icon" /></a>
</div>
<div id="cart_quantity_button" style="float:left">
<a rel="nofollow" class="cart_quantity_up" id="cart_quantity_up_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "add&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery}&amp;id_customization={$id_customization}&amp;token={$token_cart}")}" title="{l s='Add'}"><img src="{$img_dir}icon/quantity_up.gif" alt="{l s='Add'}" width="14" height="9" /></a><br />
{if $product.minimal_quantity < ($customization.quantity -$quantityDisplayed) OR $product.minimal_quantity <= 1}
<a rel="nofollow" class="cart_quantity_down" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "add&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_address_delivery={$product.id_address_delivery}&amp;id_customization={$id_customization}&amp;op=down&amp;token={$token_cart}")}" title="{l s='Subtract'}">
<img src="{$img_dir}icon/quantity_down.gif" alt="{l s='Subtract'}" width="14" height="9" />
</a>
{else}
<a class="cart_quantity_down" style="opacity: 0.3;" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}" href="#" title="{l s='Subtract'}">
<img src="{$img_dir}icon/quantity_down.gif" alt="{l s='Subtract'}" width="14" height="9" />
</a>
{/if}
</div>
<input type="hidden" value="{$customization.quantity}" name="quantity_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}_hidden"/>
<input size="2" type="text" value="{$customization.quantity}" class="cart_quantity_input" name="quantity_{$product.id_product}_{$product.id_product_attribute}_{$id_customization}_{$product.id_address_delivery|intval}"/>
{/if}
</td>
<td class="cart_total"></td>
</tr>
{assign var='quantityDisplayed' value=$quantityDisplayed+$customization.quantity}
{/foreach}
{* If it exists also some uncustomized products *}
{if $product.quantity-$quantityDisplayed > 0}
{include file="$tpl_dir./order-address-product-line.tpl" productLast=$smarty.foreach.productLoop.last productFirst=$smarty.foreach.productLoop.first}
{/if}
{/if}
{/foreach}
</tbody>
</table>
</div>
{include file="$tpl_dir./order-address-multishipping-products.tpl"}
<form action="{$link->getPageLink('order', true, NULL, 'multi-shipping=1')}" method="post">
{else}
+8
View File
@@ -171,6 +171,14 @@
</div>
<form action="{$link->getPageLink($back_order_page, true)}" method="post">
{else}
<div class="address-form-multishipping">
<a href="#" id="multishipping_mode" title="{l s='Multi-shipping'}" class="button exclusive" onclick="multishippingMode(this); return false;">
{l s='Multi-shipping'}
</a>
<a href="{$link->getPageLink('order-opc', true, NULL, 'ajax=1&multi-shipping=1&method=multishipping')}" id="link_multishipping_form" title="{l s='Choose the delivery addresses'}" class="button exclusive" style="display:none">
{l s='Choose the delivery addresses'}
</a>
</div>
<div id="opc_account" class="opc-main-block">
<div id="opc_account-overlay" class="opc-overlay" style="display: none;"></div>
{/if}
+71 -69
View File
@@ -113,81 +113,83 @@
</p>
{/if}
<div class="delivery_options_address">
{foreach $delivery_option_list as $id_address => $option_list}
<h3>{$address_collection[$id_address]->alias}</h3>
<div class="delivery_options">
{foreach $option_list as $key => $option}
<div class="delivery_option {if ($option@index % 2)}alternate_{/if}item">
<input class="delivery_option_radio" type="radio" name="delivery_option[{$id_address}]" {if $opc}onclick="updateCarrierSelectionAndGift();"{/if} id="delivery_option_{$id_address}_{$option@index}" value="{$key}" />
<label for="delivery_option_{$id_address}_{$option@index}">
<table class="resume">
<tr>
<td class="delivery_option_logo">
{* If there is only one carrier, show the logo of the carrier *}
{if $option.unique_carrier}
{foreach $option.carrier_list as $carrier}
{if isset($delivery_option_list)}
{foreach $delivery_option_list as $id_address => $option_list}
<h3>{$address_collection[$id_address]->alias}</h3>
<div class="delivery_options">
{foreach $option_list as $key => $option}
<div class="delivery_option {if ($option@index % 2)}alternate_{/if}item">
<input class="delivery_option_radio" type="radio" name="delivery_option[{$id_address}]" {if $opc}onclick="updateCarrierSelectionAndGift();"{/if} id="delivery_option_{$id_address}_{$option@index}" value="{$key}" />
<label for="delivery_option_{$id_address}_{$option@index}">
<table class="resume">
<tr>
<td class="delivery_option_logo">
{* If there is only one carrier, show the logo of the carrier *}
{if $option.unique_carrier}
{foreach $option.carrier_list as $carrier}
{if $carrier.logo}
<img src="{$carrier.logo}" alt="{$carrier.instance->name}"/>
{else}
{$carrier.instance->name}
{/if}
{/foreach}
{else}
{$carrier.instance->name}
{/if}
</td>
<td>
{if $option.is_best_grade}
{if $option.is_best_price}
<div class="delivery_option_best delivery_option_icon">{l s="The best price and grade"}</div>
{else}
<div class="delivery_option_fast delivery_option_icon">{l s="The faster"}</div>
{/if}
{else}
{if $option.is_best_price}
<div class="delivery_option_best_price delivery_option_icon">{l s="The best price"}</div>
{/if}
{/if}
</td>
<td>
<div class="delivery_option_price">
{if $option.total_price_with_tax}
{if $use_taxes == 1}
{convertPrice price=$option.total_price_with_tax} {l s='(tax incl.)'}
{else}
{convertPrice price=$option.total_price_without_tax} {l s='(tax excl.)'}
{/if}
{else}
{l s='Free!'}
{/if}
</div>
</td>
</tr>
</table>
<table class="delivery_option_carrier">
{foreach $option.carrier_list as $carrier}
<tr>
<td>
{if $carrier.logo}
<img src="{$carrier.logo}" alt="{$carrier.instance->name}"/>
{else}
{$carrier.instance->name}
{/if}
{/foreach}
{else}
{$carrier.instance->name}
{/if}
</td>
<td>
{if $option.is_best_grade}
{if $option.is_best_price}
<div class="delivery_option_best delivery_option_icon">{l s="The best price and grade"}</div>
{else}
<div class="delivery_option_fast delivery_option_icon">{l s="The faster"}</div>
{/if}
{else}
{if $option.is_best_price}
<div class="delivery_option_best_price delivery_option_icon">{l s="The best price"}</div>
{/if}
{/if}
</td>
<td>
<div class="delivery_option_price">
{if $option.total_price_with_tax}
{if $use_taxes == 1}
{convertPrice price=$option.total_price_with_tax} {l s='(tax incl.)'}
{else}
{convertPrice price=$option.total_price_without_tax} {l s='(tax excl.)'}
{/if}
{else}
{l s='Free!'}
{/if}
</div>
</td>
</tr>
</table>
<table class="delivery_option_carrier">
{foreach $option.carrier_list as $carrier}
<tr>
</td>
<td>
{if $carrier.logo}
<img src="{$carrier.logo}" alt="{$carrier.instance->name}"/>
{/if}
</td>
<td>
{$carrier.instance->name}
</td>
<td>
{if isset($carrier.instance->delay[$cookie->id_lang])}
{$carrier.instance->delay[$cookie->id_lang]}
{/if}
</td>
</tr>
{/foreach}
</table>
</label>
{$carrier.instance->name}
</td>
<td>
{if isset($carrier.instance->delay[$cookie->id_lang])}
{$carrier.instance->delay[$cookie->id_lang]}
{/if}
</td>
</tr>
{/foreach}
</table>
</label>
</div>
{/foreach}
</div>
{/foreach}
</div>
{/foreach}
{/if}
</div>
<div style="display: none;" id="extra_carrier"></div>