We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15001
    • 697 Posts

    Edit: It was an error in my treasurechest.class after some improvement tentatives. All works fine. This message can be deleted by a moderator. (I cannot do it myself.)

    Hi,

    I’m facing problem when invoking TreasureChest’s `cart` service with the &cart_wrap_template and &cart_template parameters set to custom chunks.
    The template for each cart item is inserted at the wrong place. I expected it to be outputed at the location of the [+cart.content+] placeholder put in the "cart_wrap_template" chunk, but it is put before.

    Is anyone able to see what I’m doing wrong?
    Thanks.


    TreasureChest snippet call from a MODx template:
    [!TreasureChest? &service=`cart` &cart_wrap_template=`assets/snippets/treasure_chest/chunks/ecommerce1_demo_catalogue_cart_wrap.fr.html` &cart_template=`assets/snippets/treasure_chest/chunks/ecommerce1_demo_catalogue_cart_item.fr.html` !]


    The "wrap" template:
    <h4 class="souligne">Contenu du panier</h4>
    <form action="[~[*id*]~]&action=update" method="post" id="treasure_chest_form" name="treasure_chest_form">
        <table id="treasure_chest_cart" cols="3" rows="2" cellpadding="0" cellspacing="0" border="1" style="display:block;" >
    			[+cart.content+]
                <tr id="cart_total">
                	<td class="Datagrid_Item" colspan="2" style="text-align:right;vertical-align:top;"><span style="font-size:10pt;"><b>Total brut</b>, </span> H.T.<br />Hors taxes et frais logistiques.</td>
                    <td class="Datagrid_Item" style="vertical-align:top;text-align:right">
                        CHF <span class="cart_total_amount rouge" style="font-size:10pt;font-weight:bold;">[+cart.total+]</span>
                    </td>
                </tr>
    
                <tr>
                	<td colspan="3" style="padding-left:0;padding-right:0">
                		 <div class="treasure_cart" style="display:none;"></div>[+cart.payment+]
                	</td>
                </tr>    
                
    	</table>
    
    </form>


    The "item" template (with special data for debugging):
    <tr>
    <td style="background-color:blue">A</td>
    <td style="background-color:green">B</td>
    <td style="background-color:magenta">C</td>
    </tr>


    The output:
    <tr>
    <td style="background-color:blue">A</td>
    <td style="background-color:green">B</td>
    <td style="background-color:magenta">C</td>
    </tr><h4 class="souligne">Contenu du panier</h4>
    <form action="index.php?id=223&action=update" method="post" id="treasure_chest_form" name="treasure_chest_form">
        <table id="treasure_chest_cart" cols="3" rows="2" cellpadding="0" cellspacing="0" border="1" style="display:block;" >
    			
                <tr id="cart_total">
                	<td class="Datagrid_Item" colspan="2" style="text-align:right;vertical-align:top;"><span style="font-size:10pt;"><b>Total brut</b>, </span> H.T.<br />Hors taxes et frais logistiques.</td>
                    <td class="Datagrid_Item" style="vertical-align:top;text-align:right">
                        CHF <span class="cart_total_amount rouge" style="font-size:10pt;font-weight:bold;"></span>
                    </td>
                </tr>
    
                <tr>
                	<td colspan="3" style="padding-left:0;padding-right:0">
                		 <div class="treasure_cart" style="display:none;"></div>
                	</td>
                </tr>    
                
    	</table>
    
    </form>