Ejemplo n.º 1
0
function translateSize2Length($size)
{
    $lenghts = getLength2Sizes();
    return array_search($size, $lenghts);
}
Ejemplo n.º 2
0
 function drawTableAction($products_id, $default_length = '', $default_price = '', $default_ean = '')
 {
     if ($default_length == '' || $default_price == '') {
         $default = $this->getDefault($products_id);
         $default_price = number_format($default['products_price'], 2);
         $default_length = $default['products_length'];
         $default_ean = $default['products_ean'];
     }
     $default_length_text = textLength($default_length);
     if ($default_ean == '') {
         $default_ean .= '<input id="ean_to_product" type="button" value="Attach EAN No" />';
         $default_ean .= '<img src="images/ajax-load-3.gif" id="pa-defean-process" style="display:none;" />';
     }
     $style_length = 'style="width:50px;"';
     $style_price = 'style="width:60px;"';
     $sizes = getLength2Sizes();
     array_shift($sizes);
     $use_size = array_key_exists(strval($default_length), $sizes);
     if ($use_size) {
         $size_options = loadComboListFromArray($sizes, null, null, false);
         $new_length = '<select id="new_length">' . $size_options . '</select>';
     } else {
         $new_length = '<input type="text" id="new_length" value="" ' . $style_length . ' />';
     }
     $result = '';
     $totalcols = 5;
     $rowsep = '<tr><td colspan="' . $totalcols . '">&nbsp;</td></tr>';
     $result .= '<div class="form"><table class="nltable" border="0" cellpadding="0" cellspacing="0">';
     $result .= '<tr><td colspan="' . $totalcols . '">';
     $result .= '<div class="red">* Changes will affect all sales partner</div>';
     $result .= '<div class="red">&nbsp;</div>';
     $result .= '</td></tr>';
     $tctemp = $totalcols - 2;
     $result .= '<tr><td colspan="2" class="bold">Default Length/Size</td><td colspan="' . $tctemp . '" class="bold"><span id="pa-deflength">' . $default_length_text . '</span></td></tr>';
     //$result .= '<tr><td colspan="2" class="bold">Default Price</td><td colspan="'.$tctemp.'" class="bold"><span id="pa-defprice">'.$default_price.'</span> EUR</td></tr>';
     $result .= '<tr><td colspan="2" class="bold">EAN No</td><td colspan="' . $tctemp . '" class="bold"><span id="pa-defean">' . $default_ean . '</span></td></tr>';
     $result .= $rowsep;
     if ($default_length == 0) {
         $result .= '<tr><td colspan="' . $totalcols . '" class="bold red">Adding article is not available for this product.</td></tr>';
     } else {
         $result .= '<tr><td colspan="4" class="bold">Add New Length/Size:</td></tr>';
         $result .= '<tr>';
         $result .= '<td>' . $new_length . '</td>';
         //$result .= '<td><input type="text" id="new_length_price" value="" '.$style_price.' /></td>';
         //$result .= '<td><input type="text" id="new_length_price_old" value="" '.$style_price.' /></td>';
         $result .= '<td><input type="button" id="new_length_add" value="Add" /></td>';
         $result .= '<td>&nbsp;</td>';
         $result .= '</tr>';
         $result .= $rowsep;
         $result .= '<tr><td colspan="' . $totalcols . '" class="bold">Additional Length/Size</td></tr>';
         //$result .= '<tr><td>No</td><td>EAN</td><td>Length <small>(cm)</small> &nbsp;</td><td>Price <small>(EUR)</small> &nbsp;</td><td>Old Price <small>(EUR)</small> &nbsp;</td><td>Action</td><td>isActive</td></tr>';
         $result .= '<tr><td class="w040">No</td><td class="w150">EAN</td><td class="w080">Length/Size</td><td class="w200">Action</td><td class="w080">isActive</td></tr>';
         $products_articles = $this->retrieveList($products_id);
         if (count($products_articles) > 0) {
             $article_counter = 0;
             foreach ($products_articles as $pa) {
                 $article_counter++;
                 $el_id = 'extra-length-' . $pa['products_articles_id'];
                 $class_with_id = 'class="extra-length-' . $pa['products_articles_id'] . '"';
                 if ($pa['products_ean'] != '') {
                     $ean_no = $pa['products_ean'];
                     $length_readonly = 'readonly="readonly"';
                     $action = '<div class="notice">Not Editable</div>';
                 } else {
                     $ean_no = '<span class="notice">Unset</span>';
                     $length_readonly = '';
                     $action = '<span class="update-extra-length blue" id="upd-' . $pa['products_articles_id'] . '">Update</span>';
                     $action .= '<span class="sep"> &bull; </span><span class="remove-extra-length red" id="del-' . $pa['products_articles_id'] . '">Remove</span>';
                     $action .= '<span class="sep"> &bull; </span><span class="extra-length-ean red" id="ean-' . $pa['products_articles_id'] . '">Attach EAN</span>';
                 }
                 $result .= '<tr id="' . $el_id . '">';
                 $result .= '<td>' . $article_counter . ' &raquo; </td>';
                 $result .= '<td id="pa-ean-' . $pa['products_articles_id'] . '">' . $ean_no . '</td>';
                 $result .= '<td><input type="hidden" id="pa-length-' . $pa['products_articles_id'] . '" value="' . $pa['length'] . '" />' . textLength($pa['length']) . '</td>';
                 //$result .= '<td><input type="text" id="pa-price-'.$pa['products_articles_id'].'" value="'.$pa['price'].'" '.$style_price.' /></td>';
                 //$result .= '<td><input type="text" id="pa-price-old-'.$pa['products_articles_id'].'" value="'.$pa['price_old'].'" '.$style_price.' /></td>';
                 $result .= '<td id="pa-act-' . $pa['products_articles_id'] . '">';
                 $result .= '<div>' . $action . '</div>';
                 $result .= '<div style="display:none;"><img src="/images/ajax-load-3.gif" /></div>';
                 $result .= '</td>';
                 $check = $pa['active_status'] == '0' ? ' disabled="disabled"' : ' checked="checked"';
                 $result .= '<td class="tac"><input type="checkbox" id="cb-pa-active-' . $pa['products_articles_id'] . '" name="pa-active-status" value="' . $pa['products_articles_id'] . '"' . $check . ' /></td>';
                 $result .= '</tr>';
             }
         }
     }
     $result .= '</table></div>';
     return $result;
 }
Ejemplo n.º 3
0
function drawLengthsForm($products_id)
{
    global $class_pm, $class_pa;
    use_class('Product');
    $product = $class_pm->retrieveDetail($products_id, 'p,pd,pnc,cat');
    $articles = $class_pa->retrieveList($products_id);
    $category = $class_pm->retrieveCategoryName($product['categories_id'], '1');
    $use_size = Product::isUsingSizeInsteadOfLength($product['categories_id']);
    $result = '<h2 class="red-bright" style="margin-bottom:0;text-transform:uppercase;">' . $category . '</h2>';
    $result .= '<span class="red">Please make sure product category is correct,<br />contact IT Team if you need to change it!</span><br /><br />';
    $result .= 'Default Length/Size:<br />';
    $input_id = 'deflength';
    $input_class = 'class="w080"';
    if ($use_size) {
        $sizes = getLength2Sizes();
        $size_options = loadComboListFromArray($sizes, null, $product['pnc']['products_length'], false);
        $result .= '<select id="' . $input_id . '" ' . $input_class . '>' . $size_options . '</select>';
    } else {
        $result .= '<input type="text" id="' . $input_id . '" ' . $input_class . 'value="' . number_format($product['pnc']['products_length'], 2) . '" onfocus="$(this).select();" /> cm';
    }
    $result .= '<br /><br />';
    //Set MAX additional length per category
    switch ($product['categories_id']) {
        case '2':
        case '3':
        case '30':
            $al_max = 2;
            break;
        case '4':
        case '9':
        case '28':
            $al_max = 0;
            break;
        case '29':
            $al_max = 7;
            break;
        default:
            $al_max = 5;
    }
    $al_count = 0;
    if ($al_max > 0 || count($articles) > 0) {
        $result .= 'Additional Lengt/Size:<br />';
        if (count($articles) > 0) {
            $input_class = 'class="updlength w080"';
            foreach ($articles as $a) {
                $al_count++;
                $input_id = 'paid-' . $a['products_articles_id'];
                if ($use_size) {
                    $size_options = loadComboListFromArray($sizes, null, $a['length'], false);
                    $result .= $al_count . ' - <select id="' . $input_id . '" ' . $input_class . '>' . $size_options . '</select>';
                } else {
                    $result .= $al_count . ' - <input type="text" id="' . $input_id . '" ' . $input_class . ' value="' . number_format($a['length'], 2) . '" /> cm';
                }
                $result .= '<br />';
            }
        }
        if ($al_count < $al_max) {
            $input_class = 'class="addlength w080"';
            for ($al = $al_count + 1; $al <= $al_max; $al++) {
                if ($use_size) {
                    $size_options = loadComboListFromArray($sizes, null, null, false);
                    $result .= $al . ' - <select ' . $input_class . '>' . $size_options . '</select>';
                } else {
                    $result .= $al . ' - <input type="text" ' . $input_class . ' value="" /> cm';
                }
                $result .= '<br />';
            }
        }
        $result .= '<br /><br />';
    }
    $result .= '<input id="setlengthok" type="button" class="button green" value="Save Lengths" />';
    return $result;
}
Ejemplo n.º 4
0
 $content .= '<td><input type="checkbox" id="wholesale" name="is_wholesale" value="1" ' . ($obj_product->is_wholesale ? 'checked="checked"' : '') . ' /> <label for="wholesale">Yes</label></td>';
 $content .= '</tr>';
 $content .= '<td>Product Gender</td>';
 $content .= '<td><select name="products_gender" class="w100">' . loadComboListFromArray($class_pm->productGenderName(), null, $products['products_gender']) . '"</select></td>';
 $content .= '</tr><tr>';
 $content .= '<td>Product Age Group</td>';
 $content .= '<td><select name="products_agegroup" class="w100">' . loadComboListFromArray($products_agegroup_options, null, $products['products_agegroup']) . '"</select></td>';
 $content .= '</tr>';
 $content .= '<tr>';
 $content .= '<td>Product Weight</td>';
 $content .= '<td><input type="text" name="products_weight" value="' . $products['products_weight'] . '" class="w100" /> <small id="zeroWeight"><a href="#dialog-zw" class="view_inline" style="color:#900;cursor:help;">0 weight product ...</a></small></td>';
 $content .= '</tr>';
 $content .= '<tr>';
 $content .= '<td>Default Length/Size</td>';
 if (Product::isUsingSizeInsteadOfLength($obj_product->category_id)) {
     $sizes = getLength2Sizes();
     $size_options = loadComboListFromArray($sizes, null, $pnc['products_length'], false);
     $content .= '<td><select name="products_length" class="w100">' . $size_options . '</select></td>';
 } else {
     $content .= '<td><input type="text" name="products_length" value="' . $pnc['products_length'] . '" class="w100" /> <small title="Insert length only if necessary">cm</small></td>';
 }
 $content .= '</tr>';
 if ($pc !== false) {
     if ($pc['is_finish'] == '1') {
         $content .= '<tr>';
         $content .= '<td>Share Status</td>';
         $content .= '<td>';
         if ($allow_share) {
             $content .= '<input id="radio_sharetoall" type="radio" name="visible_status" value="A" ' . $visible_status_A . ' /><label for="radio_sharetoall" style="margin-right:40px;color:#090;font-weight:bold;">Share to All</label>';
             $content .= '<input id="radio_sharenot" type="radio" name="visible_status" value="N" ' . $visible_status_N . ' /><label for="radio_sharenot" style="color:#900;font-weight:bold;">Not Shared</label><br />';
             $content .= '<input type="button" id="makenotshare" value="Make NOT Shareable!" />';
function getZaloraBMPStockValue($column_key, $product, $aid)
{
    foreach ($product->articles as $article) {
        if ($article['products_articles_id'] == $aid) {
            $stock = $product->retrieveStockQuantity($aid);
            $length = $article['length'];
            if (Product::isUsingSizeInsteadOfLength($product->category_id)) {
                $sizes = getLength2Sizes();
                $length = $sizes[$length];
            }
            if ($length == $column_key || $column_key == 'FREE' && ($length == 'One size' || $length == '0')) {
                return $stock;
            } else {
                $value = '';
            }
        }
    }
    return $value;
}