The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Customize checkout template

RolfRolf Member
in Help edited January 2015
I want to customize the checkout template and first want to try the supplied template and alter it via twig and use/block commands instead of copying/altering the whole template.

I'm looking at the template here:

I'm not entirely sure how to display the main checkout structure and then for example overwrite the current sidebar block.

I understand the blocks documentation, but the block_a and block_b examples don't include a parent/wrapper like checkout has.
Or should I extend the checkout block and then overwrite the sidebar block and then output the complete block?

PS > I'm a twig noob btw, so bare with me. I'm still going through the docs at sensio...

  • fc_adamfc_adam FoxyCart Team

    Sure thing - so the best way to approach this with 2.0 is to collapse all the different blocks within the checkout block except the ones you want to edit. You mentioned you want to work with just the sidebar - you'd do that like this:

    Within the checkout template - replace the {{ block('checkout') }} with the contents of this pastie: - which is simply the checkout include template you linked to above, but with everything but the sidebar collapsed.

    If you're wanting to edit the section of the sidebar contained within "" though - you can achieve that without having to customise your checkout template directly. That template is actually the "cart include" template as found within your store's FoxyCart administration. You can edit that template, which will edit the cart that is displayed within Sidecart, and on the full page cart, checkout and receipt pages.

    If you want to edit the cart just within the Checkout page, you can replace the Twig {% include '' %} line with the contents of the cart include template, and edit it directly there.
  • @fc_adam,

    Thanks for the pastie etc.. I'm getting it (well messing with it anyway).

    Basically with the statement {% use '' %} you tell the document you want to use everything from that template inside your page/template.

    Then you don't output (render) the complete checkout block right away, but rebuild the structure/skeleton of the (checkout) template and with the 'block' function calls you render the particular blocks from the included template.

    The sidebar block is redefined there and I can, for example remove stuff there, do whatever.. e.g. I remove the lines {% block logo %} ... {% endblock logo %}. I leave the cart it, because I will edit that separately.


  • @fc_adam,

    One more thing (for now). Let's say I want to alter the cart template, the same way you made the pastie.. copying the structure, rendering blocks and overwriting/altering those I want to change.

    First I tried including the complete cart as a basic test:
    {% use '' %}
    {{ block('cart') }}

    I can save this in the cart include in the admin configuration but if I load a checkout page on the dev site I get a System Error note;

    System error

    We tried to fulfill your request, but something went wrong. Please try your request again. We have been notified of the error. If the problem persists please contact us with details.

    Any idea why?
  • fc_adamfc_adam FoxyCart Team

    The cart edit you've detailed there - which template are you applying it to?
  • @fc_adam,

    I put it in the "cart include" template in the admin.
  • fc_adamfc_adam FoxyCart Team

    Ah ok - the issue you're running into there is the cart include template is actually the cart include template itself, so you can't include itself there. You'll need to leave the cart include as the full template and edit it in it's entirety rather than utilising the blocks approach there.
  • @fc_adam Is there any chance you could re-post your pastie code? The link has expired, and I think it would be helpful.
  • fc_adamfc_adam FoxyCart Team

    Yeah it looks like unfortunately pastie as gone down permanently. There may be a better approach for this since my previous posts - could you give me an idea of what you're wanting to do, and we can give you some code to get you started.
Sign In or Register to comment.