Example #1
0
?>

<?php 
if ($pid) {
    $pulldn = array(array('id' => '', 'text' => '---Model---'));
    $mdlimgs = array();
    $product_query = tep_db_query("SELECT p.products_id,\n\t\t\t\t\t\t\t\t\t\t\t  p.products_image,\n\t\t\t\t\t\t\t\t\t\t\t  p.products_model,\n\t\t\t\t\t\t\t\t\t\t\t  ov.products_options_values_name \n\t\t\t\t\t\t\t\t\t\tFROM " . TABLE_PRODUCTS . " p \n\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa ON p.products_id = pa.products_id \n\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . TABLE_PRODUCTS_OPTIONS_VALUES . " ov ON ov.products_options_values_id = pa.options_values_id AND ov.language_id = " . (int) $languages_id . " \n\t\t\t\t\t\t\t\t\t\tWHERE master_products_id = " . $pid . "\n\t\t\t\t\t\t\t\t\t\tORDER BY pa.options_sort\n\t\t\t\t\t\t\t\t\t   ");
    $mdls = array();
    while ($row = tep_db_fetch_array($product_query)) {
        if (!isset($mdls[$row['products_id']])) {
            $mdls[$row['products_id']] = array('model' => $row['products_model'], 'attrs' => array());
        }
        if ($row['products_id'] != $pid) {
            $mdls[$row['products_id']]['attrs'][] = $row['products_options_values_name'];
        }
        $mdlimgs[$row['products_id']] = tep_image_src(DIR_WS_CATALOG_IMAGES . $row['products_image'], 32, 40);
    }
    asort($mdls);
    foreach ($mdls as $pid => $mdl) {
        $pulldn[] = array('id' => $pid, 'text' => $mdl['attrs'] ? join('/', $mdl['attrs']) : '[default]');
    }
    ?>

<script language="javascript">
	window.prod_list_model_imgs=<?php 
    echo tep_js_quote($mdlimgs);
    ?>
;
</script>

<?php 
        echo '</table><hr>';
    }
}
echo '<td width="130" style="text-align:center; white-space:nowrap">';
if ($show_submit) {
    echo '<table cellspacing="0" cellpadding="0" align="center" border="0" width="100%">
				<tr><td align="center">';
    $img_wd = 64;
    $img_ht = 80;
    $modelsObj = tep_block('blk_product_models');
    $modelsObj->pid = $product['products_id'];
    $modelsObj->products_name = $product['products_name'];
    $modelsObj->render(NULL);
    $imgs = array();
    foreach ($modelsObj->getImages() as $img) {
        $imgs[$img] = tep_image_src($img, $img_wd, $img_ht);
    }
    list($img0) = $imgs;
    echo tep_image($img0, $products['products_name'], $img_wd, $img_ht, 'id="add_product_image"');
    echo '<div style="padding:10px 0 0 0">';
    $att = tep_block('blk_attr_select_pulldn');
    $att->setContext(array('models' => $modelsObj), array());
    $att->render(array());
    $addr = new IXaddress(array('country' => $_REQUEST['country'], 'state' => $_REQUEST['state']));
    echo tep_draw_hidden_field('add_product_id', $add_product_id, ' id="add_product_id"');
    echo tep_draw_hidden_field('add_product_name', tep_get_products_name($add_product_id), ' id="add_product_name"');
    echo tep_draw_hidden_field('add_product_model', $product['products_model'], ' id="add_product_model"');
    echo tep_draw_hidden_field('add_product_cost', $product['products_price'], ' id="add_product_cost"');
    echo tep_draw_hidden_field('add_product_comments', '', ' id="add_product_comments"');
    echo tep_draw_hidden_field('add_product_tax_class', $product['products_tax_class_id'], ' id="add_product_tax_class"');
    echo tep_draw_hidden_field('add_product_tax', tep_get_tax_rate($product['products_tax_class_id'], $addr->getCountryID(), $addr->getZoneID()), ' id="add_product_tax"');
Example #3
0
function tep_image($src, $alt = '', $width = '', $height = '', $params = '')
{
    if (preg_match('|^/?' . DIR_WS_CATALOG_IMAGES . '(.+)$|', $src, $rargs)) {
        return IXimage::tag($rargs[1], $alt, $width, $height, $parameters);
    }
    $src = tep_image_src($src, $width, $height);
    $image = '<img src="' . $src . '" border="0" alt="' . $alt . '"';
    if ($alt) {
        $image .= ' title=" ' . $alt . ' "';
    }
    if ($width) {
        $image .= ' width="' . $width . '"';
    }
    if ($height) {
        $image .= ' height="' . $height . '"';
    }
    if ($params) {
        $image .= ' ' . $params;
    }
    $image .= '>';
    return $image;
}