Jump to content

Confirmation de livraison


lordbdp

Recommended Posts

Bonjour,

 

Je suis à la recherche d'un module de confirmation de livraison nommé MailDate, il permet au client de confirmer la réception de sa commande dans son historique. J'ai beau chercher sur le net, impossible de mettre la main dessus....

 

Si quelqu'un sait où l'obtenir je suis preneur.

 

Merci d'avance.

Link to comment
Share on other sites

C'est une couche de service qualité en plus pour le marchand, le client valide la réception de sa commande afin de l'impliquer dans le process. Ce qui permet d'avoir un gage de qualité.

 

Avant de choisir de valider la réception :

yI9y2d.png

 

Quand on choisit de valider la réception :

1ifa2c.png

 

Je pense que ce module peut être intéressant surtout si on arrive à lui ajouter la possibilité de faire bénéficier aux clients qui valident la réception d'une réduction ou d'un cadeau en contre-partie.

Link to comment
Share on other sites

  • 2 weeks later...

Très honnêtement, j'ai déjà pu voir ce type de fonctionnalité sur plusieurs sites e-commerce (dont un gros, sans cité de nom) et je trouve ça - en tant que client, mais également en tant que marchand - sympa. Le client participe, il en profite également pour laisser un feedback.

 

Lorsque nous avons lancé ce système dans une enseigne physique (vendant également online), je sais que cela avait pas mal plus au client, et on ne pouvait pas faire via le lien de suivi: il s'agissait de colis sans traçage, ;-)

Link to comment
Share on other sites

C'est ce que je voudrais en effet mettre en place.

Un développeur serait-il intéressé pour nous concocter ça via un module ou un Override ?

Où au moins nous dire commet faire, après seulement on lui demandera de l'aide si on bloque ^^.

 

J'ai demandé au webmaster du site où je l'ai vu mais pas de réponse de sa part pour l'instant...

Edited by lordbdp (see edit history)
Link to comment
Share on other sites

Je viens de l'intégrer sur mon site.

 

Ca fonctionne bien, j'ai juste modifier l'overide et le if d'affichage du bouton pour afficher le button sur les statut de commande 'En cours de préparation' et 'Expédier'

 

En rajoutant un test sur l'id 3 de l'état de la commande

 

De plus dans l'overide il faut modifier le :

if($order->getCurrentState() = 4)

en

if($order->getCurrentState() == 4)

Il me reste juste à régler un léger problème qui n'en ai pas un en fait lol

Il faudrait réussir à recharger le tableau listant les commandes afin de mettre le statut de la commande à jour directement dans la liste des commandes, je regarderais ca demain.

Edited by totoche33 (see edit history)
  • Like 1
Link to comment
Share on other sites

Je viens de finir les modifs pour le passage du statut en livré directement dans le tableau listant les commandes, j'ai fait ca rapidement, donc on peut surement mieux faire.

 

Dans le fichier history.tpl chercher :

 

<td data-value="{$order.id_order_state}" class="history_state">
							{if isset($order.order_state)}
								<span class="label{if $order.id_order_state == 1 || $order.id_order_state == 10 || $order.id_order_state == 11} label-info{elseif $order.id_order_state == 5 || $order.id_order_state == 2 || $order.id_order_state == 12} label-success{elseif $order.id_order_state == 6 || $order.id_order_state == 7 || $order.id_order_state == 8} label-danger{elseif $order.id_order_state == 3 || $order.id_order_state == 9 || $order.id_order_state == 4} label-warning{/if}" {if $order.id_order_state > 12}style="background-color:{$order.order_state_color}id="etatorder-{$order.id_order}";"{/if}>
									{$order.order_state|escape:'html':'UTF-8'}
								</span>
							{/if}
</td>

et rajouté juste un 

id="etatorder-{$order.id_order}"

ca donne ca :

<td data-value="{$order.id_order_state}" class="history_state">
							{if isset($order.order_state)}
								<span class="label{if $order.id_order_state == 1 || $order.id_order_state == 10 || $order.id_order_state == 11} label-info{elseif $order.id_order_state == 5 || $order.id_order_state == 2 || $order.id_order_state == 12} label-success{elseif $order.id_order_state == 6 || $order.id_order_state == 7 || $order.id_order_state == 8} label-danger{elseif $order.id_order_state == 3 || $order.id_order_state == 9 || $order.id_order_state == 4} label-warning{/if}" {if $order.id_order_state > 12}style="background-color:{$order.order_state_color};"{/if} id="etatorder-{$order.id_order}">
									{$order.order_state|escape:'html':'UTF-8'}
								</span>
							{/if}
						</td>

Dans le fichier history.js chercher

 

$('form#markAsReceived').submit(function(){
return markAsReceived();
});

et remplacer par 

$('form#markAsReceived').submit(function(){


monid = $("#monidorder").val();


return markAsReceived(monid);
});

pour finir toujours dans le fichier history.js chercher :

function markAsReceived()
{
	paramString = "ajax=true";
	$('#markAsReceived').find('input').each(function(){
		paramString += '&' + $(this).attr('name') + '=' + encodeURIComponent($(this).val());
	});
	$.ajax({
		type: "POST",
		headers: { "cache-control": "no-cache" },
		url: $('#markAsReceived').attr("action") + '?rand=' + new Date().getTime(),
		data: paramString,
		success: function (msg){
			$('#block-order-detail').fadeOut('slow', function() {
				$(this).html(msg);
				$(this).find('#markAsReceivedBtn').fadeOut;
				$(this).fadeIn('slow');
			});
		}
	});
	return false;
}

et le remplacer par 

function markAsReceived(id)
{
	paramString = "ajax=true";
	$('#markAsReceived').find('input').each(function(){
		paramString += '&' + $(this).attr('name') + '=' + encodeURIComponent($(this).val());
	});
	$.ajax({
		type: "POST",
		headers: { "cache-control": "no-cache" },
		url: $('#markAsReceived').attr("action") + '?rand=' + new Date().getTime(),
		data: paramString,
		success: function (msg){
			$('#block-order-detail').fadeOut('slow', function() {
				$(this).html(msg);
				$(this).find('#markAsReceivedBtn').fadeOut;
				$(this).fadeIn('slow');

				$("#etatorder-"+id).removeClass('label-warning');
				$("#etatorder-"+id).addClass('label-success');
				$("#etatorder-"+id).html('Livré');

			});
		}
	});
	return false;
}

De plus en presta 1.6 le message de retour de l'action sur le bouton n'été pas propre pour le mettre sous la forme d'un message de validation 

 

cherchez : 

{if isset($receipt_confirmation) && $receipt_confirmation}
    <p class="success">
        {l s='Thank you for your feedback!'}
    </p>
{/if}

Remplassez par :

{if isset($receipt_confirmation) && $receipt_confirmation}
<div class="alert alert-success">
	{l s='Thank you for your feedback!'}
</div>
{/if}
Link to comment
Share on other sites

:(  Pas de nouveautés sur le site au final, j'ai suivi la procédure mais le nouveau bouton ne s'affiche pas.

De plus je ne peux réaliser tes modifs Totoche33, je suis sous PS 1.5.6 et mon history.tpl n'est pas du tout pareil...

 

C'est pö juste ! :(

Link to comment
Share on other sites

History.tpl

{*
* 2007-2013 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 [email protected] 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 <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}

{capture name=path}<a href="{$link->getPageLink('my-account', true)}">{l s='My account'}</a><span class="navigation-pipe">{$navigationPipe}</span>{l s='Order history'}{/capture}
{include file="$tpl_dir./breadcrumb.tpl"}
{include file="$tpl_dir./errors.tpl"}

<h1>{l s='Order history'}</h1>
<p>{l s='Here are the orders you\'ve placed since your account was created.'}</p>

{if $slowValidation}<p class="warning">{l s='If you have just placed an order, it may take a few minutes for it to be validated. Please refresh this page if your order is missing.'}</p>{/if}

<div class="block-center" id="block-history">
	{if $orders && count($orders)}
	<table id="order-list" class="std">
		<thead>
			<tr>
				<th class="first_item">{l s='Order reference'}</th>
				<th class="item">{l s='Date'}</th>
				<th class="item">{l s='Total price'}</th>
				<th class="item">{l s='Payment: '}</th>
				<th class="item">{l s='Status'}</th>
				<th class="item">{l s='Invoice'}</th>
				<th class="last_item" style="width:65px"> </th>
			</tr>
		</thead>
		<tbody>
		{foreach from=$orders item=order name=myLoop}
			<tr class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if} {if $smarty.foreach.myLoop.index % 2}alternate_item{/if}">
				<td class="history_link bold">
					{if isset($order.invoice) && $order.invoice && isset($order.virtual) && $order.virtual}<img src="{$img_dir}icon/download_product.gif" class="icon" alt="{l s='Products to download'}" title="{l s='Products to download'}" />{/if}
					<a class="color-myaccount" href="javascript:showOrder(1, {$order.id_order|intval}, '{$link->getPageLink('order-detail', true)}');">{Order::getUniqReferenceOf($order.id_order)}</a>
				</td>
				<td class="history_date bold">{dateFormat date=$order.date_add full=0}</td>
				<td class="history_price"><span class="price">{displayPrice price=$order.total_paid currency=$order.id_currency no_utf8=false convert=false}</span></td>
				<td class="history_method">{$order.payment|escape:'htmlall':'UTF-8'}</td>
				<td class="history_state">{if isset($order.order_state)}{$order.order_state|escape:'htmlall':'UTF-8'}{/if}</td>
				<td class="history_invoice">
				{if (isset($order.invoice) && $order.invoice && isset($order.invoice_number) && $order.invoice_number) && isset($invoiceAllowed) && $invoiceAllowed == true}
					<a href="{$link->getPageLink('pdf-invoice', true, NULL, "id_order={$order.id_order}")}" title="{l s='Invoice'}" class="_blank"><img src="{$img_dir}icon/pdf.gif" alt="{l s='Invoice'}" class="icon" /></a>
					<a href="{$link->getPageLink('pdf-invoice', true, NULL, "id_order={$order.id_order}")}" title="{l s='Invoice'}" class="_blank">{l s='PDF'}</a>
				{else}-{/if}
				</td>
				<td class="history_detail">
					<a class="color-myaccount" href="javascript:showOrder(1, {$order.id_order|intval}, '{$link->getPageLink('order-detail', true)}');">{l s='details'}</a>
					{if isset($opc) && $opc}
					<a href="{$link->getPageLink('order-opc', true, NULL, "submitReorder&id_order={$order.id_order}")}" title="{l s='Reorder'}">
					{else}
					<a href="{$link->getPageLink('order', true, NULL, "submitReorder&id_order={$order.id_order}")}" title="{l s='Reorder'}">
					{/if}
						<img src="{$img_dir}arrow_rotate_anticlockwise.png" alt="{l s='Reorder'}" title="{l s='Reorder'}" class="icon" />
					</a>
				</td>
			</tr>
		{/foreach}
		</tbody>
	</table>
	<div id="block-order-detail" class="hidden"> </div>
	{else}
		<p class="warning">{l s='You have not placed any orders.'}</p>
	{/if}
</div>

<ul class="footer_links clearfix">
	<li><a href="{$link->getPageLink('my-account', true)}"><img src="{$img_dir}icon/my-account.gif" alt="" class="icon" /> {l s='Back to Your Account'}</a></li>
	<li class="f_right"><a href="{$base_dir}"><img src="{$img_dir}icon/home.gif" alt="" class="icon" /> {l s='Home'}</a></li>
</ul>

history.js

/*
* 2007-2013 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 [email protected] 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 <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/

//show the order-details with ajax
function showOrder(mode, var_content, file)
{
	$.get(
		file,
		((mode === 1) ? {'id_order': var_content, 'ajax': true} : {'id_order_return': var_content, 'ajax': true}),
		function(data)
		{
			$('#block-order-detail').fadeOut('slow', function()
			{
				$(this).html(data);
				/* if return is allowed*/
				if ($('#order-detail-content .order_cb').length > 0)
				{
					//return slip : check or uncheck every checkboxes
					$('#order-detail-content th input[type=checkbox]').click(function()
					{
							$('#order-detail-content td input[type=checkbox]').each(function()
							{
								this.checked = $('#order-detail-content th input[type=checkbox]').is(':checked');
								updateOrderLineDisplay(this);
							});
					});
					//return slip : enable or disable 'global' quantity editing
					$('#order-detail-content td input[type=checkbox]').click(function()
					{
						updateOrderLineDisplay(this);
					});
					//return slip : limit quantities
					$('#order-detail-content td .order_qte_input').keyup(function()
					{
						var maxQuantity = parseInt($(this).parent().find('.order_qte_span').text());
						var quantity = parseInt($(this).val());
						if (isNaN($(this).val()) && $(this).val() !== '')
						{
							$(this).val(maxQuantity);
						}
						else
						{
							if (quantity > maxQuantity)
								$(this).val(maxQuantity);
							else if (quantity < 1)
								$(this).val(1);
						}
					});
				}
				//catch the submit event of sendOrderMessage form
				$('form#sendOrderMessage').submit(function(){
					return sendOrderMessage();
				});
				$('form#markAsReceived').submit(function(){
					return markAsReceived();
				});
			$(this).fadeIn('slow', function() {
				$.scrollTo(this, 1200);
				resizeAddressesBox();
			});
		});
	});
}

function updateOrderLineDisplay(domCheckbox)
{
	var lineQuantitySpan = $(domCheckbox).parent().parent().find('.order_qte_span');
	var lineQuantityInput = $(domCheckbox).parent().parent().find('.order_qte_input');
	if($(domCheckbox).is(':checked'))
	{
		lineQuantitySpan.hide();
		lineQuantityInput.show();
	}
	else
	{
		lineQuantityInput.hide();
		lineQuantityInput.val(lineQuantitySpan.text());
		lineQuantitySpan.show();
	}
}

//send a message in relation to the order with ajax
function sendOrderMessage()
{
	paramString = "ajax=true";
	$('#sendOrderMessage').find('input, textarea, select').each(function(){
		paramString += '&' + $(this).attr('name') + '=' + encodeURIComponent($(this).val());
	});

	$.ajax({
		type: "POST",
		headers: { "cache-control": "no-cache" },
		url: $('#sendOrderMessage').attr("action") + '?rand=' + new Date().getTime(),
		data: paramString,
		success: function (msg){
			$('#block-order-detail').fadeOut('slow', function() {
				$(this).html(msg);
				//catch the submit event of sendOrderMessage form
				$('#sendOrderMessage').submit(function(){
					return sendOrderMessage();
				});
				$(this).fadeIn('slow');
			});
		}
	});
	return false;
}

function markAsReceived()
{
    paramString = "ajax=true";
    $('#markAsReceived').find('input').each(function(){
        paramString += '&' + $(this).attr('name') + '=' + encodeURIComponent($(this).val());
    });
    $.ajax({
        type: "POST",
        headers: { "cache-control": "no-cache" },
        url: $('#markAsReceived').attr("action") + '?rand=' + new Date().getTime(),
        data: paramString,
        success: function (msg){
            $('#block-order-detail').fadeOut('slow', function() {
                $(this).html(msg);
                //catch the submit event of sendOrderMessage form
                 
                $(this).find('#markAsReceivedBtn').fadeOut;
                $(this).fadeIn('slow');
            });
        }
    });
    return false;
}

order-detail.tpl

{*
* 2007-2013 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 [email protected] 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 <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}

<form action="{if isset($opc) && $opc}{$link->getPageLink('order-opc', true)}{else}{$link->getPageLink('order', true)}{/if}" method="post" class="submit">
	<div>
		<input type="hidden" value="{$order->id}" name="id_order"/>
		<p class="title_block">
			<input type="submit" value="{l s='Reorder'}" name="submitReorder" class="button exclusive" />
			{l s='Order Reference %s - placed on' sprintf=$order->getUniqReference()} {dateFormat date=$order->date_add full=0}
		</p>
	</div>
</form>

<div class="info-order">
{if $carrier->id}<p><strong>{l s='Carrier'}</strong> {if $carrier->name == "0"}{$shop_name|escape:'htmlall':'UTF-8'}{else}{$carrier->name|escape:'htmlall':'UTF-8'}{/if}</p>{/if}
<p><strong>{l s='Payment method'}</strong> <span class="color-myaccount">{$order->payment|escape:'htmlall':'UTF-8'}</span></p>
{if $invoice AND $invoiceAllowed}
<p>
	<img src="{$img_dir}icon/pdf.gif" alt="" class="icon" />
	<a target="_blank" href="{$link->getPageLink('pdf-invoice', true)}?id_order={$order->id|intval}{if $is_guest}&secure_key={$order->secure_key}{/if}">{l s='Download your invoice as a PDF file.'}</a>
</p>
{/if}
{if $order->recyclable}
<p><img src="{$img_dir}icon/recyclable.gif" alt="" class="icon" /> {l s='You have given permission to receive your order in recycled packaging.'}</p>
{/if}
{if $order->gift}
	<p><img src="{$img_dir}icon/gift.gif" alt="" class="icon" /> {l s='You have requested gift wrapping for this order.'}</p>
	<p>{l s='Message'} {$order->gift_message|nl2br}</p>
{/if}
</div>

{if count($order_history)}
<h3>{l s='Follow your order\'s status step-by-step'}</h3>
{if isset($receipt_confirmation) && $receipt_confirmation}
    <p class="success">
        {l s='Thank you for your feedback!'}
    </p>
{/if}
{if $order_history.0.id_order_state == 4}
    <form action="{$link->getPageLink('order-detail', true)|escape:'html'}" method="post" class="std" id="markAsReceived">
        <input type="hidden" class="hidden" value="{$order->id|intval}" name="id_order" />
        <input type="submit" class="exclusive" name="markAsReceived" id="markAsReceivedBtn" value="{l s='I have received this order'}">
        <p class="clear"></p>
    </form>
 
{/if}
<div class="table_block">
	<table class="detail_step_by_step std">
		<thead>
			<tr>
				<th class="first_item">{l s='Date'}</th>
				<th class="last_item">{l s='Status'}</th>
			</tr>
		</thead>
		<tbody>
		{foreach from=$order_history item=state name="orderStates"}
			<tr class="{if $smarty.foreach.orderStates.first}first_item{elseif $smarty.foreach.orderStates.last}last_item{/if} {if $smarty.foreach.orderStates.index % 2}alternate_item{else}item{/if}">
				<td>{dateFormat date=$state.date_add full=1}</td>
				<td>{$state.ostate_name|escape:'htmlall':'UTF-8'}</td>
			</tr>
		{/foreach}
		</tbody>
	</table>
</div>
{/if}

{if isset($followup)}
<p class="bold">{l s='Click the following link to track the delivery of your order'}</p>
<a href="{$followup|escape:'htmlall':'UTF-8'}">{$followup|escape:'htmlall':'UTF-8'}</a>
{/if}

<div class="adresses_bloc clearfix">
<br />
<ul class="address item {if $order->isVirtual()}full_width{/if}">
	<li class="address_title">{l s='Billing'}</li>
	{foreach from=$inv_adr_fields name=inv_loop item=field_item}
		{if $field_item eq "company" && isset($address_invoice->company)}<li class="address_company">{$address_invoice->company|escape:'htmlall':'UTF-8'}</li>
		{elseif $field_item eq "address2" && $address_invoice->address2}<li class="address_address2">{$address_invoice->address2|escape:'htmlall':'UTF-8'}</li>
		{elseif $field_item eq "phone_mobile" && $address_invoice->phone_mobile}<li class="address_phone_mobile">{$address_invoice->phone_mobile|escape:'htmlall':'UTF-8'}</li>
		{else}
				{assign var=address_words value=" "|explode:$field_item}
				<li>{foreach from=$address_words item=word_item name="word_loop"}{if !$smarty.foreach.word_loop.first} {/if}<span class="address_{$word_item|replace:',':''}">{$invoiceAddressFormatedValues[$word_item|replace:',':'']|escape:'htmlall':'UTF-8'}</span>{/foreach}</li>
		{/if}

	{/foreach}
</ul>
<ul class="address alternate_item" {if $order->isVirtual()}style="display:none;"{/if}>
	<li class="address_title">{l s='Delivery'}</li>
	{foreach from=$dlv_adr_fields name=dlv_loop item=field_item}
		{if $field_item eq "company" && isset($address_delivery->company)}<li class="address_company">{$address_delivery->company|escape:'htmlall':'UTF-8'}</li>
		{elseif $field_item eq "address2" && $address_delivery->address2}<li class="address_address2">{$address_delivery->address2|escape:'htmlall':'UTF-8'}</li>
		{elseif $field_item eq "phone_mobile" && $address_delivery->phone_mobile}<li class="address_phone_mobile">{$address_delivery->phone_mobile|escape:'htmlall':'UTF-8'}</li>
		{else}
				{assign var=address_words value=" "|explode:$field_item} 
				<li>{foreach from=$address_words item=word_item name="word_loop"}{if !$smarty.foreach.word_loop.first} {/if}<span class="address_{$word_item|replace:',':''}">{$deliveryAddressFormatedValues[$word_item|replace:',':'']|escape:'htmlall':'UTF-8'}</span>{/foreach}</li>
		{/if}
	{/foreach}
</ul>
</div>
{$HOOK_ORDERDETAILDISPLAYED}
{if !$is_guest}<form action="{$link->getPageLink('order-follow', true)}" method="post">{/if}
<div id="order-detail-content" class="table_block">
	<table class="std">
		<thead>
			<tr>
				{if $return_allowed}<th class="first_item"><input type="checkbox" /></th>{/if}
				<th class="{if $return_allowed}item{else}first_item{/if}">{l s='Reference'}</th>
				<th class="item">{l s='Product'}</th>
				<th class="item">{l s='Quantity'}</th>
				{if $order->hasProductReturned()}
					<th class="item">{l s='Returned'}</th>
				{/if}
				<th class="item">{l s='Unit price'}</th>
				<th class="last_item">{l s='Total price'}</th>
			</tr>
		</thead>
		<tfoot>
			{if $priceDisplay && $use_tax}
				<tr class="item">
					<td colspan="{if $return_allowed || $order->hasProductReturned()}{if $order->hasProductReturned() && $return_allowed}7{else}6{/if}{else}5{/if}">
						{l s='Total products (tax excl.)'} <span class="price">{displayWtPriceWithCurrency price=$order->getTotalProductsWithoutTaxes() currency=$currency}</span>
					</td>
				</tr>
			{/if}
			<tr class="item">
				<td colspan="{if $return_allowed || $order->hasProductReturned()}{if $order->hasProductReturned() && $return_allowed}7{else}6{/if}{else}5{/if}">
					{l s='Total products'} {if $use_tax}{l s='(tax incl.)'}{/if}: <span class="price">{displayWtPriceWithCurrency price=$order->getTotalProductsWithTaxes() currency=$currency}</span>
				</td>
			</tr>
			{if $order->total_discounts > 0}
			<tr class="item">
				<td colspan="{if $return_allowed || $order->hasProductReturned()}{if $order->hasProductReturned() && $return_allowed}7{else}6{/if}{else}5{/if}">
					{l s='Total vouchers:'} <span class="price-discount">{displayWtPriceWithCurrency price=$order->total_discounts currency=$currency convert=1}</span>
				</td>
			</tr>
			{/if}
			{if $order->total_wrapping > 0}
			<tr class="item">
				<td colspan="{if $return_allowed || $order->hasProductReturned()}{if $order->hasProductReturned() && $return_allowed}7{else}6{/if}{else}5{/if}">
					{l s='Total gift wrapping cost:'} <span class="price-wrapping">{displayWtPriceWithCurrency price=$order->total_wrapping currency=$currency}</span>
				</td>
			</tr>
			{/if}
			<tr class="item">
				<td colspan="{if $return_allowed || $order->hasProductReturned()}{if $order->hasProductReturned() && $return_allowed}7{else}6{/if}{else}5{/if}">
					{l s='Total shipping'} {if $use_tax}{l s='(tax incl.)'}{/if}: <span class="price-shipping">{displayWtPriceWithCurrency price=$order->total_shipping currency=$currency}</span>
				</td>
			</tr>
			<tr class="totalprice item">
				<td colspan="{if $return_allowed || $order->hasProductReturned()}{if $order->hasProductReturned() && $return_allowed}7{else}6{/if}{else}5{/if}">
					{l s='Total'} <span class="price">{displayWtPriceWithCurrency price=$order->total_paid currency=$currency}</span>
				</td>
			</tr>
		</tfoot>
		<tbody>
		{foreach from=$products item=product name=products}
			{if !isset($product.deleted)}
				{assign var='productId' value=$product.product_id}
				{assign var='productAttributeId' value=$product.product_attribute_id}
				{if isset($product.customizedDatas)}
					{assign var='productQuantity' value=$product.product_quantity-$product.customizationQuantityTotal}
				{else}
					{assign var='productQuantity' value=$product.product_quantity}
				{/if}
				<!-- Customized products -->
				{if isset($product.customizedDatas)}
					<tr class="item">
						{if $return_allowed}<td class="order_cb"></td>{/if}
						<td><label for="cb_{$product.id_order_detail|intval}">{if $product.product_reference}{$product.product_reference|escape:'htmlall':'UTF-8'}{else}--{/if}</label></td>
						<td class="bold">
							<label for="cb_{$product.id_order_detail|intval}">{$product.product_name|escape:'htmlall':'UTF-8'}</label>
						</td>
						<td><input class="order_qte_input"  name="order_qte_input[{$smarty.foreach.products.index}]" type="text" size="2" value="{$product.customizationQuantityTotal|intval}" /><label for="cb_{$product.id_order_detail|intval}"><span class="order_qte_span editable">{$product.customizationQuantityTotal|intval}</span></label></td>
						{if $order->hasProductReturned()}
							<td>
								{$product['qty_returned']}
							</td>
						{/if}
						<td>
							<label for="cb_{$product.id_order_detail|intval}">
								{if $group_use_tax}
									{convertPriceWithCurrency price=$product.unit_price_tax_incl currency=$currency}
								{else}
									{convertPriceWithCurrency price=$product.unit_price_tax_excl currency=$currency}
								{/if}
							</label>
						</td>
						<td>
							<label for="cb_{$product.id_order_detail|intval}">
								{if isset($customizedDatas.$productId.$productAttributeId)}
									{if $group_use_tax}
										{convertPriceWithCurrency price=$product.total_customization_wt currency=$currency}
									{else}
										{convertPriceWithCurrency price=$product.total_customization currency=$currency}
									{/if}
								{else}
									{if $group_use_tax}
										{convertPriceWithCurrency price=$product.total_price_tax_incl currency=$currency}
									{else}
										{convertPriceWithCurrency price=$product.total_price_tax_excl currency=$currency}
									{/if}
								{/if}
							</label>
						</td>
					</tr>
					{foreach $product.customizedDatas  as $customizationPerAddress}
						{foreach $customizationPerAddress as $customizationId => $customization}
						<tr class="alternate_item">
							{if $return_allowed}<td class="order_cb"><input type="checkbox" id="cb_{$product.id_order_detail|intval}" name="customization_ids[{$product.id_order_detail|intval}][]" value="{$customizationId|intval}" /></td>{/if}
							<td colspan="2">
							{foreach from=$customization.datas key='type' item='datas'}
								{if $type == $CUSTOMIZE_FILE}
								<ul class="customizationUploaded">
									{foreach from=$datas item='data'}
										<li><img src="{$pic_dir}{$data.value}_small" alt="" class="customizationUploaded" /></li>
									{/foreach}
								</ul>
								{elseif $type == $CUSTOMIZE_TEXTFIELD}
								<ul class="typedText">{counter start=0 print=false}
									{foreach from=$datas item='data'}
										{assign var='customizationFieldName' value="Text #"|cat:$data.id_customization_field}
										<li>{$data.name|default:$customizationFieldName} : {$data.value}</li>
									{/foreach}
								</ul>
								{/if}
							{/foreach}
							</td>
							<td>
								<input class="order_qte_input" name="customization_qty_input[{$customizationId|intval}]" type="text" size="2" value="{$customization.quantity|intval}" /><label for="cb_{$product.id_order_detail|intval}"><span class="order_qte_span editable">{$customization.quantity|intval}</span></label>
							</td>
							<td colspan="2"></td>
						</tr>
						{/foreach}
					{/foreach}
				{/if}
				<!-- Classic products -->
				{if $product.product_quantity > $product.customizationQuantityTotal}
					<tr class="item">
						{if $return_allowed}<td class="order_cb"><input type="checkbox" id="cb_{$product.id_order_detail|intval}" name="ids_order_detail[{$product.id_order_detail|intval}]" value="{$product.id_order_detail|intval}" /></td>{/if}
						<td><label for="cb_{$product.id_order_detail|intval}">{if $product.product_reference}{$product.product_reference|escape:'htmlall':'UTF-8'}{else}--{/if}</label></td>
						<td class="bold">
							<label for="cb_{$product.id_order_detail|intval}">
								{if $product.download_hash && $invoice && $product.display_filename != '' && $product.product_quantity_refunded == 0 && $product.product_quantity_return == 0}
									{if isset($is_guest) && $is_guest}
									<a href="{$link->getPageLink('get-file', true, NULL, "key={$product.filename|escape:'htmlall':'UTF-8'}-{$product.download_hash|escape:'htmlall':'UTF-8'}&id_order={$order->id}&secure_key={$order->secure_key}")}" title="{l s='Download this product'}">
									{else}
										<a href="{$link->getPageLink('get-file', true, NULL, "key={$product.filename|escape:'htmlall':'UTF-8'}-{$product.download_hash|escape:'htmlall':'UTF-8'}")}" title="{l s='Download this product'}">
									{/if}
										<img src="{$img_dir}icon/download_product.gif" class="icon" alt="{l s='Download product'}" />
									</a>
									{if isset($is_guest) && $is_guest}
										<a href="{$link->getPageLink('get-file', true, NULL, "key={$product.filename|escape:'htmlall':'UTF-8'}-{$product.download_hash|escape:'htmlall':'UTF-8'}&id_order={$order->id}&secure_key={$order->secure_key}")}" title="{l s='Download this product'}"> {$product.product_name|escape:'htmlall':'UTF-8'} 	</a>
									{else}
									<a href="{$link->getPageLink('get-file', true, NULL, "key={$product.filename|escape:'htmlall':'UTF-8'}-{$product.download_hash|escape:'htmlall':'UTF-8'}")}" title="{l s='Download this product'}"> {$product.product_name|escape:'htmlall':'UTF-8'} 	</a>
									{/if}
								{else}
									{$product.product_name|escape:'htmlall':'UTF-8'}
								{/if}
							</label>
						</td>
						<td><input class="order_qte_input" name="order_qte_input[{$product.id_order_detail|intval}]" type="text" size="2" value="{$productQuantity|intval}" /><label for="cb_{$product.id_order_detail|intval}"><span class="order_qte_span editable">{$productQuantity|intval}</span></label></td>
						{if $order->hasProductReturned()}
							<td>
								{$product['qty_returned']}
							</td>
						{/if}
						<td>
							<label for="cb_{$product.id_order_detail|intval}">
							{if $group_use_tax}
								{convertPriceWithCurrency price=$product.unit_price_tax_incl currency=$currency}
							{else}
								{convertPriceWithCurrency price=$product.unit_price_tax_excl currency=$currency}
							{/if}
							</label>
						</td>
						<td>
							<label for="cb_{$product.id_order_detail|intval}">
							{if $group_use_tax}
								{convertPriceWithCurrency price=$product.total_price_tax_incl currency=$currency}
							{else}
								{convertPriceWithCurrency price=$product.total_price_tax_excl currency=$currency}
							{/if}
							</label>
						</td>
					</tr>
				{/if}
			{/if}
		{/foreach}
		{foreach from=$discounts item=discount}
			<tr class="item">
				<td>{$discount.name|escape:'htmlall':'UTF-8'}</td>
				<td>{l s='Voucher'} {$discount.name|escape:'htmlall':'UTF-8'}</td>
				<td><span class="order_qte_span editable">1</span></td>
				<td> </td>
				<td>{if $discount.value != 0.00}-{/if}{convertPriceWithCurrency price=$discount.value currency=$currency}</td>
				{if $return_allowed}
				<td> </td>
				{/if}
			</tr>
		{/foreach}
		</tbody>
	</table>
</div>
<div class="table_block">
{if $order->getShipping()|count > 0}
	<table class="std">
		<thead>
			<tr>
				<th class="first_item">{l s='Date'}</th>
				<th class="item">{l s='Carrier'}</th>
				<th class="item">{l s='Weight'}</th>
				<th class="item">{l s='Shipping cost'}</th>
				<th class="last_item">{l s='Tracking number'}</th>
			</tr>
		</thead>
		<tbody>
			{foreach from=$order->getShipping() item=line}
			<tr class="item">
				<td>{$line.date_add}</td>
				<td>{$line.carrier_name}</td>
				<td>{if $line.weight > 0}{$line.weight|string_format:"%.3f"} {Configuration::get('PS_WEIGHT_UNIT')}{else}-{/if}</td>
				<td>{if $order->getTaxCalculationMethod() == $smarty.const.PS_TAX_INC}{displayPrice price=$line.shipping_cost_tax_incl currency=$currency->id}{else}{displayPrice price=$line.shipping_cost_tax_excl currency=$currency->id}{/if}</td>
				<td>
					<span id="shipping_number_show">{if $line.tracking_number}{if $line.url && $line.tracking_number}<a href="{$line.url|replace:'@':$line.tracking_number}">{$line.tracking_number}</a>{else}{$line.tracking_number}{/if}{else}-{/if}</span>
				</td>
			</tr>
			{/foreach}
		</tbody>
	</table>
{/if}
</div>
<br />
{if !$is_guest}
	{if $return_allowed}
	<div id="returnOrderMessage">
		<h3>{l s='Merchandise return'}</h3>
		<p>{l s='If you wish to return one or more products, please mark the corresponding boxes and provide an explanation for the return. When complete, click the button below.'}</p>
		<p class="textarea">
			<textarea cols="67" rows="3" name="returnText"></textarea>
		</p>
		<p class="submit">
			<input type="submit" value="{l s='Make an RMA slip'}" name="submitReturnMerchandise" class="button_large" />
			<input type="hidden" class="hidden" value="{$order->id|intval}" name="id_order" />
		</p>
	</div>
	<br />
	{/if}
	</form>

	{if count($messages)}
	<h3>{l s='Messages'}</h3>
	<div class="table_block">
		<table class="detail_step_by_step std">
			<thead>
				<tr>
					<th class="first_item" style="width:150px;">{l s='From'}</th>
					<th class="last_item">{l s='Message'}</th>
				</tr>
			</thead>
			<tbody>
			{foreach from=$messages item=message name="messageList"}
				<tr class="{if $smarty.foreach.messageList.first}first_item{elseif $smarty.foreach.messageList.last}last_item{/if} {if $smarty.foreach.messageList.index % 2}alternate_item{else}item{/if}">
					<td>
						{if isset($message.elastname) && $message.elastname}
							{$message.efirstname|escape:'htmlall':'UTF-8'} {$message.elastname|escape:'htmlall':'UTF-8'}
						{elseif $message.clastname}
							{$message.cfirstname|escape:'htmlall':'UTF-8'} {$message.clastname|escape:'htmlall':'UTF-8'}
						{else}
							<b>{$shop_name|escape:'htmlall':'UTF-8'}</b>
						{/if}
						<br />
						{dateFormat date=$message.date_add full=1}
					</td>
					<td>{$message.message|escape:'htmlall':'UTF-8'|nl2br}</td>
				</tr>
			{/foreach}
			</tbody>
		</table>
	</div>
	{/if}
	{if isset($errors) && $errors}
		<div class="error">
			<p>{if $errors|@count > 1}{l s='There are %d errors' sprintf=$errors|@count}{else}{l s='There is %d error' sprintf=$errors|@count}{/if}</p>
			<ol>
			{foreach from=$errors key=k item=error}
				<li>{$error}</li>
			{/foreach}
			</ol>
		</div>
	{/if}
	<form action="{$link->getPageLink('order-detail', true)}" method="post" class="std" id="sendOrderMessage">
		<h3>{l s='Add a message'}</h3>
		<p>{l s='If you would like to add a comment about your order, please write it in the field below.'}</p>
		<p>
		<label for="id_product">{l s='Product'}</label>
			<select name="id_product" style="width:300px;">
				<option value="0">{l s='-- Choose --'}</option>
				{foreach from=$products item=product name=products}
					<option value="{$product.product_id}">{$product.product_name}</option>
				{/foreach}
			</select>
		</p>
		<p class="textarea">
			<textarea cols="67" rows="3" name="msgText"></textarea>
		</p>
		<p class="submit">
			<input type="hidden" name="id_order" value="{$order->id|intval}" />
			<input type="submit" class="button" name="submitMessage" value="{l s='Send'}"/>
		</p>
	</form>
{else}
<p><img src="{$img_dir}icon/infos.gif" alt="" class="icon" /> {l s='You cannot return merchandise with a guest account'}</p>
{/if}

OrderDetailController.php

<?php

class OrderDetailController extends OrderDetailControllerCore
{

	public function postProcess()
	{
		parent::postProcess();

		if (Tools::isSubmit('markAsReceived'))
		{
			$idOrder = (int)(Tools::getValue('id_order'));
			$order = new Order($idOrder);

			if(Validate::isLoadedObject($order))
			{
				if($order->getCurrentState() == 4) // if the order is shipped
				{
					$new_history = new OrderHistory();
					$new_history->id_order = (int)$order->id;
					$new_history->changeIdOrderState(5, $order); // 5: delivered
					$new_history->addWithemail(true);	
				}
				

				$this->context->smarty->assign('receipt_confirmation', true);

			} else $this->_errors[] = Tools::displayError('Error: Invalid order number');
			
		}		

	}


}


Link to comment
Share on other sites

As tu vérifier dans Commandes>Status a quoi correspond l'id 4 et voir si la commande sur le quel tu fais ton test pour l'affichage du bouton à bien le bon statut dans ton code actuel tu fais afficher le bouton que sur le statu ayant l'ID 4

 

Au niveau des modifs

 

sur le fichier history.tpl cherche 

<td class="history_state">{if isset($order.order_state)}{$order.order_state|escape:'htmlall':'UTF-8'}{/if}</td>

Et remplace le par 

<td class="history_state" id="etatorder-{$order.id_order}">{if isset($order.order_state)}{$order.order_state|escape:'htmlall':'UTF-8'}{/if}</td>

Dans le fichier order-details.tpl sur le code du bouton cherche :

<input type="hidden" class="hidden" value="{$order->id|intval}" name="id_order" />

Et remplace le par

<input type="hidden" class="hidden"  id="monidorder" value="{$order->id|intval}" name="id_order" />

Et ensuite tu fais la modif dans history.js que j'ai mise dans mon post précédent.

 

 

Je n'ai pas test car pas la version 1.5 sous la main mais ca devrait marcher normalement.

Link to comment
Share on other sites

non tu mets :

{$order_history.0.id_order_state}

Affiche cette valeur juste avant de rentrer dans la boucle d'affichage du bouton ;)

 

Ca donnera ca :

<h3>{l s='Follow your order\'s status step-by-step'}</h3>

 MON ID ORDER : {$order_history.0.id_order_state}<br>

{if isset($receipt_confirmation) && $receipt_confirmation}
    <p class="success">
        {l s='Thank you for your feedback!'}
    </p>
{/if}
{if $order_history.0.id_order_state == 4}
    <form action="{$link->getPageLink('order-detail', true)|escape:'html'}" method="post" class="std" id="markAsReceived">
        <input type="hidden" class="hidden" value="{$order->id|intval}" name="id_order" />
        <input type="submit" class="exclusive" name="markAsReceived" id="markAsReceivedBtn" value="{l s='I have received this order'}">
        <p class="clear"></p>
    </form>
 
{/if}
Link to comment
Share on other sites

Ok !

 

Je viens seulement de comprendre :D

 

J'ai plusieurs ID de status qui sont liés au "shipped" : 4/14/15/16/20/21/23.

Comment faire dans ce cas ?

 

De mon coté je vais voir pour intégrer un bouton directement sur le listing général des commandes juste après la colonne Statut (travail à faire dans history.tpl)...

2014-12-30_1028.png

Edited by lordbdp (see edit history)
Link to comment
Share on other sites

Est ce que tu utilise tout c'est ID pour shipped (de base il y en as 1 seul) si non :

 

Remplace le 4 dans {if $order_history.0.id_order_state == 4} par l'id que tu utilise sur ta boutique 

 

si tous sont important dans ton fonctionnement, il faut que tu les rajoute dans ta condition d'affichage du bouton

 

exemple : 

{if $order_history.0.id_order_state == 4 || $order_history.0.id_order_state == XX || $order_history.0.id_order_state == XX || ..... } 

Il faudra également faire la modifications dans l'overide de OrderDetailController.php

 

en rajoutant tes différents id dans le if suivant 

if($order->getCurrentState() = 4)

Pour ce qui est de l'ajout dans le tableau de recap, les modifs doivent être rapide à réalisé, je souhaitais le faire au début et je suis passé à autre chose lol

Link to comment
Share on other sites

Je faits tout ça et te donnerais le code à modifier ;)

 

Pour le

if($order->getCurrentState() = 4)

je fait

if($order->getCurrentState() = 4,XX,XX,XXX)

ou

if($order->getCurrentState() = 4);
if($order->getCurrentState() = XX);
if($order->getCurrentState() = XX);
if($order->getCurrentState() = XX)

Merci.

Edited by lordbdp (see edit history)
Link to comment
Share on other sites

Alors ce que j'ai fait ne marche pas pour l'ajouter dans history.tpl

<td class="history_state" id="etatorder-{$order.id_order}">{if isset($order.order_state)}{$order.order_state|escape:'htmlall':'UTF-8'}{/if}<br>
					{if isset($receipt_confirmation) && $receipt_confirmation}
					{/if}
					{if $order_history.0.id_order_state == 4}
						<form action="{$link->getPageLink('history', true)|escape:'html'}" method="post" class="std" id="markAsReceived">
							<input type="hidden" class="hidden"  id="monidorder" value="{$order->id|intval}" name="id_order" />
							<input type="submit" class="exclusive" name="markAsReceived" id="markAsReceivedBtn" value="{l s='Confirm receipt'}">
							<p class="clear"></p>
						</form>
					{/if}
				</td>

Mais avec le debug activé sous chaque statut j'ai ce message et le bouton n'est pas affiché :

 

Notice: Undefined index: order_history in /home/mon_site_com/cache/smarty/compile/fc/64/d3/fc64d3bc6dc5088e3cf2d442c4670a4c1f706bcc.file.history.tpl.php on line 121

Notice: Trying to get property of non-object in /home/mon_site_com/cache/smarty/compile/fc/64/d3/fc64d3bc6dc5088e3cf2d442c4670a4c1f706bcc.file.history.tpl.php on line 121

Link to comment
Share on other sites

Je faits tout ça et te donnerais le code à modifier ;)

 

Pour le

if($order->getCurrentState() = 4)

je fait

if($order->getCurrentState() = 4,XX,XX,XXX)

ou

if($order->getCurrentState() = 4);
if($order->getCurrentState() = XX);
if($order->getCurrentState() = XX);
if($order->getCurrentState() = XX)

Merci.

 

Non il faut que que fasse des OR dans ton if ;)

if($order->getCurrentState() == 4 || $order->getCurrentState() == 5 || .....)

Alors ce que j'ai fait ne marche pas pour l'ajouter dans history.tpl

<td class="history_state" id="etatorder-{$order.id_order}">{if isset($order.order_state)}{$order.order_state|escape:'htmlall':'UTF-8'}{/if}<br>
					{if isset($receipt_confirmation) && $receipt_confirmation}
					{/if}
					{if $order_history.0.id_order_state == 4}
						<form action="{$link->getPageLink('history', true)|escape:'html'}" method="post" class="std" id="markAsReceived">
							<input type="hidden" class="hidden"  id="monidorder" value="{$order->id|intval}" name="id_order" />
							<input type="submit" class="exclusive" name="markAsReceived" id="markAsReceivedBtn" value="{l s='Confirm receipt'}">
							<p class="clear"></p>
						</form>
					{/if}
				</td>

Mais avec le debug activé sous chaque statut j'ai ce message et le bouton n'est pas affiché :

 

A tu ajouter le traitement du bouton dans le controller correspondant ?

 

Si oui = >

Problème de cache il faut que tu vide le cache serveur (Dans prestashop => Parametre Avancé > Performance > Vider le cache 

Et via ton FTP tu va dans cache (répertoire à la racine) et supprime le class_index.php

Link to comment
Share on other sites

Traitement du bouton non ajouté. Comment le faire ?

 

De plus avec la Loi Hamon, j'aimerais qu'un calendrier s'affiche quand le client cliques sur "J'ai reçu ma commande" afin qu'il donne la date de réception et que la date sélectionnée soit reprise lors du changement de statut de la commande coté BO.

Link to comment
Share on other sites

Il faut mettre  le code du traitement du bouton dans un overide du HistoryController

class OrderDetailController extends OrderDetailControllerCore
{
 
    public function postProcess()
    {
        parent::postProcess();
 
        if (Tools::isSubmit('markAsReceived'))
        {
            $idOrder = (int)(Tools::getValue('id_order'));
            $order = new Order($idOrder);
 
            if(Validate::isLoadedObject($order))
            {
                if($order->getCurrentState() = 4) // if the order is shipped
                {
                    $new_history = new OrderHistory();
                    $new_history->id_order = (int)$order->id;
                    $new_history->changeIdOrderState(5, $order); // 5: delivered
                    $new_history->addWithemail(true);    
                }
 
                $this->context->smarty->assign('receipt_confirmation', true);
 
            } else $this->_errors[] = Tools::displayError('Error: Invalid order number');
             
        }       
 
    }
 
 
}

en modifiant : 

class OrderDetailController extends OrderDetailControllerCore

par 

class HistoryController extends HistoryControllerCore

Normalement avec cette modif ton bouton devrait fonctionner

 

 

 

 

Pour ton calendrier il va falloir passer par du JS qui affichera un calendrier lors du clic sur bouton et ta procédure d'enregistrement du changement de statut ce fera lorsque tu clic sur le jour du calendrier (en passant en paramètre la date sélectionnée)

Link to comment
Share on other sites

Après avoir vider le cache, page blanche au final dés que je veux voir les commandes, erreur avec debug activé :

 

Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/home/mon_site/themes/default/history.tpl" on line 62 "{if($order_history.0.id_order_state == 4 || $order_history.0.id_order_state == 14 || $order_history.0.id_order_state == 15 || $order_history.0.id_order_state == 16 || $order_history.0.id_order_state == 21 || $order_history.0.id_order_state == 23)}" unknown function "if"' in /home/mon_site/public_html/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php:667 Stack trace: #0 /home/mon_site/public_html/tools/smarty/sysplugins/smarty_internal_templateparser.php(2900): Smarty_Internal_TemplateCompilerBase->trigger_template_error('unknown functio...') #1 /home/mon_site/public_html/tools/smarty/sysplugins/smarty_internal_templateparser.php(3101): Smarty_Internal_Templateparser->yy_r153() #2 /home/mon_site/public_html/tools/smarty/sysplugins/smarty_internal_templateparser.php(3201): Smarty_Internal_Templateparser->yy_reduce(15 in /home/mon_site/public_html/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 667

 

Voilà ce que j'ai mis (sachant que j'ai les statuts en "shipped" pour les iD 4/14/15/16/21/23 :

 

Dans order-detail.tpl :

{if count($order_history)}
<h3>{l s='Follow your order\'s status step-by-step'}</h3>

{if isset($receipt_confirmation) && $receipt_confirmation}
    <p class="success">
        {l s='Thank you for your feedback!'}
    </p>
{/if}
{if($order_history.0.id_order_state == 4 || $order_history.0.id_order_state == 14 || $order_history.0.id_order_state == 15 || $order_history.0.id_order_state == 16 || $order_history.0.id_order_state == 21 || $order_history.0.id_order_state == 23)}
    <form action="{$link->getPageLink('order-detail', true)|escape:'html'}" method="post" class="std" id="markAsReceived">
        <input type="hidden" class="hidden"  id="monidorder" value="{$order->id|intval}" name="id_order" />
        <input type="submit" class="exclusive" name="markAsReceived" id="markAsReceivedBtn" value="{l s='I have received this order'}">
        <p class="clear"></p>
    </form>
 
{/if}
<div class="table_block">
	<table class="detail_step_by_step std">
		<thead>
			<tr>
				<th class="first_item">{l s='Date'}</th>
				<th class="last_item">{l s='Status'}</th>
			</tr>
		</thead>
		<tbody>
		{foreach from=$order_history item=state name="orderStates"}
			<tr class="{if $smarty.foreach.orderStates.first}first_item{elseif $smarty.foreach.orderStates.last}last_item{/if} {if $smarty.foreach.orderStates.index % 2}alternate_item{else}item{/if}">
				<td>{dateFormat date=$state.date_add full=1}</td>
				<td>{$state.ostate_name|escape:'htmlall':'UTF-8'}</td>
			</tr>
		{/foreach}
		</tbody>
	</table>
</div>
{/if}

Dans history.tpl :

<td class="history_state" id="etatorder-{$order.id_order}">{if isset($order.order_state)}{$order.order_state|escape:'htmlall':'UTF-8'}{/if}<br>
					{if isset($receipt_confirmation) && $receipt_confirmation}
					{/if}
					{if($order_history.0.id_order_state == 4 || $order_history.0.id_order_state == 14 || $order_history.0.id_order_state == 15 || $order_history.0.id_order_state == 16 || $order_history.0.id_order_state == 21 || $order_history.0.id_order_state == 23)}
						<form action="{$link->getPageLink('history', true)|escape:'html'}" method="post" class="std" id="markAsReceived">
							<input type="hidden" class="hidden"  id="monidorder" value="{$order->id|intval}" name="id_order" />
							<input type="submit" class="exclusive" name="markAsReceived" id="markAsReceivedBtn" value="{l s='Confirm receipt'}">
							<p class="clear"></p>
						</form>
					{/if}
				</td>

Dans OrderDetailController.php (override) :

<?php

class OrderDetailController extends OrderDetailControllerCore
{

	public function postProcess()
	{
		parent::postProcess();

		if (Tools::isSubmit('markAsReceived'))
		{
			$idOrder = (int)(Tools::getValue('id_order'));
			$order = new Order($idOrder);

			if(Validate::isLoadedObject($order))
			{
				if($order->getCurrentState() == 4 || $order->getCurrentState() == 14 || $order->getCurrentState() == 15 || $order->getCurrentState() == 16 || $order->getCurrentState() == 21 || $order->getCurrentState() == 23) // if the order is shipped
				{
					$new_history = new OrderHistory();
					$new_history->id_order = (int)$order->id;
					$new_history->changeIdOrderState(5, $order); // 5: delivered
					$new_history->addWithemail(true);	
				}
				

				$this->context->smarty->assign('receipt_confirmation', true);

			} else $this->_errors[] = Tools::displayError('Error: Invalid order number');
			
		}		

	}


}

Dans HistoryController.php (override) :

<?php
	/**
	 * Confirm delivery
	 */
class HistoryController extends HistoryControllerCore
{
 
    public function postProcess()
    {
        parent::postProcess();
 
        if (Tools::isSubmit('markAsReceived'))
        {
            $idOrder = (int)(Tools::getValue('id_order'));
            $order = new Order($idOrder);
 
            if(Validate::isLoadedObject($order))
            {
				if($order->getCurrentState() == 4 || $order->getCurrentState() == 14 || $order->getCurrentState() == 15 || $order->getCurrentState() == 16 || $order->getCurrentState() == 21 || $order->getCurrentState() == 23) // if the order is shipped
                {
                    $new_history = new OrderHistory();
                    $new_history->id_order = (int)$order->id;
                    $new_history->changeIdOrderState(5, $order); // 5: delivered
                    $new_history->addWithemail(true);    
                }
 
                $this->context->smarty->assign('receipt_confirmation', true);
 
            } else $this->_errors[] = Tools::displayError('Error: Invalid order number');
             
        }       
 
    }
 
 
}

Où est l'erreur ?

Edited by lordbdp (see edit history)
Link to comment
Share on other sites

D'après les logs ton erreur vient de la ligne 62 du histpry.tpl

c'est la variable $order_history.0.id_order_state qui ne doit pas être implémentée dans le controller, il faut que tu regarde comment sont retourné les id controller dans history.

 

dans la 1.6 => il faut juste utiliser $order.id_order_state et non  $order_history.0.id_order_state

 

donc dans ton history.tpl remplace : 

{if($order_history.0.id_order_state == 4 || $order_history.0.id_order_state == 14 || $order_history.0.id_order_state == 15 || $order_history.0.id_order_state == 16 || $order_history.0.id_order_state == 21 || $order_history.0.id_order_state == 23)}

par 

{if($order.id_order_state == 4 || $order.id_order_state == 14 || $order.id_order_state == 15 || $order.id_order_state == 16 || $order.id_order_state == 21 || $order.id_order_state == 23)}
Link to comment
Share on other sites

J'ai fait la modif dans les 2 tpl mais idem :

 

 

Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/home/mon_site/public_html/themes/default/history.tpl" on line 62 "{if($order.id_order_state == 4 || $order.id_order_state == 14 || $order.id_order_state == 15 || $order.id_order_state == 16 || $order.id_order_state == 21 || $order.id_order_state == 23)}" unknown function "if"' in /home/mon_site/public_html/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php:667 Stack trace: #0 /home/mon_site/public_html/tools/smarty/sysplugins/smarty_internal_templateparser.php(2900): Smarty_Internal_TemplateCompilerBase->trigger_template_error('unknown functio...') #1 /home/mon_site/public_html/tools/smarty/sysplugins/smarty_internal_templateparser.php(3101): Smarty_Internal_Templateparser->yy_r153() #2 /home/mon_site/public_html/tools/smarty/sysplugins/smarty_internal_templateparser.php(3201): Smarty_Internal_Templateparser->yy_reduce(153) #3 /home/mon_site/public_html/tools/smarty/sysplugins/sma in /home/mon_site/public_html/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 667

Link to comment
Share on other sites

L'erreur vient du IF on dirait d'après le Log qu'il ne connait pas le IF ou du moins il le prend comme une fonction

 

Essai de remplacer :

{if($order.id_order_state == 4 || $order.id_order_state == 14 || $order.id_order_state == 15 || $order.id_order_state == 16 || $order.id_order_state == 21 || $order.id_order_state == 23)}

par 

{if $order.id_order_state == 4 || $order.id_order_state == 14 || $order.id_order_state == 15 || $order.id_order_state == 16 || $order.id_order_state == 21 || $order.id_order_state == 23}
Link to comment
Share on other sites

Légère évolution, concernant le debug. Quand je clique sur la commande pour avoir le détail j'obtiens :

 

Fatal error: Cannot use object of type Order as array in /home/mon_site/public_html/cache/smarty/compile/0a/3e/ce/0a3ecef32b348deeaed65356c3d4591c8244fbea.file.order-detail.tpl.php on line 141

 

Du coups je suis parti vider le cache pour voir s'il y aurait changement : pas de changement.

 

Help me plz !

Link to comment
Share on other sites

Très intéressant. Il ne serait pas possible de compiler tout se travail pour en faire un module ? Ca serait plus facile pour que plusieurs personnes travail dessus sans avoir des bout de code ici et là éparpiller un peu partout sur le sujet.

Qu'en pensez vous ?

Link to comment
Share on other sites

Voila le code pour ajouter le bouton dans l'historique de commande directement sans ouvrir le details de la commande, avec un champs ou l'utilisateur peut saisir la date de la réception (date comprise entre J+1 après la facturation et la date du jour)

Le code est surement optimisable, j'ai fait ca vite mais ca marche nikel sur Presta 1.6

 

Donc pour commencer sur ta view History.tpl place ce code ou tu souhaite que ton bouton s'affiche

{if $order.id_order_state == 4 || $order.id_order_state == 3}
								<input type="hidden" value="{$order.invoice_date}" class="datefacturation">
								<div id="markAsReceivedhistoryBtn-{$order.id_order|intval}">
									<form action="{$link->getPageLink('history', true)|escape:'html'}" method="post" class="std" id="markAsReceivedhistory" name="{$order.id_order|intval}">
										<input type="hidden" class="hidden" value="{$order.id_order|intval}" name="id_order" id='monidorder-{$order.id_order|intval}'/>
										<br>
										<table>
											<tr>
												<td>{l s='I have received this order the :'} <input type="text" id="datereceptionorder" name="datereceptionorder" value="" style="width: 90px;"></td>
												<td><input type="submit" class="btn btn-default button-default" name="markAsReceivedhistory" value="OK"></td>
											</tr>
										</table>
										<p class="clear"></p>
									</form>
								</div>
								{/if}

Ne pas oublier dans l'outils de traduction du front office pour modifier la traduction de : I have received this order the :

 

Ensuite sans History.js tu ajoute à la fin du fichier :

function markAsReceivedhistory(id)
{

	paramString = "ajax=true";

	$('#markAsReceivedhistory').find('input').each(function(){
		if($(this).attr('type') == "text"){
			var date = $(this).val().split("/");
			paramString += '&' + 'annee=' + date[2];
			paramString += '&' + 'mois=' + date[1];
			paramString += '&' + 'jour=' + date[0];
		}else{
			paramString += '&' + $(this).attr('name') + '=' + encodeURIComponent($(this).val());
		}

	});

	$.ajax({
		type: "POST",
		headers: { "cache-control": "no-cache" },
		url: $('#markAsReceivedhistory').attr("action") + '?rand=' + new Date().getTime(),
		data: paramString,
		success: function (msg){
			//$('#block-order-detail').fadeOut('slow', function() {
				$('#markAsReceivedhistoryBtn-'+id).hide();
			//	$(this).fadeIn('slow');

				$("#etatorder-"+id).removeClass('label-warning');
				$("#etatorder-"+id).addClass('label-success');
				$("#etatorder-"+id).html('Livré');

			//});
		}
	});

	return false;
}

function madateDiff(date1, date2){
	var diff = {}                           // Initialisation du retour
	var tmp = date2 - date1;

	tmp = Math.floor(tmp/1000);             // Nombre de secondes entre les 2 dates
	diff.sec = tmp % 60;                    // Extraction du nombre de secondes

	tmp = Math.floor((tmp-diff.sec)/60);    // Nombre de minutes (partie entière)
	diff.min = tmp % 60;                    // Extraction du nombre de minutes

	tmp = Math.floor((tmp-diff.min)/60);    // Nombre d'heures (entières)
	diff.hour = tmp % 24;                   // Extraction du nombre d'heures

	tmp = Math.floor((tmp-diff.hour)/24);   // Nombre de jours restants
	diff.day = tmp;

	return diff;
}

$(function() {
	$('form#markAsReceivedhistory').submit(function(){
		monid = $("#monidorder-"+$(this).attr("name")).val();
		return markAsReceivedhistory(monid);

	});

	var now = new Date();
	var annee   = now.getFullYear();
	var mois    = ('0'+now.getMonth()+1).slice(-2);
	var jour    = ('0'+now.getDate()   ).slice(-2);


	date1 = new Date($(".datefacturation").val());
	date2 = new Date(annee+'-'+mois+"-"+jour+" 00:00:00");
	var diff = madateDiff(date1, date2);


	$( "#datereceptionorder" ).val(jour+'/'+mois+"/"+annee)
	$( "#datereceptionorder" ).datepicker({
		minDate: -diff.day,
		maxDate: "+0D"

		});

});

Et pour finir il faut créer un Overide de HistoryController.php tu crée donc un fichier dans overide/controller/front et tu l'appel HistoruController.php

 

Si tu as rien dedans tu y colle le code suivant : 

<?php
class HistoryController extends HistoryControllerCore
{

  public function postProcess()
  {
    //parent::postProcess();

    if (Tools::isSubmit('markAsReceivedhistory'))
    {

      $idOrder = (int)(Tools::getValue('id_order'));

      $jour = (int)(Tools::getValue('jour'));
      $mois = (int)(Tools::getValue('mois'));
      $annee = (int)(Tools::getValue('annee'));

      $order = new Order($idOrder);

      $madate = $annee."-".$mois."-".$jour;

      if(Validate::isLoadedObject($order))
      {
        if($order->getCurrentState() == 4 || $order->getCurrentState() == 3) // if the order is shipped
        {
          $new_history = new OrderHistory();
          $new_history->id_order = (int)$order->id;
          $new_history->date_add = $madate;
          $new_history->changeIdOrderState(5, $order); // 5: delivered
          $new_history->addWithemail(false);
        }
      } else $this->_errors[] = Tools::displayError('Error: Invalid order number');

    }
  }

  public function setMedia()
  {
    parent::setMedia();
    $this->addJqueryUI('ui.datepicker');
  }
}

Tu n'as plus qu'à mettre en ligne ces 3 fichiers, vider tes cache (navigateur, serveur, et class_index.php)

Ca fonctionne sur une 1.6, il y aura peut être quelque adaptation à faire pour la 1.5 à voir ;)

 

De plus au niveau de l'overide possibilité de modifier : $order->getCurrentState() == 4 || $order->getCurrentState() == 3 afin de rajouter des statut possible ainsi que dans history.tpl pour ajouter des statut on change le if $order.id_order_state == 4 || $order.id_order_state == 3

Edited by totoche33 (see edit history)
Link to comment
Share on other sites

C'est bon ça marche pour la partie historique, en revanche impossible d'avoir le détail de la commande. J'obtiens l'erreur suivante :

 

Fatal error: Cannot use object of type Order as array in /home/mon_site/public_html/cache/smarty/compile/0a/3e/ce/0a3ecef32b348deeaed65356c3d4591c8244fbea.file.order-detail.tpl.php on line 141

 

 

Pourtant tout avait été vidé avant.

 

Je voudrais aussi comprendre

$order.id_order_state == 3

qui correspond au statut « Préparation en cours ».

 

et aussi pourquoi avoir supprimé :

$this->context->smarty->assign('receipt_confirmation', true);
Link to comment
Share on other sites

J'aimerai afficher tout ca dans le détail de la commande. Je trouve ça plus net et clair pour l'utilisateur. Le soucis c'est dès que je place le bouton dans le order_detail.tpl je recharge ma page et lorsque je veux ouvrir le détail de la commande il ne se passe plus rien. Une idée ?

 

edit : je confirme que cela fonctionne bien sous 1.6.0.9 mais quand on sélectionne une date l'état de la commande passe bien a 5 soit "livré" mais lorsque l'on recharge sa page d'historique de commande l'état affiché dans le tableau reste sur "En cours de livraison". Il ne se met pas du tout à jour. Dans l'absolu faudrait qu'il se mette à jour et rajouter un peu de js ou d'ajax pour que le nouvel état s'affiche directement après que l'utilisateur ai cliqué sur le bouton "OK"

Edited by hardcpp (see edit history)
Link to comment
Share on other sites

L'idée est pas mal je travail aussi a l'implémentation d'un tel système mais le soucis c'est que je fais toujours 50 truc a la fois.. ><
Je vais quand même essayer de résoudre les soucis que j'ai évoqué précédemment si je trouve quelque chose de probant je fais signe

Link to comment
Share on other sites

 

C'est bon ça marche pour la partie historique, en revanche impossible d'avoir le détail de la commande. J'obtiens l'erreur suivante :

 

 

Pourtant tout avait été vidé avant.

 

Je voudrais aussi comprendre

$order.id_order_state == 3

qui correspond au statut « Préparation en cours ».

 

et aussi pourquoi avoir supprimé :

$this->context->smarty->assign('receipt_confirmation', true);

J'ai mis $order.id_order_state == 3 car pour ma part je veux faire afficher le bouton Sur preparation et en cours de livraison au cas ou j'oublis de la passer en expédié :)

 

J'ai supprimer le retour car je ne fais pas afficher de message pour valider le fais du changement d'état je gère mon retour en JS directement

 

 

J'aimerai afficher tout ca dans le détail de la commande. Je trouve ça plus net et clair pour l'utilisateur. Le soucis c'est dès que je place le bouton dans le order_detail.tpl je recharge ma page et lorsque je veux ouvrir le détail de la commande il ne se passe plus rien. Une idée ?

 

edit : je confirme que cela fonctionne bien sous 1.6.0.9 mais quand on sélectionne une date l'état de la commande passe bien a 5 soit "livré" mais lorsque l'on recharge sa page d'historique de commande l'état affiché dans le tableau reste sur "En cours de livraison". Il ne se met pas du tout à jour. Dans l'absolu faudrait qu'il se mette à jour et rajouter un peu de js ou d'ajax pour que le nouvel état s'affiche directement après que l'utilisateur ai cliqué sur le bouton "OK"

 

Pour moi ca fonctionne une fois que je clique sur OK j'ai bien l"état qui passe à livré et reste chargé lors du reload de la page

Verifie dans le JS si les ID du champs corresponde bien à ceux qui sont forcé en JS lors du sucess ;)

 

 

Okom, ton module à l'air bien sympa, tiens nous au courant

Link to comment
Share on other sites

C'est étrange car j'ai sensiblement le même code que toi alors je ne comprends pas pourquoi on a pas exactement la même chose :/. Par contre il faut placer ce bouton dans le détails d'une commande car si le client a plusieurs commande en cours là ca devient inutile il suffit de tester :)

Link to comment
Share on other sites

Je n'ai pas encore trouver une solution viable pour afficher le bouton dans le détail de la commande pour qu'il soit actif uniquement pour la commande sélectionné. Car si un client a plusieurs commande en cours cela devient vite problématique si le bouton se situe au niveau de l'historique. Si quelqu'un a une idée ou un bou de solution je suis preneur :)

Link to comment
Share on other sites

  • 3 months later...

Bonjour,

Je reviens sur ce post.
Ca fonctionne super bien sur ma boutique en PS 1.6.0.11, merci à Totoche33 pour le taf ! :)

 

Afin de forcer mes clients à cliquer pour confirmer la réception du colis, comment puis-je, au login sur le compte client, avoir sur my-account.tpl,

un bloc info qui dit qu'ils doivent confirmer la réception d'une commande.

 

Entre

<p class="info-account">{l s='Welcome to your account. Here you can manage all of your personal information and orders.'}</p>

et

<ul class="myaccount-link-list">
            {if $has_customer_an_address}
            <li><a href="{$link->getPageLink('address', true)|escape:'html':'UTF-8'}" title="{l s='Add my first address'}"><i class="icon-building"></i><span>{l s='Add my first address'}</span></a></li>
            {/if}.....

 

Ceci afin de les informer directement sur la page du compte qu'il y a quelque chose à faire dans "mes commandes"

 

Merci de vos lumières

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...