Post by jonkers20 » Sat Jan 26, 2019 3:56 am

hello I am working on a module of 2.x which to 3.x.
But I can not get this php to twig properly

Code: Select all

<php array_unshift($stock_statuses, array('stock_status_id' => 0, 'name' => '' )); foreach ($stock_statuses as $stock_status) { ?>

Newbie

Posts

Joined
Sat Jan 26, 2019 3:51 am

Post by straightlight » Sat Jan 26, 2019 11:31 pm

Partial code posted; complete solution needed. Forum rules.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by JNeuhoff » Sat Jan 26, 2019 11:40 pm

Perhaps the Twig merge filter can accomplish the same thing.

Or you can keep it as a PHP template and use our Template Switcher PHP/Twig to also support PHP templates in OpenCart 3.

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


Post by letxobnav » Sat Mar 09, 2019 4:38 pm

In my opinion you should keep data logic in the controller and display logic in the views.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by straightlight » Sat Mar 09, 2019 11:34 pm

Also:

Code: Select all

<php
for:

Code: Select all

<?php

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: khnaz35 and 8 guests