// withdraw empty lines, convert line feeds to \r\n

This commit is contained in:
gRoussac
2013-02-26 10:58:03 +01:00
parent e3a47635aa
commit 8740deeb05
+113 -122
View File
@@ -1,122 +1,113 @@
{* {*
* 2007-2013 PrestaShop * 2007-2013 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
* This source file is subject to the Academic Free License (AFL 3.0) * This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt. * that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php * http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to * 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 * obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately. * to license@prestashop.com so we can send you a copy immediately.
* *
* DISCLAIMER * DISCLAIMER
* *
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer * 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 * versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information. * needs please refer to http://www.prestashop.com for more information.
* *
* @author PrestaShop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA * @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
{ldelim}
{ldelim} "products": [
"products": [ {if $products}
{if $products} {foreach from=$products item=product name='products'}
{foreach from=$products item=product name='products'} {assign var='productId' value=$product.id_product}
{assign var='productId' value=$product.id_product} {assign var='productAttributeId' value=$product.id_product_attribute}
{assign var='productAttributeId' value=$product.id_product_attribute} {ldelim}
{ldelim} "id": {$product.id_product},
"id": {$product.id_product}, "link": "{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|addslashes|replace:'\\\'':'\''}",
"link": "{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|addslashes|replace:'\\\'':'\''}", "quantity": {$product.cart_quantity},
"quantity": {$product.cart_quantity}, "priceByLine": "{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total}{else}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total_wt}{/if}",
"priceByLine": "{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total}{else}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total_wt}{/if}", "name": "{$product.name|html_entity_decode:2:'UTF-8'|escape:'htmlall'|truncate:15:'...':true}",
"name": "{$product.name|html_entity_decode:2:'UTF-8'|escape:'htmlall'|truncate:15:'...':true}", "price": "{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total}{else}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total_wt}{/if}",
"price": "{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total}{else}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total_wt}{/if}", "price_float": "{$product.total}",
"price_float": "{$product.total}", "idCombination": {if isset($product.attributes_small)}{$productAttributeId}{else}0{/if},
"idCombination": {if isset($product.attributes_small)}{$productAttributeId}{else}0{/if}, "idAddressDelivery": {if isset($product.id_address_delivery)}{$product.id_address_delivery}{else}0{/if},
"idAddressDelivery": {if isset($product.id_address_delivery)}{$product.id_address_delivery}{else}0{/if}, "is_gift" : {if isset($product.is_gift) && $product.is_gift}1{else}0{/if},
"is_gift" : {if isset($product.is_gift) && $product.is_gift}1{else}0{/if}, {if isset($product.attributes_small)}
{if isset($product.attributes_small)} "hasAttributes": true,
"hasAttributes": true, "attributes": "{$product.attributes_small|addslashes|replace:'\\\'':'\''}",
"attributes": "{$product.attributes_small|addslashes|replace:'\\\'':'\''}", {else}
{else} "hasAttributes": false,
"hasAttributes": false, {/if}
{/if} "hasCustomizedDatas": {if isset($customizedDatas.$productId.$productAttributeId)}true{else}false{/if},
"hasCustomizedDatas": {if isset($customizedDatas.$productId.$productAttributeId)}true{else}false{/if}, "customizedDatas":[
{if isset($customizedDatas.$productId.$productAttributeId[$product.id_address_delivery])}
"customizedDatas":[ {foreach from=$customizedDatas.$productId.$productAttributeId[$product.id_address_delivery] key='id_customization' item='customization' name='customizedDatas'}{ldelim}
{if isset($customizedDatas.$productId.$productAttributeId[$product.id_address_delivery])} {* This empty line was made in purpose (product addition debug), please leave it here *}
{foreach from=$customizedDatas.$productId.$productAttributeId[$product.id_address_delivery] key='id_customization' item='customization' name='customizedDatas'}{ldelim} "customizationId": {$id_customization},
{* This empty line was made in purpose (product addition debug), please leave it here *} "quantity": "{$customization.quantity}",
"datas": [
"customizationId": {$id_customization}, {foreach from=$customization.datas key='type' item='datas' name='customization'}
"quantity": "{$customization.quantity}", {ldelim}
"datas": [ "type": "{$type}",
{foreach from=$customization.datas key='type' item='datas' name='customization'} "datas":
{ldelim} [
"type": "{$type}", {foreach from=$datas key='index' item='data' name='datas'}
"datas": {ldelim}
[ "index": {$index},
{foreach from=$datas key='index' item='data' name='datas'} "value": "{$data.value|addslashes|replace: '\\\'':'\''}",
{ldelim} "truncatedValue": "{$data.value|truncate:28:'...'|addslashes|replace: '\\\'':'\''}"
"index": {$index}, {rdelim}{if !$smarty.foreach.datas.last},{/if}
"value": "{$data.value|addslashes|replace: '\\\'':'\''}", {/foreach}]
"truncatedValue": "{$data.value|truncate:28:'...'|addslashes|replace: '\\\'':'\''}" {rdelim}{if !$smarty.foreach.customization.last},{/if}
{rdelim}{if !$smarty.foreach.datas.last},{/if} {/foreach}
{/foreach}] ]
{rdelim}{if !$smarty.foreach.customization.last},{/if} {rdelim}{if !$smarty.foreach.customizedDatas.last},{/if}
{/foreach} {/foreach}
] {/if}
{rdelim}{if !$smarty.foreach.customizedDatas.last},{/if} ]
{/foreach} {rdelim}{if !$smarty.foreach.products.last},{/if}
{/if} {/foreach}{/if}
] ],
"discounts": [
{if $discounts}{foreach from=$discounts item=discount name='discounts'}
{rdelim}{if !$smarty.foreach.products.last},{/if} {ldelim}
{/foreach}{/if} "id": "{$discount.id_discount}",
], "name": "{$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...'|addslashes|replace:'\\\'':'\''}",
"description": "{$discount.description|addslashes|replace:'\\\'':'\''}",
"discounts": [ "nameDescription": "{$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...'|addslashes|replace:'\\\'':'\''}",
{if $discounts}{foreach from=$discounts item=discount name='discounts'} "code": "{$discount.code}",
{ldelim} "link": "{$link->getPageLink("$order_process", true, NULL, "deleteDiscount={$discount.id_discount}")}",
"id": "{$discount.id_discount}", "price": "{if $priceDisplay == 1}{convertPrice|html_entity_decode:2:'UTF-8' price=$discount.value_tax_exc}{else}{convertPrice|html_entity_decode:2:'UTF-8' price=$discount.value_real}{/if}",
"name": "{$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...'|addslashes|replace:'\\\'':'\''}", "price_float": "{if $priceDisplay == 1}{$discount.value_tax_exc}{else}{$discount.value_real}{/if}"
"description": "{$discount.description|addslashes|replace:'\\\'':'\''}", {rdelim}
"nameDescription": "{$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...'|addslashes|replace:'\\\'':'\''}", {if !$smarty.foreach.discounts.last},{/if}
"code": "{$discount.code}", {/foreach}{/if}
"link": "{$link->getPageLink("$order_process", true, NULL, "deleteDiscount={$discount.id_discount}")}", ],
"price": "{if $priceDisplay == 1}{convertPrice|html_entity_decode:2:'UTF-8' price=$discount.value_tax_exc}{else}{convertPrice|html_entity_decode:2:'UTF-8' price=$discount.value_real}{/if}", "shippingCost": "{$shipping_cost|html_entity_decode:2:'UTF-8'}",
"price_float": "{if $priceDisplay == 1}{$discount.value_tax_exc}{else}{$discount.value_real}{/if}" "shippingCostFloat": "{$shipping_cost_float|html_entity_decode:2:'UTF-8'}",
{rdelim} {if isset($tax_cost)}
{if !$smarty.foreach.discounts.last},{/if} "taxCost": "{$tax_cost|html_entity_decode:2:'UTF-8'}",
{/foreach}{/if} {/if}
], "wrappingCost": "{$wrapping_cost|html_entity_decode:2:'UTF-8'}",
"nbTotalProducts": "{$nb_total_products}",
"shippingCost": "{$shipping_cost|html_entity_decode:2:'UTF-8'}", "total": "{$total|html_entity_decode:2:'UTF-8'}",
"shippingCostFloat": "{$shipping_cost_float|html_entity_decode:2:'UTF-8'}", "productTotal": "{$product_total|html_entity_decode:2:'UTF-8'}",
{if isset($tax_cost)} {if isset($errors) && $errors}
"taxCost": "{$tax_cost|html_entity_decode:2:'UTF-8'}", "hasError" : true,
{/if} "errors" : [
"wrappingCost": "{$wrapping_cost|html_entity_decode:2:'UTF-8'}", {foreach from=$errors key=k item=error name='errors'}
"nbTotalProducts": "{$nb_total_products}", "{$error|addslashes|html_entity_decode:2:'UTF-8'}"
"total": "{$total|html_entity_decode:2:'UTF-8'}", {if !$smarty.foreach.errors.last},{/if}
"productTotal": "{$product_total|html_entity_decode:2:'UTF-8'}", {/foreach}
]
{if isset($errors) && $errors} {else}
"hasError" : true, "hasError" : false
"errors" : [ {/if}
{foreach from=$errors key=k item=error name='errors'} {rdelim}
"{$error|addslashes|html_entity_decode:2:'UTF-8'}"
{if !$smarty.foreach.errors.last},{/if}
{/foreach}
]
{else}
"hasError" : false
{/if}
{rdelim}