Foxy Forum Status

We're no longer responding to questions via our forum, but we will keep it up for historical reasons. If you can't find the answer you're looking for, please visit our knowledge base or contact us. If there's enough interest in the future, we may bring the forum back.

Trying to customize {{ continue_url }} on receipt page.

Hi FC,

I need to customize {{ continue_url }} that appears on the receipt page. Specifically, I'd like to append it with a code from FC.json.custom_fields.MYFIELD.value.

I thought this would work:


var FC = FC || {};
FC.onLoad = function () {
FC.client.on('ready.done', function () {
FC.json.continue_url = 'http://google.com';
});
};

So, the only choice (unless I decide to modify rendered DOM HREF attribute directly) is to tweak 'receipt.inc.twig' which I cannot find :-)

What would you suggest?

Thanks!
Comments
  • fc_adamfc_adam FoxyCart Team
    @temuri416,

    On the FoxyCart cart, checkout and receipt templates - you don't need to wrap the event code in an onLoad() function call - that's just for code on your own website.

    For editing the continue_url, I'd recommend approaching that with Twig:
    {% set continue_url = "http://yoururl.com" %}
    You can include that right at the top of your receipt template to change that value.

    For accessing the custom value in Twig, you can do that like this, assuming a custom field of "my_custom_field=true"
    {% if custom_fields.my_custom_field.value == true %}
    {% set continue_url = "http://yoururl.com" %}
    {% endif %}
  • Too bad this does not work:
    FC.client.request('https://'+FC.settings.storedomain+'/cart?continue_url=http://google.com&' + FC.session.get())
    "continue_url" is ignored... :(
  • temuri416temuri416 Member
    edited February 2017
    @fc_adam

    How do I pass value from FC.json.custom_fields to twig world?

    This does not work:
    {% set continue_url = custom_fields.url_continue.value %}
    Thanks!
  • Never mind... That worked.

    But what I could not achieve is string concatenation:

    {% set continue_url = custom_fields.url_continue.value + '/' + custom_fields.order_id.value %}
  • fc_adamfc_adam FoxyCart Team
    @Temuri416,

    You're very close there! In Twig, you concatenate with the ~ character - so it would be:
    {% set continue_url = custom_fields.url_continue.value ~ '/' ~ custom_fields.order_id.value %}
Sign In or Register to comment.