/**
 * Smarty {oos_get_country_list} function plugin
 *
 * Type:     function
 * Name:     oos_get_country_list
 * Version:  1.0
 * -------------------------------------------------------------
 */
function smarty_function_oos_get_country_list($params, &$smarty)
{
    global $aLang;
    MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');
    require_once $smarty->_get_plugin_filepath('function', 'html_options');
    /* Set the name of the <select> tag. */
    $name = 'country';
    /* <select size>'s of <select> tag.
       If not set, uses default dropdown. */
    $size = null;
    /* Unparsed attributes common to *ALL* the <select>/<input> tags.
       An example might be in the template: extra ='class ="foo"'. */
    $extra = null;
    foreach ($params as $_key => $_val) {
        ${$_key} = smarty_function_escape_special_chars($_val);
    }
    $countries = array();
    $countries_names = array();
    $countries_values = array();
    $countries = oos_get_countries();
    $countries_values[] = '';
    $countries_names[] = $aLang['pull_down_default'];
    $nArrayCountCountries = count($countries);
    for ($i = 0, $n = $nArrayCountCountries; $i < $n; $i++) {
        $countries_values[] = $countries[$i]['countries_id'];
        $countries_names[] = $countries[$i]['countries_name'];
    }
    $html_result .= '<select name="' . $name . '" id="entry_' . $name . '"';
    if (null !== $class) {
        $html_result .= ' class="' . $class . '"';
    }
    if (null !== $size) {
        $html_result .= ' size="' . $size . '"';
    }
    if (null !== $extra) {
        $html_result .= ' ' . $extra;
    }
    $html_result .= '>' . "\n";
    $html_result .= smarty_function_html_options(array('output' => $countries_names, 'values' => $countries_values, 'selected' => $selected, 'print_result' => false), $smarty);
    $html_result .= '</select>';
    print $html_result;
}
Ejemplo n.º 2
0
 function quote($method = '')
 {
     global $aLang, $oOrder, $shipping_weight, $shipping_num_boxes;
     if (!empty($method) && isset($this->types[$method])) {
         $prod = $method;
     } else {
         $prod = 'GNDRES';
     }
     if ($method) {
         $this->_upsAction('3');
     }
     // return a single quote
     $this->_upsProduct($prod);
     $country_name = oos_get_countries(STORE_COUNTRY, true);
     $this->_upsOrigin(STORE_ORIGIN_ZIP, $country_name['countries_iso_code_2']);
     $this->_upsDest($oOrder->delivery['postcode'], $oOrder->delivery['country']['iso_code_2']);
     $this->_upsRate(MODULE_SHIPPING_UPS_PICKUP);
     $this->_upsContainer(MODULE_SHIPPING_UPS_PACKAGE);
     $this->_upsWeight($shipping_weight);
     $this->_upsRescom(MODULE_SHIPPING_UPS_RES);
     $upsQuote = $this->_upsGetQuote();
     if (is_array($upsQuote) && count($upsQuote) > 0) {
         $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)');
         $methods = array();
         $qsize = count($upsQuote);
         for ($i = 0; $i < $qsize; $i++) {
             list($type, $cost) = each($upsQuote[$i]);
             $methods[] = array('id' => $type, 'title' => $this->types[$type], 'cost' => ($cost + MODULE_SHIPPING_UPS_HANDLING) * $shipping_num_boxes);
         }
         $this->quotes['methods'] = $methods;
         if ($this->tax_class > 0) {
             $this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
         }
     } else {
         $this->quotes = array('module' => $this->title, 'error' => 'An error occured with the UPS shipping calculations.<br />' . $upsQuote . '<br />If you prefer to use UPS as your shipping method, please contact the store owner.');
     }
     if (!empty($this->icon)) {
         $this->quotes['icon'] = oos_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
Ejemplo n.º 3
0
            <td class="main"><?php echo oos_draw_input_field('entry_suburb', $cInfo->entry_suburb, 'maxlength="32"'); ?></td>
          </tr>
<?php
    }
?>
          <tr>
            <td class="main"><?php echo ENTRY_POST_CODE; ?></td>
            <td class="main"><?php echo oos_draw_input_field('entry_postcode', $cInfo->entry_postcode, 'maxlength="8"', true); ?></td>
          </tr>
          <tr>
            <td class="main"><?php echo ENTRY_CITY; ?></td>
            <td class="main"><?php echo oos_draw_input_field('entry_city', $cInfo->entry_city, 'maxlength="32"', true); ?></td>
          </tr>
          <tr>
            <td class="main"><?php echo ENTRY_COUNTRY; ?></td>
            <td class="main"><?php echo oos_draw_pull_down_menu('entry_country_id', oos_get_countries(), $cInfo->entry_country_id, 'onChange="update_zone(this.form);"'); ?></td>
          </tr>
<?php
    if (ACCOUNT_STATE == '1') {
?>
          <tr>
            <td class="main"><?php echo ENTRY_STATE; ?></td>
            <td class="main"><?php echo oos_draw_pull_down_menu('entry_zone_id', oos_prepare_country_zones_pull_down($cInfo->entry_country_id), $cInfo->entry_zone_id, 'onChange="resetStateText(this.form);"'); ?></td>
          </tr>
          <tr>
            <td class="main">&nbsp;</td>
            <td class="main"><?php echo oos_draw_input_field('entry_state', $cInfo->entry_state, 'maxlength="32" onChange="resetZoneSelected(this.form);"'); ?></td>
          </tr>
<?php
    }
?>
Ejemplo n.º 4
0
            <td class="main"><?php 
    echo ENTRY_CITY;
    ?>
</td>
            <td class="main"><?php 
    echo oos_draw_input_field('entry_city', $cInfo->entry_city, 'maxlength="32"', true);
    ?>
</td>
          </tr>
          <tr>
            <td class="main"><?php 
    echo ENTRY_COUNTRY;
    ?>
</td>
            <td class="main"><?php 
    echo oos_draw_pull_down_menu('entry_country_id', oos_get_countries(), $cInfo->entry_country_id, 'onChange="update_zone(this.form);"');
    ?>
</td>
          </tr>
<?php 
    if (ACCOUNT_STATE == '1') {
        ?>
          <tr>
            <td class="main"><?php 
        echo ENTRY_STATE;
        ?>
</td>
            <td class="main"><?php 
        echo oos_draw_pull_down_menu('entry_zone_id', oos_prepare_country_zones_pull_down($cInfo->entry_country_id), $cInfo->entry_zone_id, 'onChange="resetStateText(this.form);"');
        ?>
</td>
Ejemplo n.º 5
0
      $contents = array('form' => oos_draw_form('zones', $aFilename['zones'], 'page=' . $_GET['page'] . '&action=insert'));
      $contents[] = array('text' => TEXT_INFO_INSERT_INTRO);
      $contents[] = array('text' => '<br />' . TEXT_INFO_ZONES_NAME . '<br />' . oos_draw_input_field('zone_name'));
      $contents[] = array('text' => '<br />' . TEXT_INFO_ZONES_CODE . '<br />' . oos_draw_input_field('zone_code'));
      $contents[] = array('text' => '<br />' . TEXT_INFO_COUNTRY_NAME . '<br />' . oos_draw_pull_down_menu('zone_country_id', oos_get_countries()));
      $contents[] = array('align' => 'center', 'text' => '<br />' . oos_image_swap_submits('insert','insert_off.gif', IMAGE_INSERT) . '&nbsp;<a href="' . oos_href_link_admin($aFilename['zones'], 'page=' . $_GET['page']) . '">' . oos_image_swap_button('cancel','cancel_off.gif', IMAGE_CANCEL) . '</a>');
      break;

    case 'edit':
      $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_ZONE . '</b>');

      $contents = array('form' => oos_draw_form('zones', $aFilename['zones'], 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=save'));
      $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
      $contents[] = array('text' => '<br />' . TEXT_INFO_ZONES_NAME . '<br />' . oos_draw_input_field('zone_name', $cInfo->zone_name));
      $contents[] = array('text' => '<br />' . TEXT_INFO_ZONES_CODE . '<br />' . oos_draw_input_field('zone_code', $cInfo->zone_code));
      $contents[] = array('text' => '<br />' . TEXT_INFO_COUNTRY_NAME . '<br />' . oos_draw_pull_down_menu('zone_country_id', oos_get_countries(), $cInfo->countries_id));
      $contents[] = array('align' => 'center', 'text' => '<br />' . oos_image_swap_submits('update','update_off.gif', IMAGE_UPDATE) . '&nbsp;<a href="' . oos_href_link_admin($aFilename['zones'], 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id) . '">' . oos_image_swap_button('cancel','cancel_off_off.gif', IMAGE_CANCEL) . '</a>');
      break;

    case 'delete':
      $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_ZONE . '</b>');

      $contents = array('form' => oos_draw_form('zones', $aFilename['zones'], 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=deleteconfirm'));
      $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
      $contents[] = array('text' => '<br /><b>' . $cInfo->zone_name . '</b>');
      $contents[] = array('align' => 'center', 'text' => '<br />' . oos_image_swap_submits('delete','delete_off.gif', IMAGE_DELETE) . '&nbsp;<a href="' . oos_href_link_admin($aFilename['zones'], 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id) . '">' . oos_image_swap_button('cancel','cancel_off.gif', IMAGE_CANCEL) . '</a>');
      break;

    default:
      if (isset($cInfo) && is_object($cInfo)) {
        $heading[] = array('text' => '<b>' . $cInfo->zone_name . '</b>');
Ejemplo n.º 6
0
 /**
  * Alias function for Store configuration values in the Administration Tool
  *
  * @param $country_id
  * @return string
  */
  function oos_cfg_pull_down_country_list($country_id) {
    return oos_draw_pull_down_menu('configuration_value', oos_get_countries(), $country_id);
  }
Ejemplo n.º 7
0
      case 'new':
        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_SUB_ZONE . '</b>');

        $contents = array('form' => oos_draw_form('zones', $aFilename['geo_zones'], 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $_GET['sID'] . '&saction=insert_sub'));
        $contents[] = array('text' => TEXT_INFO_NEW_SUB_ZONE_INTRO);
        $contents[] = array('text' => '<br />' . TEXT_INFO_COUNTRY . '<br />' . oos_draw_pull_down_menu('zone_country_id', oos_get_countries(TEXT_ALL_COUNTRIES), '', 'onChange="update_zone(this.form);"'));
        $contents[] = array('text' => '<br />' . TEXT_INFO_COUNTRY_ZONE . '<br />' . oos_draw_pull_down_menu('zone_id', oos_prepare_country_zones_pull_down()));
        $contents[] = array('align' => 'center', 'text' => '<br />' . oos_image_swap_submits('insert','insert_off.gif', IMAGE_INSERT) . ' <a href="' . oos_href_link_admin($aFilename['geo_zones'], 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $_GET['sID']) . '">' . oos_image_swap_button('cancel','cancel_off.gif', IMAGE_CANCEL) . '</a>');
        break;

      case 'edit':
        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_SUB_ZONE . '</b>');

        $contents = array('form' => oos_draw_form('zones', $aFilename['geo_zones'], 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id . '&saction=save_sub'));
        $contents[] = array('text' => TEXT_INFO_EDIT_SUB_ZONE_INTRO);
        $contents[] = array('text' => '<br />' . TEXT_INFO_COUNTRY . '<br />' . oos_draw_pull_down_menu('zone_country_id', oos_get_countries(TEXT_ALL_COUNTRIES), $sInfo->zone_country_id, 'onChange="update_zone(this.form);"'));
        $contents[] = array('text' => '<br />' . TEXT_INFO_COUNTRY_ZONE . '<br />' . oos_draw_pull_down_menu('zone_id', oos_prepare_country_zones_pull_down($sInfo->zone_country_id), $sInfo->zone_id));
        $contents[] = array('align' => 'center', 'text' => '<br />' . oos_image_swap_submits('update','update_off.gif', IMAGE_UPDATE) . ' <a href="' . oos_href_link_admin($aFilename['geo_zones'], 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id) . '">' . oos_image_swap_button('cancel','cancel_off.gif', IMAGE_CANCEL) . '</a>');
        break;

      case 'delete':
        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_SUB_ZONE . '</b>');

        $contents = array('form' => oos_draw_form('zones', $aFilename['geo_zones'], 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id . '&saction=deleteconfirm_sub'));
        $contents[] = array('text' => TEXT_INFO_DELETE_SUB_ZONE_INTRO);
        $contents[] = array('text' => '<br /><b>' . $sInfo->countries_name . '</b>');
        $contents[] = array('align' => 'center', 'text' => '<br />' . oos_image_swap_submits('delete','delete_off.gif', IMAGE_DELETE) . ' <a href="' . oos_href_link_admin($aFilename['geo_zones'], 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id) . '">' . oos_image_swap_button('cancel','cancel_off.gif', IMAGE_CANCEL) . '</a>');
        break;

      default:
        if (isset($sInfo) && is_object($sInfo)) {