blockcart-json.tpl

来自「一款C2C的网店程序 我也是在网上下载的」· TPL 代码 · 共 54 行

TPL
54
字号
{ldelim}
'products': [
{if $products}{foreach from=$products item=product}
	{ldelim}
		'id':            '{$product.id_product}',
		'link':          '{$link->getProductLink($product.id_product, $product.link_rewrite)|addslashes}',
		'quantity':      '{$product.cart_quantity}',
		'priceByLine':   '{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.price_wt*$product.cart_quantity}',
		'name':          '{$product.name|addslashes|truncate:16}',
		'price':         '{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.price_wt}',
{if isset($product.attributes_small)}
		'hasAttributes': true,
		'idCombination': '{$product.id_product_attribute}',
		'attributes':    '{$product.attributes_small|addslashes}'
{else}
		'hasAttributes': false
{/if}
	{rdelim},
{/foreach}{/if}
],

'discounts': [
{if $discounts}{foreach from=$discounts item=discount name='discounts'}
	{ldelim}
		'id':              '{$discount.id_discount}',
		'name':            '{$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...':true:false|addslashes}',
		'description':     '{$discount.description|addslashes}',
		'nameDescription': '{$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...':true:false}',
		'link':            '{$base_dir_ssl}order.php?deleteDiscount={$discount.id_discount}',
		'price':           '-{convertPrice|html_entity_decode:2:'UTF-8' price=$discount.value_real}'
	{rdelim}
	{if !$smarty.foreach.discounts.last},{/if}
{/foreach}{/if}
],

'shippingCost': '{$shipping_cost|html_entity_decode:2:'UTF-8'}',
'wrappingCost': '{$gift_wrapping_price|html_entity_decode:2:'UTF-8'}',
'nbTotalProducts': '{$nb_total_products}',
'total': '{$total|html_entity_decode:2:'UTF-8'}',

{if isset($errors) && $errors}
'hasError' : true,
errors : [
{foreach from=$errors key=k item=error name='errors'}
	'{$error|addslashes}'
	{if !$smarty.foreach.errors.last},{/if}
{/foreach}
]
{else}
'hasError' : false
{/if}

{rdelim}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?