We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40122
    • 330 Posts
    Hi all,

    Im a bit stuck here. I need some TVs (weight, dimensions, etc) I've associated with my products to appear in the Cart page of my SimpleCart site.

    Problem is I have no idea how to do this. I don't understand how the SimpleCart cart is built and theres isnt documentation for this.

    Would anyone know how I can show TVs associated with each product in the cart output chunk?

    Many thanks!

    The cart snippet has the following code which gets data from the cart and puts it into Chunks:

    $sc = $modx->getService('simplecart','SimpleCart',$modx->getOption('simplecart.core_path',null,$modx->getOption('core_path').'components/simplecart/').'model/simplecart/',$scriptProperties);
    if (!($sc instanceof SimpleCart)) return '';
    
    $controller = $sc->loadController('Cart');
    $output = $controller->run($scriptProperties);


    The output Chunk looks like:

    <div id="simplecart">
        
        <form action="[[~[[*id]]]]" method="post" id="form_cartoverview">
            <input type="hidden" name="updatecart" value="true" />
            
            <table>
              <tr>
                <th class="desc">[[%simplecart.cart.description]]</th>
                <th class="price">[[%simplecart.cart.price]]</th>
                <th class="quantity">[[%simplecart.cart.quantity]]</th>
                [[+cart.total.vat_total:notempty=`<th class="quantity">[[%simplecart.cart.vat]]</th>`:isempty=``]]
                <th class="subtotal">[[%simplecart.cart.subtotal]]</th>
                <th> </th>
              </tr>
                
                [[+cart.wrapper]]
                
              [[+cart.total.discount:notempty=`<tr class="total first discount">
                <td colspan="[[+cart.total.vat_total:notempty=`3`:isempty=`2`]]"> </td>
                <td class="label">[[%simplecart.cart.discount]]</td>
                <td class="value">- [[+cart.total.discount_formatted]]</td>
                <td class="extra">[[+cart.total.discount_percent:notempty=`([[+cart.total.discount_percent]]%)`:isempty=` `]]</td>
              </tr>`:isempty=``]]
    
            [[+cart.total.vat_total:notempty=`
              <tr class="total [[+cart.total.discount:notempty=`second`:isempty=`first`]]">
                <td colspan="3"> </td>
                <td class="label">[[%simplecart.cart.total_ex_vat]]</td>
                <td class="value">[[+cart.total.price_ex_vat_formatted]]</td>
                <td class="extra"> </td>
              </tr>
              [[+cart.vat_rates]]
              <tr class="total [[+cart.total.discount:notempty=`third`:isempty=`second`]]">
                <td colspan="3"> </td>
                <td class="label">[[%simplecart.cart.total_vat]]</td>
                <td class="value">[[+cart.total.vat_total_formatted]]</td>
                <td class="extra"> </td>
              </tr>
              <tr class="total [[+cart.total.discount:notempty=`fourth`:isempty=`third`]]">
                <td colspan="3"> </td>
                <td class="label">[[%simplecart.cart.total_in_vat]]</td>
                <td class="value">[[+cart.total.price_formatted]]</td>
                <td class="extra"> </td>
              </tr>
            `:isempty=`
              <tr class="total [[+cart.total.discount:notempty=`second`:isempty=`first`]]">
                <td colspan="2"> </td>
                <td class="label">[[%simplecart.cart.total]]</td>
                <td class="value">[[+cart.total.price_formatted]]</td>
                <td class="extra"> </td>
              </tr>
            `]]
            </table>
            
            <div class="submit">
                <input type="submit" value="[[%simplecart.cart.update]]" />
            </div>
        </form>



    This question has been answered by meltingdog. See the first response.

    • The documentation here says how to include TVs. https://rtfm.modxsimplecart.com/snippets/scgetcart

      When you add the TV inclusion and processing properties to the snippet, you can use [[+tv.tvname]] in your chunk tpl.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
      • discuss.answer
        • 40122
        • 330 Posts
        Quote from: sottwell at Jul 16, 2015, 03:30 AM
        The documentation here says how to include TVs. https://rtfm.modxsimplecart.com/snippets/scgetcart

        When you add the TV inclusion and processing properties to the snippet, you can use [[+tv.tvname]] in your chunk tpl.

        Thanks Susan,

        Actually I think the RTFM is a little incorrect. I had to use
        [[+product.tv.tvname]]
        within the scCartRow chunk to get it to work.

        Thanks [ed. note: meltingdog last edited this post 8 years, 8 months ago.]
        • We've already been in touch about this @meltingdog, but for others who might wonder similar things, modmore has taken over support and can be reached for questions via support at modmore.com smiley
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.