Post by pazeradmin » Thu Mar 23, 2023 4:34 pm

Hi,

Not sure if this is the right forum for this. New to OC.

In a TWIG file (main.twig), I had this call working fine, it would render the shopping cart twig html and merge it into main.twig.

Code: Select all

{% include 'pwr001/template/checkout/cart.twig' %}
But I need to call/render it from within a JS script function within the main.twig template. I think the issue is, the jQuery/JS code does not like the {% include %} format (I think).

Google searches led me to try these calls instead, but none of these worked:

Code: Select all

$(this->renderView(':App:Command/pwr001/template/checkout/cart.twig'));
and:

Code: Select all

$('#here').html('{% spaceless %}{% include 'pwr001/template/checkout/cart.twig' %}{% endspaceless %}');
Going around in circles, any pointers on how to make some progress.

Thank you,
Tristan

Newbie

Posts

Joined
Thu Mar 09, 2023 12:31 pm

Post by JNeuhoff » Thu Mar 23, 2023 9:07 pm

Please provide more details, as per the forum rules, if you want help here.

Also, your post doesn't make sense. The checkout/cart is one of the top-level pages, therefore the checkout/cart.twig isn't included via a {% include(...) %} from any other template file. OpenCart uses the MVC design, the rendering of templates are called from a controller via a $this->load->view('...',$data) call.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am

Who is online

Users browsing this forum: Bing [Bot] and 99 guests