Post by Xciso » Sat Dec 02, 2017 3:29 am

Hi. I have been away from OpenCart for about a year, and I seen that many things have been change with the template system. I dont know why they have change to twig, but maybe its better then tpl.

I am now going to update a module to v3.x but I cant get it work.
I have tryed php2twig, but I dont know if it makes my code right.
Code:

Code: Select all

<?php echo $text_stock; ?>
			<?php
$ch = curl_init($mpsu);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$text = curl_exec($ch);
$mpssf = stripos($text, $mpssf);
$mpsss = stripos($text, $mpsss);
$mpsst = stripos($text, $mpsst);
if ($mpsu == false) {
   echo $stock;
}

elseif ($mpssf == true) {
   echo $mpsrf;
}
elseif ($mpsss == true) {
   echo $mpsrs;
}
elseif ($mpsst == true) {
   echo $mpsrt;
}
elseif(!$mpsu && !$mpssf && !$mpsss && !$mpsst) {
   echo $stock;
}
else {
   echo $mpsre;
}
?>
Please help!
Thanks :)

Active Member

Posts

Joined
Fri Jul 15, 2011 5:20 am

Post by straightlight » Sat Dec 02, 2017 4:54 am

This code example is incomplete. From which PHP file and location are you trying to code this example from?

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 Xciso » Sat Dec 02, 2017 3:39 pm

Hi. Where is it incomplete? It worked with 2.3.0.2.

Can I insert this code in model or controller insted of product.twig?

Active Member

Posts

Joined
Fri Jul 15, 2011 5:20 am

Post by phinq1910 » Sat Dec 02, 2017 4:56 pm

Try convert smarty to twig

User avatar
New member

Posts

Joined
Sat Jun 11, 2016 11:43 am
Location - Hanoi

Post by JNeuhoff » Sat Dec 02, 2017 10:20 pm

Xciso wrote:
Sat Dec 02, 2017 3:39 pm
Hi. Where is it incomplete? It worked with 2.3.0.2.

Can I insert this code in model or controller insted of product.twig?
Most of this code should be in a controller file, not in a template. Looks like a poorly written 3rd party extension to me.

Anyway, if you need a quick solution, our automatic template switcher will let you continue with using *.tpl files in OpenCart 3.x. There is no compelling reason for using Twig.

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: No registered users and 414 guests