Location: PHPKode > projects > Batavi > batavi/ext/smarty/plugin/insert.shipping.php
<?php
/**
 * file smarty_insert_shipping.php
 *
 * Module plugin implementation
 *
 * @copyright Copyright (c) 2009, ICEshop BV
 *
 * @package classes
 */

  function smarty_insert_shipping($params, &$smarty){

    $shipping_modules = array('customer_account' => 'btv_Modules_Shipping_CustomerAccount',
                              'pickup'           => 'btv_Modules_Shipping_Pickup',
                              'table_rate'       => 'btv_Modules_Shipping_TableRate');

    $btv_Template = btv_Factory::singleton(TEMPLATE_ENGINE);
    $btv_Database = btv_Factory::singleton('btv_Database_'.DB_DATABASE_CLASS);
    $btv_Language = btv_Factory::singleton('btv_Language');

    $btv_Template->selectModule('shipping');

    $template = '';

    if((isset($btv_Template->_modules['shipping'])) && (is_array($btv_Template->_modules['shipping']))){
      foreach($btv_Template->_modules['shipping'] as $key => $array){
        foreach ($array as $module){
          if ($module['code'] == $params['method']){
            if(file_exists($module['file'])) {
              $class_box  = new $shipping_modules[$module['code']]();
              if ($class_box->isEnabled()){
                $btv_Template->mergeTokens($class_box->execute(), true);
                $template_file = str_replace(':template:', $btv_Template->_template, $module['template']);
                if(file_exists($template_file)) {
                  $btv_Template->_tokens['selection_size'] = sizeof($array);
                  $template .= $btv_Template->smartyBox($template_file);
                } else {
                  $template_file = str_replace(':template:', 'default', $module['template']);
                  if(file_exists($template_file)) {
                    $template .= $btv_Template->smartyBox($template_file);
                  } else {
                    $template .= '<!-- Warning: Template file not found -->';
                  }
                }
              }
            }
          }
        }
      }
    }

    return $template;
  }
?>
Return current item: Batavi