Example #1
0
 function shipping($module = '')
 {
     global $PHP_SELF, $order;
     if (defined('MODULE_SHIPPING_INSTALLED') && vam_not_null(MODULE_SHIPPING_INSTALLED)) {
         $this->modules = explode(';', MODULE_SHIPPING_INSTALLED);
         $include_modules = array();
         if (vam_not_null($module) && in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) {
             $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1));
         } else {
             reset($this->modules);
             while (list(, $value) = each($this->modules)) {
                 $class = substr($value, 0, strrpos($value, '.'));
                 $include_modules[] = array('class' => $class, 'file' => $value);
             }
         }
         // load unallowed modules into array
         $unallowed_modules = explode(',', $_SESSION['customers_status']['customers_status_shipping_unallowed'] . ',' . $order->customer['shipping_unallowed']);
         for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
             if (vam_in_array(str_replace('.php', '', $include_modules[$i]['file']), $unallowed_modules) != 'false') {
                 // check if zone is alowed to see module
                 if (constant(MODULE_SHIPPING_ . strtoupper(str_replace('.php', '', $include_modules[$i]['file'])) . _ALLOWED) != '') {
                     $unallowed_zones = explode(',', constant(MODULE_SHIPPING_ . strtoupper(str_replace('.php', '', $include_modules[$i]['file'])) . _ALLOWED));
                 } else {
                     $unallowed_zones = array();
                 }
                 if (in_array($_SESSION['delivery_zone'], $unallowed_zones) == true || count($unallowed_zones) == 0) {
                     include DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/shipping/' . $include_modules[$i]['file'];
                     include DIR_WS_MODULES . 'shipping/' . $include_modules[$i]['file'];
                     $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class']();
                 }
             }
         }
     }
 }
Example #2
0
function vam_draw_products_pull_down($name, $parameters = '', $exclude = '')
{
    global $currencies;
    if ($exclude == '') {
        $exclude = array();
    }
    $select_string = '<select name="' . $name . '"';
    if ($parameters) {
        $select_string .= ' ' . $parameters;
    }
    $select_string .= '>';
    $products_query = vam_db_query("select p.products_id, pd.products_name,p.products_tax_class_id, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . $_SESSION['languages_id'] . "' order by products_name");
    while ($products = vam_db_fetch_array($products_query)) {
        if (!vam_in_array($products['products_id'], $exclude)) {
            //brutto admin:
            if (PRICE_IS_BRUTTO == 'true') {
                $products['products_price'] = vam_round($products['products_price'] * ((100 + vam_get_tax_rate($products['products_tax_class_id'])) / 100), PRICE_PRECISION);
            }
            $select_string .= '<option value="' . $products['products_id'] . '">' . $products['products_name'] . ' (' . vam_round($products['products_price'], PRICE_PRECISION) . ')</option>';
        }
    }
    $select_string .= '</select>';
    return $select_string;
}
   Released under the GNU General Public License
   ---------------------------------------------------------------------------------------*/
$module = new vamTemplate();
$module->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
$module_content = array();
$filename = '';
// check if allowed to see
require_once DIR_FS_INC . 'vam_in_array.inc.php';
$check_query = vamDBquery("SELECT DISTINCT\n\t\t\t\tproducts_id\n\t\t\t\tFROM " . TABLE_PRODUCTS_CONTENT . "\n\t\t\t\tWHERE languages_id='" . (int) $_SESSION['languages_id'] . "'");
$check_data = array();
$i = '0';
while ($content_data = vam_db_fetch_array($check_query, true)) {
    $check_data[$i] = $content_data['products_id'];
    $i++;
}
if (vam_in_array($product->data['products_id'], $check_data)) {
    // get content data
    require_once DIR_FS_INC . 'vam_filesize.inc.php';
    if (GROUP_CHECK == 'true') {
        $group_check = "group_ids LIKE '%c_" . $_SESSION['customers_status']['customers_status_id'] . "_group%' AND";
    }
    //get download
    $content_query = vamDBquery("SELECT\n\t\t\t\t\tcontent_id,\n\t\t\t\t\tcontent_name,\n\t\t\t\t\tcontent_link,\n\t\t\t\t\tcontent_file,\n\t\t\t\t\tcontent_read,\n\t\t\t\t\tfile_comment\n\t\t\t\t\tFROM " . TABLE_PRODUCTS_CONTENT . "\n\t\t\t\t\tWHERE\n\t\t\t\t\tproducts_id='" . $product->data['products_id'] . "' AND\n\t                " . $group_check . "\n\t\t\t\t\tlanguages_id='" . (int) $_SESSION['languages_id'] . "'");
    while ($content_data = vam_db_fetch_array($content_query, true)) {
        $filename = '';
        if ($content_data['content_link'] != '') {
            $icon = vam_image(DIR_WS_CATALOG . 'images/icons/file/icon_link.gif');
        } else {
            $icon = vam_image(DIR_WS_CATALOG . 'images/icons/file/icon_' . str_replace('.', '', strstr($content_data['content_file'], '.')) . '.gif');
        }
        if ($content_data['content_link'] != '') {