Jump to content

Insertion dans BDD grâce à un nouveau champs sur order-carrier.tpl


Recommended Posts

Bonjour à tous,

 

Je suis sur prestashop 1.5.4.1 et je développe mon site pour de la vente en livraison.

 

Sur la page order-carrier, j'ai ajouté une case à coché pour la date de livraison nommé : datelivraison

J'ai ajouté le champs dans la table ps_orders

 

Mon problème est pour l'ajout dans la BDD.

J'ai l'impression que l'override ne marche pas, j'ai donc modifié la classe order/Order.php pour le test.

 

Pour ce faire je fais :

 


class OrderCore extends ObjectModel
{
///// CODE ////
public $current_state;

//// CODE ////

 

et plus loin

public static $definition = array(
 'table' => 'orders',
 'primary' => 'id_order',
 'fields' => array(

//////CODE ////
  'datelivraison' =>	 array('type' => self::TYPE_STRING, 'validate' => 'isMessage'),

////CODE ////

 

Seulement voilà une fois le tout validé, cela ne s'enregistre pas dans la base de données.

 

Quelqu'un aurait une idée ?

 

Merci d'avance

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

Mon override est

<?php
class Order extends OrderCore {
public $datelivraison;
public static $definition = array(
 'table' => 'orders',
 'primary' => 'id_order',
 'fields' => array(   'datelivraison' =>	   array('type' => self::TYPE_STRING, 'validate' => 'isMessage'),
),);
}

 

Et ça me met le message d'erreur :

Oops, something went wrong.

Try to refresh this page or feel free to contact us if the problem persists.

Link to comment
Share on other sites

Bonsoir,

class Order extends OrderCore

Non malheureusement ça ne marche pas non plus.

Possible, mais c'est la bonne syntaxe, il me semble. D'ailleurs, tu l'as reprise dans ton dernier post. ;)

 

Essayes ceci

<?php
class Order extends OrderCore
{
/** @var string Date de livraison if specified */	
public $datelivraison;

/**
 * @see ObjectModel::$definition
 */
public static $definition = array(
	'table' => 'orders',
	'primary' => 'id_order',
	'fields' => array(
		'id_address_delivery' =>		 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
		'id_address_invoice' =>		 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
		'id_cart' =>					 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
		'id_currency' =>				 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
		'id_shop_group' =>				 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
		'id_shop' =>					 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
		'id_lang' =>					 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
		'id_customer' =>				 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
		'id_carrier' =>				 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
		'current_state' =>				 array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
		'secure_key' =>				 array('type' => self::TYPE_STRING, 'validate' => 'isMd5'),
		'payment' =>					 array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
		'module' =>					 array('type' => self::TYPE_STRING, 'validate' => 'isModuleName', 'required' => true),
		'recyclable' =>				 array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
		'gift' =>						 array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
		'gift_message' =>				 array('type' => self::TYPE_STRING, 'validate' => 'isMessage'),
		'mobile_theme' =>				 array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
		'total_discounts' =>			array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		'total_discounts_tax_incl' =>	array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		'total_discounts_tax_excl' =>	array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		'total_paid' =>				 array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
		'total_paid_tax_incl' =>		 array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		'total_paid_tax_excl' =>		 array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		'total_paid_real' =>			 array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
		'total_products' =>			 array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
		'total_products_wt' =>			 array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
		'total_shipping' =>			 array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		'total_shipping_tax_incl' =>	array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		'total_shipping_tax_excl' =>	array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		'carrier_tax_rate' =>			 array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
		'total_wrapping' =>			 array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		'total_wrapping_tax_incl' =>	array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		'total_wrapping_tax_excl' =>	array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
		'shipping_number' =>			 array('type' => self::TYPE_STRING, 'validate' => 'isTrackingNumber'),
		'conversion_rate' =>			 array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true),
		'invoice_number' =>			 array('type' => self::TYPE_INT),
		'delivery_number' =>			 array('type' => self::TYPE_INT),
		'invoice_date' =>				 array('type' => self::TYPE_DATE),
		'delivery_date' =>				 array('type' => self::TYPE_DATE),
		'valid' =>						 array('type' => self::TYPE_BOOL),
		'reference' =>					 array('type' => self::TYPE_STRING),
		'date_add' =>					 array('type' => self::TYPE_DATE,  'validate' => 'isDate'),
		'date_upd' =>					array('type' => self::TYPE_DATE,  'validate' => 'isDate'),
		  'datelivraison' =>				array('type' => self::TYPE_STRING,'validate' => 'isMessage'),
	),
);
}

 

Peux-tu poster aussi le tpl modifié pour que je puisse tester les deux ?

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

Bonsoir,

 

Merci de ton retour.

Malheureusement ça ne marche pas non plus, toujours le bug à la validation de la commande.

 

Mon order-carrier.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
*}
{*
** Retro compatibility for PrestaShop version < 1.4.2.5 with a recent theme
** Syntax smarty for v2
*}
{* Will be deleted for 1.5 version and more *}
{if !isset($formatedAddressFieldsValuesList)}
{$ignoreList.0 = "id_address"}
{$ignoreList.1 = "id_country"}
{$ignoreList.2 = "id_state"}
{$ignoreList.3 = "id_customer"}
{$ignoreList.4 = "id_manufacturer"}
{$ignoreList.5 = "id_supplier"}
{$ignoreList.6 = "date_add"}
{$ignoreList.7 = "date_upd"}
{$ignoreList.8 = "active"}
{$ignoreList.9 = "deleted"}
{* PrestaShop 1.4.0.17 compatibility *}
{if isset($addresses)}
 {foreach from=$addresses key=k item=address}
  {counter start=0 skip=1 assign=address_key_number}
  {$id_address = $address.id_address}
  {foreach from=$address key=address_key item=address_content}
   {if !in_array($address_key, $ignoreList)}
 {$formatedAddressFieldsValuesList.$id_address.ordered_fields.$address_key_number = $address_key}
 {$formatedAddressFieldsValuesList.$id_address.formated_fields_values.$address_key = $address_content}
 {counter}
   {/if}
  {/foreach}
 {/foreach}
{/if}
{/if}
<script type="text/javascript">
// <![CDATA[
{if !$opc}
var orderProcess = 'order';
var currencySign = '{$currencySign|html_entity_decode:2:"UTF-8"}';
var currencyRate = '{$currencyRate|floatval}';
var currencyFormat = '{$currencyFormat|intval}';
var currencyBlank = '{$currencyBlank|intval}';
var txtProduct = "{l s='product' js=1}";
var txtProducts = "{l s='products' js=1}";
{/if}

var addressMultishippingUrl = "{$link->getPageLink('address', true, NULL, "back={$back_order_page}?step=1{'&multi-shipping=1'|urlencode}{if $back}&mod={$back|urlencode}{/if}")}";
var addressUrl = "{$link->getPageLink('address', true, NULL, "back={$back_order_page}?step=1{if $back}&mod={$back}{/if}")}";
var formatedAddressFieldsValuesList = new Array();
{foreach from=$formatedAddressFieldsValuesList key=id_address item=type}
 formatedAddressFieldsValuesList[{$id_address}] =
 {ldelim}
  'ordered_fields':[
   {foreach from=$type.ordered_fields key=num_field item=field_name name=inv_loop}
 {if !$smarty.foreach.inv_loop.first},{/if}"{$field_name}"
   {/foreach}
  ],
  'formated_fields_values':{ldelim}
 {foreach from=$type.formated_fields_values key=pattern_name item=field_name name=inv_loop}
  {if !$smarty.foreach.inv_loop.first},{/if}"{$pattern_name}":"{$field_name}"
 {/foreach}
   {rdelim}
 {rdelim}
{/foreach}
function getAddressesTitles()
{
 return {
  'invoice': "{l s='Your billing address' js=1}",
  'delivery': "{l s='Your delivery address' js=1}"
  };
}

function buildAddressBlock(id_address, address_type, dest_comp)
{
 var adr_titles_vals = getAddressesTitles();
 var li_content = formatedAddressFieldsValuesList[id_address]['formated_fields_values'];
 var ordered_fields_name = ['title'];
 ordered_fields_name = ordered_fields_name.concat(formatedAddressFieldsValuesList[id_address]['ordered_fields']);
 ordered_fields_name = ordered_fields_name.concat(['update']);
 dest_comp.html('');
 li_content['title'] = adr_titles_vals[address_type];
 li_content['update'] = '<a href="{$link->getPageLink('address', true, NULL, "id_address")}'+id_address+'&back={$back_order_page}?step=1{if $back}&mod={$back}{/if}" style="color:#999999" title="{l s='Update' js=1}">{l s='Update' js=1}</a>';
 appendAddressList(dest_comp, li_content, ordered_fields_name);
}
function appendAddressList(dest_comp, values, fields_name)
{
 for (var item in fields_name)
 {
  var name = fields_name[item];
  var value = getFieldValue(name, values);
  if (value != "")
  {
   var new_li = document.createElement('li');
   new_li.className = 'address_'+ name;
   new_li.innerHTML = getFieldValue(name, values);
   dest_comp.append(new_li);
  }
 }
}
function getFieldValue(field_name, values)
{
 var reg=new RegExp("[ ]+", "g");
 var items = field_name.split(reg);
 var vals = new Array();
 for (var field_item in items)
 {
  items[field_item] = items[field_item].replace(",", "");
  vals.push(values[items[field_item]]);
 }
 return vals.join(" ");
}
//]]>
</script>
{if !$opc}
<script type="text/javascript">
//<![CDATA[
var orderProcess = 'order';
var currencySign = '{$currencySign|html_entity_decode:2:"UTF-8"}';
var currencyRate = '{$currencyRate|floatval}';
var currencyFormat = '{$currencyFormat|intval}';
var currencyBlank = '{$currencyBlank|intval}';
var txtProduct = "{l s='Product' js=1}";
var txtProducts = "{l s='Products' js=1}";
var orderUrl = '{$link->getPageLink("order", true)}';
var msg = "{l s='You must agree to the terms of service before continuing.' js=1}";
{literal}
function acceptCGV()
{
 if ($('#cgv').length && !$('input#cgv:checked').length)
 {
  alert(msg);
  return false;
 }
 else
  return true;
}
{/literal}
//]]>
</script>
{else}
<script type="text/javascript">
 var txtFree = "{l s='Free'}";
</script>
{/if}
{if isset($virtual_cart) && !$virtual_cart && $giftAllowed && $cart->gift == 1}
<script type="text/javascript">
{literal}
// <![CDATA[
$('document').ready( function(){
 if ($('input#gift').is(':checked'))
  $('p#gift_div').show();
});
//]]>
{/literal}
</script>
{/if}

{if !$opc}
{assign var='current_step' value='shipping'}
{include file="$tpl_dir./order-steps.tpl"}

{include file="$tpl_dir./errors.tpl"}
<div style="width:955px; margin-right:auto; margin-left:auto; padding-left:25px">
 <h1 style="margin:10px 0">
{l s='Recall of the delivery address'}</h1>		
<div style="font-size:12px; margin-bottom:20px; padding-left:10px">
{foreach from=$addresses key=k item=address}
{if $address.id_address == $cart->id_address_delivery}
{if $address.company != NULL}{$address.company|escape:'htmlall':'UTF-8'}<br/>{/if}
<p style="font-size:14px; color:#FC7B7B; margin-bottom:4px"><strong>{$address.lastname|escape:'htmlall':'UTF-8'} {$address.firstname|escape:'htmlall':'UTF-8'}</strong></p>
{$address.address1|escape:'htmlall':'UTF-8'}<br/>
{if $address.address2!=NULL}{$address.address2|escape:'htmlall':'UTF-8'}<br/>{/if}
{$address.id_state|escape:'htmlall':'UTF-8'} {$address.city|escape:'htmlall':'UTF-8'}<br/>
{if $address.phone!=NULL}<em>{$address.phone|escape:'htmlall':'UTF-8'} {if $address.phone_mobile!=NULL} - {/if}</em>{/if}
{if $address.phone_mobile!=NULL}<em>{$address.phone_mobile|escape:'htmlall':'UTF-8'}</em>{/if}

{/if} 
{/foreach}

</div>
 <h1 style="margin:10px 0">
{l s='Delivery price'}</h1>
<div style="font-size:14px; margin-bottom:20px; padding-left:10px">
{foreach from=$carriers item=carrier name=myLoop}
   <td class="carrier_price">
   {if $carrier.price}
   <span class="price">
    {if $priceDisplay == 1}<p style="font-size:14px; color:#FC7B7B; margin-bottom:4px">{convertPrice price=$carrier.price_tax_exc}</p>{else}<p style="font-size:14px; color:#FC7B7B; margin-bottom:4px">{convertPrice price=$carrier.price}</p>{/if}
   </span>

  {else}
   <p style="font-size:14px; color:#FC7B7B; margin-bottom:4px">{l s='Free !'}</p>
  {/if}
 </td>
   </tr>

  {/foreach}
</div>
<h1 style="margin:10px 0">


{l s='Delivery day'}</h1>
<form id="form" action="{$link->getPageLink('order', true, NULL, "multi-shipping={$multi_shipping}")}" method="post" onsubmit="return acceptCGV();">	

{if (($smarty.now|date_format:'%A %e %B - %H:%M')>={$smarty.now|date_format:"%A %e %B - 23:00"})&& (($smarty.now|date_format:'%A %e %B - %H:%M')<={$smarty.now|date_format:"%A %e %B - 23:59"})}
<div class="datelivraison">
{"+2day"|date_format:"%A %e %B"}<br>
<input style="margin-top:10px" type="radio" name="datelivraison" id="datelivraison" value="{"+2day"|date_format:"%A %e %B"}" />
</div>
<div class="datelivraison">
{"+3days"|date_format:"%A %e %B"}<br>
<input style="margin-top:10px" type="radio" name="datelivraison" id="datelivraison" value="{"+3days"|date_format:"%A %e %B"}" />
</div>
<div class="datelivraison">
{"+4days"|date_format:"%A %e %B"}<br>
<input style="margin-top:10px" type="radio" name="datelivraison" id="datelivraison" value="{"+4days"|date_format:"%A %e %B"}" />
</div>
<div class="datelivraison">
{"+5days"|date_format:"%A %e %B"}<br>
<input style="margin-top:10px" type="radio" name="datelivraison" id="datelivraison" value="{"+5days"|date_format:"%A %e %B"}" />
</div>
<div class="datelivraison">
{"+6days"|date_format:"%A %e %B"}<br>
<input style="margin-top:10px" type="radio" name="datelivraison" id="datelivraison" value="{"+6days"|date_format:"%A %e %B"}" />
</div>
<div class="datelivraison">
{"+7days"|date_format:"%A %e %B"}<br>
<input style="margin-top:10px" type="radio" name="datelivraison" id="datelivraison" value="{"+7days"|date_format:"%A %e %B"}" />
</div>
<div class="datelivraison">
{"+8days"|date_format:"%A %e %B"}<br>
<input style="margin-top:10px" type="radio" name="datelivraison" id="datelivraison" value="{"+8days"|date_format:"%A %e %B"}" />
</div>
{else}
<div class="datelivraison">
{"+1day"|date_format:"%A %e %B"}<br>
<input style="margin-top:10px" type="radio" name="datelivraison" id="datelivraison" value="{"+1day"|date_format:"%A %e %B"}" />
</div>
<div class="datelivraison">
{"+2days"|date_format:"%A %e %B"}<br>
<input style="margin-top:10px" type="radio" name="datelivraison" id="datelivraison" value="{"+2days"|date_format:"%A %e %B"}" />
</div>
<div class="datelivraison">
{"+3days"|date_format:"%A %e %B"}<br>
<input style="margin-top:10px" type="radio" name="datelivraison" id="datelivraison" value="{"+3days"|date_format:"%A %e %B"}" />
</div>
<div class="datelivraison">
{"+4days"|date_format:"%A %e %B"}<br>
<input style="margin-top:10px" type="radio" name="datelivraison" id="datelivraison" value="{"+4days"|date_format:"%A %e %B"}" />
</div>
<div class="datelivraison">
{"+5days"|date_format:"%A %e %B"}<br>
<input style="margin-top:10px" type="radio" name="datelivraison" id="datelivraison" value="{"+5days"|date_format:"%A %e %B"}" />
</div>
<div class="datelivraison">
{"+6days"|date_format:"%A %e %B"}<br>
<input style="margin-top:10px" type="radio" name="datelivraison" id="datelivraison" value="{"+6days"|date_format:"%A %e %B"}" />
</div>
<div class="datelivraison">
{"+7days"|date_format:"%A %e %B"}<br>
<input style="margin-top:10px" type="radio" name="datelivraison" id="datelivraison" value="{"+7days"|date_format:"%A %e %B"}" />
</div>
{/if}

    <div style="clear:both"><br><br></div>
 <h1 style="margin:10px 0">
{l s='Delivery time'}</h1> 


{if $carrier.name=="Banlieue"}
<div class="heurelivraison">
 8h00-8h45<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="8h00-8h45" />
</div>
<div class="heurelivraison">
8h45-9h30<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="8h45-9h30" />
</div>
<div class="heurelivraison">
9h30-10h15<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="9h30-10h15" />
</div>
<div class="heurelivraison">
10h15-11h00<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="10h15-11h00" />
</div>
<div class="heurelivraison">
11h00-11h45<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="10h15-11h45" />
</div>
<div class="heurelivraison">
11h45-12h30<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="11h45-12h30" />
</div>
<div class="heurelivraison">
12h30-13h15<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="12h30-13h15" />
</div>
<div class="heurelivraison">
13h15-14h00<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="13h15-14h00" />
</div>
<div class="heurelivraison">
14h00-15h00<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="14h00-15h00" />
</div>
{else}		
<div class="heurelivraison">
 8h00-8h30<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="8h00-8h30" />
</div>
<div class="heurelivraison">
8h30-9h00<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="8h30-9h00" />
</div>
<div class="heurelivraison">
9h00-9h30<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="9h00-9h30" />
</div>
<div class="heurelivraison">
9h30-10h00<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="9h30-10h00" />
</div>
<div class="heurelivraison">
10h00-10h30<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="10h00-10h30" />
</div>
<div class="heurelivraison">
10h30-11h00<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="10h30-11h00" />
</div>
<div class="heurelivraison">
11h00-11h30<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="11h00-11h30" />
</div>
<div class="heurelivraison">
11h30-12h00<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="11h30-12h00" />
</div>
<div class="heurelivraison">
12h00-12h30<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="12h00-12h30" />
</div>
<div class="heurelivraison">
12h30-13h00<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="12h30-13h00" />
</div>
<div class="heurelivraison">
13h00-13h30<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="13h00-13h30" />
</div>
<div class="heurelivraison">
13h30-14h00<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="13h30-14h00" />
</div>
<div class="heurelivraison">
14h00-14h30<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="14h00-14h30" />
</div>
<div class="heurelivraison" style="margin-right:0">
14h30-15h00<br>
<input style="margin-top:5px" type="radio" name="heurelivraison" id="heurelivraison" value="14h30-15h00" />
</div>
{/if}
<div style="clear:both"><br><br></div>
 <h1 style="margin:10px 0">
{l s='Gift'}</h1> 
<p class="checkbox" style="padding-left:10px">
 <input type="checkbox" name="gift" id="gift"  value="1" {if $checkedTOS}checked="checked"{/if} />
 <label for="gift">{l s='This order is a gift (No invoice will be sent to the delivery, but only available in your account)'}</label>
</p>
   <p style="margin-top:10px">{l s='Gift Message attached with the order'}<br>
<textarea maxlength="250" cols="185" rows="5"  id="gift_message" name="gift_message"style=" margin-top:2px;border:3px solid #474747;border-radius: 5px 5px 5px 5px;box-shadow: 0 5px 5px 0 #F5F5F5;color: #333333;
   font-family: Helvetica Neue,Helvetica,Arial,sans-serif;">{if isset($oldMessage)}{$oldMessage|escape:'htmlall':'UTF-8'}{/if}</textarea></p>
   <div style="clear:both"><br><br></div>
<h1 style="margin:10px 0">
{l s='Terms of service'}</h1> 
{if $conditions AND $cms_id}

<p class="checkbox" style="padding-left:10px">
 <input type="checkbox" name="cgv" id="cgv" value="1" {if $checkedTOS}checked="checked"{/if} />
 <label for="cgv">{l s='I agree to the terms of service and will adhere to them unconditionally.'}</label> <a href="{$link_conditions}" class="iframe">{l s='(Read the Terms of Service)'}</a>
</p>
<script type="text/javascript">{literal}$('a.iframe').fancybox({width:980, height:570});{/literal}</script>
{/if}

{else}
<div id="opc_delivery_methods" class="opc-main-block">
<div id="opc_delivery_methods-overlay" class="opc-overlay" style="display: none;"></div>
{/if}
<div class="order_carrier_content"style="display: none;">
{if isset($virtual_cart) && $virtual_cart}
<input id="input_virtual_carrier" class="hidden" type="hidden" name="id_carrier" value="0" />
{else}
<h3 class="carrier_title">{l s='Choose your delivery method'}</h3>

<div id="HOOK_BEFORECARRIER">
 {if isset($carriers) && isset($HOOK_BEFORECARRIER)}
  {$HOOK_BEFORECARRIER}
 {/if}
</div>
{if isset($isVirtualCart) && $isVirtualCart}
 <p class="warning">{l s='No carrier is needed for this order.'}</p>
{else}
 {if $recyclablePackAllowed}
  <p class="checkbox">
   <input type="checkbox" name="recyclable" id="recyclable" value="1" {if $recyclable == 1}checked="checked"{/if} />
   <label for="recyclable">{l s='I would like to receive my order in recycled packaging.'}.</label>
  </p>
 {/if}
<div class="delivery_options_address" style="display:true">
{if isset($delivery_option_list)}
 {foreach $delivery_option_list as $id_address => $option_list}
  <h3>
   {if isset($address_collection[$id_address])}
 {l s='Choose a shipping option for this address:'} {$address_collection[$id_address]->alias}
   {else}
 {l s='Choose a shipping option'}
   {/if}
  </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}]" onchange="{if $opc}updateCarrierSelectionAndGift();{else}updateExtraCarrier('{$key}', {$id_address});{/if}" id="delivery_option_{$id_address}_{$option@index}" value="{$key}" {if isset($delivery_option[$id_address]) && $delivery_option[$id_address] == $key}checked="checked"{/if} />
 <label for="delivery_option_{$id_address}_{$option@index}">
  <table class="resume">
   <tr>
    <td class="delivery_option_logo">
	 {foreach $option.carrier_list as $carrier}
	  {if $carrier.logo}
	   <img src="{$carrier.logo}" alt="{$carrier.instance->name}"/>
	  {else if !$option.unique_carrier}
	   {$carrier.instance->name}
	   {if !$carrier@last} - {/if}
	  {/if}
	 {/foreach}
    </td>
    <td>
    {if $option.unique_carrier}
	 {foreach $option.carrier_list as $carrier}
	  <div class="delivery_option_title">{$carrier.instance->name}</div>
	 {/foreach}
	 {if isset($carrier.instance->delay[$cookie->id_lang])}
	  <div class="delivery_option_delay">{$carrier.instance->delay[$cookie->id_lang]}</div>
	 {/if}
    {/if}

    </td>
    <td>
    <div class="delivery_option_price">
	 {if $option.total_price_with_tax && (!isset($free_shipping) || (isset($free_shipping) && !$free_shipping))}
	  {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 {if isset($delivery_option[$id_address]) && $delivery_option[$id_address] == $key}selected{/if} {if $option.unique_carrier}not-displayable{/if}">
   {foreach $option.carrier_list as $carrier}
   <tr>
    {if !$option.unique_carrier}
    <td class="first_item">
    <input type="hidden" value="{$carrier.instance->id}" name="id_carrier" />
	 {if $carrier.logo}
	  <img src="{$carrier.logo}" alt="{$carrier.instance->name}"/>
	 {/if}
    </td>
    <td>
	 {$carrier.instance->name}
    </td>
    {/if}
    <td {if $option.unique_carrier}class="first_item" colspan="2"{/if}>
	 <input type="hidden" value="{$carrier.instance->id}" name="id_carrier" />
	 {if isset($carrier.instance->delay[$cookie->id_lang])}
	  {$carrier.instance->delay[$cookie->id_lang]}<br />
	  {if count($carrier.product_list) <= 1}
	   ({l s='Product concerned:'}
	  {else}
	   ({l s='Products concerned:'}
	  {/if}
	  {* This foreach is on one line, to avoid tabulation in the title attribute of the acronym *}
	  {foreach $carrier.product_list as $product}
	  {if $product@index == 4}<acronym title="{/if}{if $product@index >= 4}{$product.name}{if !$product@last}, {else}">...</acronym>){/if}{else}{$product.name}{if !$product@last}, {else}){/if}{/if}{/foreach}
	 {/if}
    </td>
   </tr>
  {/foreach}
  </table>
 </label>
   </div>
  {/foreach}
  </div>








  <div class="hook_extracarrier" id="HOOK_EXTRACARRIER_{$id_address}">{if isset($HOOK_EXTRACARRIER_ADDR) &&  isset($HOOK_EXTRACARRIER_ADDR.$id_address)}{$HOOK_EXTRACARRIER_ADDR.$id_address}{/if}</div>
  {foreachelse}
  <p class="warning" id="noCarrierWarning">
   {foreach $cart->getDeliveryAddressesWithoutCarriers(true) as $address}
 {if empty($address->alias)}
  {l s='No carriers available.'}
 {else}
  {l s='No carriers available for the address "%s".' sprintf=$address->alias}
 {/if}
 {if !$address@last}
 <br />
 {/if}
   {/foreach}
  </p>
 {/foreach}
{/if}

</div>

<div style="display: none;" id="extra_carrier"></div>





 {if $giftAllowed}

 {/if}
{/if}
{/if}

</div>
{if !$opc}
<p class="cart_navigation submit">
 <input type="hidden" name="step" value="3" />
 <input type="hidden" name="back" value="{$back}" />
 {if !$is_guest}
  {if $back}
   <a href="{$link->getPageLink('order', true, NULL, "step=1&back={$back}&multi-shipping={$multi_shipping}")}" title="{l s='Previous'}" class="button">« {l s='Previous'}</a>
  {else}
   <a href="{$link->getPageLink('order', true, NULL, "step=1&multi-shipping={$multi_shipping}")}" title="{l s='Previous'}" class="button">« {l s='Previous'}</a>
  {/if}
 {else}
   <a href="{$link->getPageLink('order', true, NULL, "multi-shipping={$multi_shipping}")}" title="{l s='Previous'}" class="button">« {l s='Previous'}</a>
 {/if}
 {if isset($virtual_cart) && $virtual_cart || (isset($delivery_option_list) && !empty($delivery_option_list))}
  <input type="submit" name="processCarrier" value="{l s='Next'} »" class="exclusive" />
 {/if}
</p>
</form>
{else}
<h3>{l s='Leave a message'}</h3>
<div>
 <p>{l s='If you would like to add a comment about your order, please write it in the field below.'}</p>
 <p><textarea cols="120" rows="3" name="message" id="message">{if isset($oldMessage)}{$oldMessage|escape:'htmlall':'UTF-8'}{/if}</textarea></p>
</div>
</div>
{/if}
</div></div>

Link to comment
Share on other sites

Bon Ok, erreur :

 

[b]Notice[/b]: Undefined index: addresses in [b]/Applications/MAMP/htdocs/presdev/cache/smarty/compile/4c/df/dc/4cdfdc80ec015612b6f296ae1c356d1239bda8bc.file.order-carrier.tpl.php[/b] on line [b]350[/b]

[b]Notice[/b]: Trying to get property of non-object in [b]/Applications/MAMP/htdocs/presdev/cache/smarty/compile/4c/df/dc/4cdfdc80ec015612b6f296ae1c356d1239bda8bc.file.order-carrier.tpl.php[/b] on line [b]350[/b]

 

post-459329-0-22271500-1377802614_thumb.png

Link to comment
Share on other sites

Merci pour ton retour.

J'ai bien activé le debug mais je n'ai pas de message d'erreur sur ma page par contre

 

Par contre à la validation du paiement j'ai ce message sur la page validation

 

Column 'datelivraison' cannot be null

INSERT INTO `ps_orders` (`id_address_delivery`, `id_address_invoice`, `id_cart`, `id_currency`, `id_shop_group`, `id_shop`, `id_lang`, `id_customer`, `id_carrier`, `current_state`, `secure_key`, `payment`, `module`, `recyclable`, `gift`, `gift_message`, `mobile_theme`, `total_discounts`, `total_discounts_tax_incl`, `total_discounts_tax_excl`, `total_paid`, `total_paid_tax_incl`, `total_paid_tax_excl`, `total_paid_real`, `total_products`, `total_products_wt`, `total_shipping`, `total_shipping_tax_incl`, `total_shipping_tax_excl`, `carrier_tax_rate`, `total_wrapping`, `total_wrapping_tax_incl`, `total_wrapping_tax_excl`, `shipping_number`, `conversion_rate`, `invoice_number`, `delivery_number`, `invoice_date`, `delivery_date`, `valid`, `reference`, `date_add`, `date_upd`, `datelivraison`) VALUES ('11', '11', '44', '1', '1', '1', '1', '190', '6', '0', '1a729987f96036f8d1455cdba87edad2', 'Virement bancaire', 'bankwire', '0', '0', 'dd', '0', '0', '0', '0', '60', '60', '56.08', '0', '56.08', '60', '0', '0', '0', '19.6', '0', '0', '0', NULL, '1', '0', '0', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0', 'CAXBLPOHU', '2013-08-30 08:18:34', '2013-08-30 08:18:34', NULL)
at line 613 in file classes/db/Db.php


607.	WebserviceRequest::getInstance()->setError(500, '[sql Error] '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);
608.   }
609.   else if (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS'))
610.   {
611.	if ($sql)
612.	 throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');
613.	throw new PrestaShopDatabaseException($this->getMsgError());
614.   }
615.  }
616.
617.  /**

 

Ce qui est bizarre c'est que ma donnée datelivraison est NULL donc pas récupérée.

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

Plus clair comme message que

Oops, something went wrong.

Try to refresh this page or feel free to contact us if the problem persists.

 

Tu ne penses pas ? :)

 

Le premier message vient du fait que je n'ai pas le carrier.name

{if $carrier.name=="Banlieue"}

[

CODE]Notice: Undefined index: addresses in /Applications/MAMP/htdocs/presdev/cache/smarty/compile/4c/df/dc/4cdfdc80ec015612b6f296ae1c356d1239bda8bc.file.order-carrier.tpl.php on line 350

 

Notice: Trying to get property of non-object in /Applications/MAMP/htdocs/presdev/cache/smarty/compile/4c/df/dc/4cdfdc80ec015612b6f296ae1c356d1239bda8bc.file.order-carrier.tpl.php on line 350[/code]

 

Pour la commande, j'avais hier soir déjà le problème.

Column 'datelivraison' cannot be null INSERT INTO `ps_orders` (`id_address_delivery`, `id_address_invoice`, `id_cart`, `id_currency`, `id_shop_group`, `id_shop`, `id_lang`, `id_customer`, `id_carrier`, `current_state`, `secure_key`, `payment`, `module`, `recyclable`, `gift`, `gift_message`, `mobile_theme`, `total_discounts`, `total_discounts_tax_incl`, `total_discounts_tax_excl`, `total_paid`, `total_paid_tax_incl`, `total_paid_tax_excl`, `total_paid_real`, `total_products`, `total_products_wt`, `total_shipping`, `total_shipping_tax_incl`, `total_shipping_tax_excl`, `carrier_tax_rate`, `total_wrapping`, `total_wrapping_tax_incl`, `total_wrapping_tax_excl`, `shipping_number`, `conversion_rate`, `invoice_number`, `delivery_number`, `invoice_date`, `delivery_date`, `valid`, `reference`, `date_add`, `date_upd`, `datelivraison`) VALUES ('11', '11', '44', '1', '1', '1', '1', '190', '6', '0', '1a729987f96036f8d1455cdba87edad2', 'Virement bancaire', 'bankwire', '0', '0', 'dd', '0', '0', '0', '0', '60', '60', '56.08', '0', '56.08', '60', '0', '0', '0', '19.6', '0', '0', '0', NULL, '1', '0', '0', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0', 'CAXBLPOHU', '2013-08-30 08:18:34', '2013-08-30 08:18:34', NULL) at line 613 in file classes/db/Db.php

 

Ce qui est bizarre c'est que ma donnée datelivraison est NULL donc pas récupérée.

Absolument ;)

Link to comment
Share on other sites

C'est vrai que c'est plus clair :)

 

Par contre la méthode en 1.5 c'est bien que ce que l'on fait pour insérer dans la BDD ?

 

Sur la version 1.4 dans la classe order je faisais (c'était $day et $heure) :

 

/** @var string Object last modification date */
public   $day;
protected $tables = array ('orders');
protected $fieldsRequired = array('conversion_rate', 'id_address_delivery', 'id_address_invoice', 'id_cart', 'id_currency', 'id_lang', 'id_customer', 'id_carrier', 'payment', 'total_paid', 'total_paid_real', 'total_products', 'total_products_wt');
protected $fieldsValidate = array(
 'id_address_delivery' => 'isUnsignedId',
 'id_address_invoice' => 'isUnsignedId',
 'id_cart' => 'isUnsignedId',
 'id_currency' => 'isUnsignedId',
 'id_lang' => 'isUnsignedId',
 'id_customer' => 'isUnsignedId',
 'id_carrier' => 'isUnsignedId',
 'secure_key' => 'isMd5',
 'payment' => 'isGenericName',
 'recyclable' => 'isBool',
 'gift' => 'isBool',
 'gift_message' => 'isMessage',
 'total_discounts' => 'isPrice',
 'total_paid' => 'isPrice',
 'total_paid_real' => 'isPrice',
 'total_products' => 'isPrice',
 'total_products_wt' => 'isPrice',
 'total_shipping' => 'isPrice',
 'carrier_tax_rate' => 'isFloat',
 'total_wrapping' => 'isPrice',
 'shipping_number' => 'isUrl',
  'conversion_rate' => 'isFloat',
 'heure' => 'isMessage',
 'day' => 'isMessage'
);

et

* MySQL does not allow 'order' for a table name */
protected  $table = 'orders';
protected  $identifier = 'id_order';
protected  $_taxCalculationMethod = PS_TAX_EXC;
protected static $_historyCache = array();
public function getFields()
{
 parent::validateFields();
 $fields['id_address_delivery'] = (int)($this->id_address_delivery);
 $fields['id_address_invoice'] = (int)($this->id_address_invoice);
 $fields['id_cart'] = (int)($this->id_cart);
 $fields['id_currency'] = (int)($this->id_currency);
 $fields['id_lang'] = (int)($this->id_lang);
 $fields['id_customer'] = (int)($this->id_customer);
 $fields['id_carrier'] = (int)($this->id_carrier);
 $fields['secure_key'] = pSQL($this->secure_key);
 $fields['payment'] = pSQL($this->payment);
 $fields['module'] = pSQL($this->module);
 $fields['conversion_rate'] = (float)($this->conversion_rate);
 $fields['recyclable'] = (int)($this->recyclable);
 $fields['gift'] = (int)($this->gift);
 $fields['gift_message'] = pSQL($this->gift_message);
 $fields['shipping_number'] = pSQL($this->shipping_number);
 $fields['total_discounts'] = (float)($this->total_discounts);
 $fields['total_paid'] = (float)($this->total_paid);
 $fields['total_paid_real'] = (float)($this->total_paid_real);
 $fields['total_products'] = (float)($this->total_products);
 $fields['total_products_wt'] = (float)($this->total_products_wt);
 $fields['total_shipping'] = (float)($this->total_shipping);
 $fields['carrier_tax_rate'] = (float)($this->carrier_tax_rate);
 $fields['total_wrapping'] = (float)($this->total_wrapping);
 $fields['invoice_number'] = (int)($this->invoice_number);
 $fields['delivery_number'] = (int)($this->delivery_number);
 $fields['invoice_date'] = pSQL($this->invoice_date);
 $fields['delivery_date'] = pSQL($this->delivery_date);
 $fields['valid'] = (int)($this->valid) ? 1 : 0;
 $fields['date_add'] = pSQL($this->date_add);
 $fields['date_upd'] = pSQL($this->date_upd);
 $fields['heure'] = pSQL($this->heure);
 $fields['day'] = pSQL($this->day);
 return $fields;
}

Link to comment
Share on other sites

Il est possible qu'il faille utiliser un parent pour retourner à la classe d'origine et à la function

 

public function getFields()
{
 parent::validateFields();

 

    /**
    * @see ObjectModel::getFields()
    * @return array
    */
   public function getFields()
   {
       if (!$this->id_lang)
           $this->id_lang = Configuration::get('PS_LANG_DEFAULT', null, null, $this->id_shop);

       return parent::getFields();
   }

   public function add($autodate = true, $null_values = true)
   {
       if (parent::add($autodate, $null_values))
           return SpecificPrice::deleteByIdCart($this->id_cart);
       return false;
   }

 

Désolé, mais là il faut que je parte. je suis très en retard. :huh:

Link to comment
Share on other sites

  • 2 weeks later...

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...