acateon Posted July 21, 2011 Share Posted July 21, 2011 I'm having trouble with getting $order working inside {php}-tags in template files.What I'm trying to acchive: {if isset($followup)} {$order->shipping_number} //prints the trackingnumber without a problem. {php} $pactrack = simplexml_load_file('http://privpakportal.schenker.nu/TrackAndTrace/packagexml.aspx?packageid='.$order->shipping_number); .... How do i get the $order-varibale working inside the {php}-tag? Link to comment Share on other sites More sharing options...
bellini13 Posted July 25, 2011 Share Posted July 25, 2011 are you getting some sort of error? i think usage of {php} in smarty is not a recommended practice and they disable it by default, so you may need to figure out how to enable it. the alternative is to update the controller code to set the value of the $pactrack variable, and then place it into the smarty session. Link to comment Share on other sites More sharing options...
acateon Posted July 26, 2011 Author Share Posted July 26, 2011 are you getting some sort of error? i think usage of {php} in smarty is not a recommended practice and they disable it by default, so you may need to figure out how to enable it. the alternative is to update the controller code to set the value of the $pactrack variable, and then place it into the smarty session. The variable is ignored inside the smarty PHP-tag. I guess it's not optimal, so you're probably right. I'll do that, thanks! Link to comment Share on other sites More sharing options...
acateon Posted August 3, 2011 Author Share Posted August 3, 2011 Cant seam to get this to work, this is what I've done done to OrderDetailController.php if ($order->shipping_number) $pactrack = simplexml_load_file('http://privpakportal.schenker.nu/TrackAndTrace/packagexml.aspx?packageid='.$order->shipping_number); $pickup = $pactrack->xpath('//parcel'); $event = $pactrack->xpath('//event'); self::$smarty->assign('track', $pickup->ppc_name, $event->description); And to order-detail.tpl I went berserk and tried all of these tags but none of them works. {if isset($followup)} <p class="bold">{l s='Click the following link to track the delivery of your order'}</p> <a href="{$followup|escape:'htmlall':'UTF-8'}">{$followup|escape:'htmlall':'UTF-8'}</a> {$track->ppc_name|nl2br} {$track->ppc_name} {$track} {$pickup->ppc_name|nl2br} {$event->description|nl2br} {/if} {if isset($track)} {$pickup->ppc_name} {$event->description} {/if} Does anyone see something obvious I've done wrong or have any ideas of how to make it work? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now