?> ', weight: '<?php echo addslashes($prod['products_weight']); ?> ', qty: '<?php echo addslashes($prod['qty']); ?> ', warehouse_id: '<?php echo addslashes($prod['warehouse_id']); ?> ', attr: <?php echo tep_js_quote_array($prod['attributes']); ?> }; <?php } ?> </script> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <!--tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent" width="25"><?php echo TABLE_HEADING_QUANTITY; ?> </td>
function show_attrctl($products_id, $base_prices, $pobj) { $opts = tep_get_product_options($products_id); $attrSort = array(); $numimgs = 5; $savedAttrImages = array('none:' => '<img src="images/add-icon.jpg" alt="" title="Add attribute swatch image">'); $addattrimg = array(); foreach ($opts as $optn => $attrs) { $attr_sort = 1; $attrSort[$optn] = array(); foreach ($attrs as $attr => $attrdata) { $attrSort[$optn][$attr] = $attr_sort++; $imgptr = $attrdata['options_image'] ? 'file:' . $attrdata['options_image'] : 'none:'; if ($attrdata['options_image'] && !isset($savedAttrImages[$imgptr])) { $savedAttrImages[$imgptr] = tep_image(DIR_WS_CATALOG_IMAGES . $attrdata['options_image'], $attrdata['options_image'], 24, 16); } $addattrimg[] = "setAttrImage('{$optn}','{$attr}'," . tep_js_quote($imgptr) . ");"; } } $modelFieldList = array(); foreach (array('name', 'price', 'price_sign', 'sku', 'quantity', 'upc', 'childProducts_id') as $fld) { if (!in_array($fld, $pobj->disableModelFields())) { $modelFieldList[] = 'model_' . $fld; } } foreach ($pobj->getModelFields() as $xfld => $fdata) { $modelFieldList[] = 'model_extra[' . $xfld . ']'; } ?> <div id="modelManagerBase"> <div id="addOptionBox" style="display:none"> <table> <tr><td>Create new option:</td><td><input type="text" name="new_option_name" id="new_option_name"></td></tr> <tr><td colspan="2" align="center"> <button type="button" onClick="returnPromptBox(this,$('new_option_name').value)">Create</button> <button type="button" onClick="returnPromptBox(this,null)">Cancel</button> </td></tr> </table> </div> <div id="addOptionValueBox" style="display:none"> <table> <tr><td>Create new value for option <span field="optn_name"></span>:</td><td><input type="text" name="new_option_value_name" id="new_option_value_name"></td></tr> <tr><td colspan="2" align="center"> <button type="button" onClick="returnPromptBox(this,$('new_option_value_name').value)">Create</button> <button type="button" onClick="returnPromptBox(this,null)">Cancel</button> </td></tr> </table> </div> <div id="alertBox" style="display:none"> <table> <tr><td align="left"><pre field="message"></pre></td></tr> <tr><td align="center"><button type="button" onClick="returnPromptBox(this,0)">Ok</button></td></tr> </table> </div> <div id="confirmBox" style="display:none"> <table> <tr><td align="left"><pre field="message"></pre></td></tr> <tr><td align="center"><button type="button" onClick="returnPromptBox(this,1)">Ok</button> <button type="button" onClick="returnPromptBox(this,0)">Cancel</button></td></tr> </table> </div> <div id="selectModelImage" style="display:none"> <div id="selectModelImageExisting"> </div> <div style="display:none"><input type="file" id="upload_model_image_new" name="upload_model_image_new"></div> <table> <tr id="upload_model_image_block_0"> <td><input type="radio" name="select_model_image" value="upload:0"></td> <td> </td> <td><input type="file" id="upload_model_image_0" name="upload_model_image_0"></td> </tr> </table> <div id="selectModelImageDiffWarning" style="width:300px"> <b>Warning:</b> The models in this group have different images in this slot, the individual model images will be overriden if applied! </div> <button type="button" onClick="returnPromptBox(this,this.form.select_model_image)">Select</button> <button type="button" onClick="returnPromptBox(this,null)">Cancel</button> </div> <div id="selectAttrImage" style="display:none; z-index:20;"> <table border="0" style="background:#C0C0C0;"> <tr><td onClick="selectAttrImageDone('none:');">[none]</td><td field="img_icons"> </td></tr> <td colspan="2"><input type="file" id="upload_attr_image_new" name="upload_attr_image_new" style="display:none;"><button onClick="selectAttrImageDone(); return false;">»</button></td> </table> </div> <div id="modelPricingBox" style="display:none;"> Group: <select id="model_switch_pricing_group" onChange="for (var i=0;this.options[i];i++) { var b=$('modelPricingBoxGrp_'+this.options[i].value); if (b) b.style.display=this.options[i].selected?'':'none'; }; updatePromptBox($('modelPricingBox'));"> <?php foreach (tep_get_customer_groups() as $cgrp => $cgname) { ?> <option value="<?php echo $cgrp; ?> "><?php echo $cgname; ?> </option><?php } ?> </select> <div id="modelPricingBoxGrp" style="display:none"> <input type="checkbox" name="mgrp_allow" value="1" onClick="this.parentNode.getElementsByTagName('table')[0].style.display=this.checked?'':'none'; updatePromptBox($('modelPricingBox'));"> Allow separate pricing for this model <table border="0"> <tr><td>Unit Price:</td><td><select name="mgrp_price_sign"><option value="+">+</option><option value="-">-</option></select><input name="mgrp_price_value" type="text"></td></tr> <tr><td colspan="2"> Separate Discount Brackets for this model <table border="0"> <tr><th>Quantity</th><th>Discount %</th></tr> <?php for ($idx = 1; $idx <= 10; $idx++) { ?> <tr><td><input type="text" name="mgrp_dq[<?php echo $idx; ?> ]" size="5"></td><td><input type="text" name="mgrp_dv[<?php echo $idx; ?> ]" size="5"></td></tr> <?php } ?> </table> </td></tr></table> </div> <button type="button" onClick="returnPromptBox(this,this.form.select_model_image)">Select</button> <button type="button" onClick="returnPromptBox(this,null)">Cancel</button> </div> <div id="model_panel_prototype" class="AccordionPanel" style="display:none"> <div class="AccordionPanelTab" style="height:48px !important"> <table cellpadding="1" cellspacing="0" border="0" width="100%" height="45"><tr><td style="padding:3px 0 0 7px; width:21px;" valign="middle"><h4 style="width:11px; height:11px; padding:0"></h4></td><td valign="middle" align="left" style="white-space:nowrap; padding:4px 0 0 1px; font:bold 12px arial"><span field="attribute" style="white-space:nowrap;">Attribute</span> (<span field="count">0</span>)</td> <?php for ($i = 0; $i < $numimgs; $i++) { ?> <td style="width:<?php echo MODEL_THUMB_WIDTH; ?> px; height:<?php echo MODEL_THUMB_HEIGHT; ?> px; padding:3px 5px 0 0; cursor:pointer; text-align:center; vertical-align:middle;" field="model_image_<?php echo $i; ?> " onClick="selectGroupImage(this,<?php echo $i; ?> ); event.cancelBubble=true;"><?php echo tep_image(DIR_WS_IMAGES . 'no_image.gif', '', MODEL_THUMB_WIDTH, MODEL_THUMB_HEIGHT); ?> </td> <?php } ?> </tr></table> </div> <div class="AccordionPanelContent"><div></div></div> </div> <div id="model_entry_prototype" style="display:none;"> <table width="95%" style="border-bottom:1px dashed #999999"> <tr> <td align="center" width="50"><img src="images/expand.png" border="0" alt="" vspace="5" > <div style="z-index:100; width:42px; height:42px; padding:0; overflow:hidden; position:relative;"> <div style="z-index:20; position:absolute; top:-3px; left:-3px; margin:0;" onMouseOver="this.parentNode.style.overflow='visible';" onMouseOut="this.parentNode.style.overflow='hidden';"> <table cellspacing="0" cellpadding="0" border="0" style="border:dashed 1px #999999; background-color:#CCC;"> <tr> <?php for ($i = 0; $i < $numimgs; $i++) { ?> <td> <div style="width:<?php echo MODEL_HEIGHT_WIDTH; ?> px;height:<?php echo MODEL_THUMB_HEIGHT; ?> px;padding:3px 10px 5px 3px;margin:0;cursor:pointer; text-align:center; vertical-align:middle;" field="model_image_<?php echo $i; ?> " onClick="selectModelImage(this,<?php echo $i; ?> )"><?php echo tep_image(DIR_WS_IMAGES . 'no_image.gif', '', MODEL_THUMB_WIDTH, MODEL_THUMB_HEIGHT); ?> </div> </td> <?php } ?> </tr> <tr> <?php for ($i = 0; $i < $numimgs; $i++) { ?> <td align="center"><?php echo $i > 0 ? 'alt' . $i : 'main'; ?> </td> <?php } ?> </tr> </table> </div> </div> </td> <td valign="top"> <div style="overflow:hidden"> <div field="attributes" style="position:relative; top:1px; left:0px;" onMouseOver="this.parentNode.style.overflow='visible';" onMouseOut="this.parentNode.style.overflow='hidden';"> </div> </div> </td> <td> <table style="padding:0 0 0 10px;"> <tr> <td align="right" style="padding:0 7px 0 0">Price:</td> <td> <?php if (!in_array('price_sign', $pobj->disableModelFields())) { ?> <select name="model_price_sign[]"> <option value="+">+</option> <option value="-">-</option> </select> <?php } ?> <input type="text" name="model_price[]" field="model_price" size="7"> <input type="hidden" name="model_pricing_list[]" value=""> <a href="javascript:void(0);" onclick="showPricingBox(this); return false;"><img src="images/add-icon.jpg" alt="" title="Edit model price breaks and pricing Groups" width="14" height="14" hspace="10" border="0"></a></td> <?php if (!in_array('quantity', $pobj->disableModelFields())) { ?> <td align="right" style="padding:0 7px 0 10px">Avail. Stock:</td><td><input type="text" name="model_quantity[]" field="model_quantity" size="6"></td> <?php } else { echo '<td> </td><td> </td>'; } ?> </tr> <tr> <td align="right" style="padding:0 7px 0 0">Model:</td> <td><input type="text" name="model_name[]" field="model_name"></td> <td align="right" style="padding:0 7px 0 0">SKU:</td> <td><input type="text" name="model_sku[]" field="model_sku"></td> </tr> <tr> <td align="right" style="padding:0 7px 0 0">Available on:</td> <td><input type="text" name="model_date_available[]" field="model_date_available" size="10" onClick="popUpCalendar(this,this,'mm/dd/yyyy',document);"></td> <td align="right" style="padding:0 7px 0 0">UPC:</td> <td><input type="text" name="model_upc[]" field="model_upc"></td> </tr> <tr> <td colspan="3"> </td> <td style="padding:5px 7px 5px 0;"> <div id="theFeed" onclick="setFeeds(this)"; return false;" style="line-height:15px; cursor:pointer;"> <img src="images/add-icon.jpg" alt="" title="Edit Marketplace Feeds" width="14" height="14" border="0"> Edit / Add Feeds </div> </td> </tr> <?php foreach ($pobj->getModelFields() as $xfld => $fdata) { ?> <tr> <td colspan="2"><?php echo $fdata['title']; ?> :</td> <td colspan="2"><input type="text" name="model_extra[<?php echo $xfld; ?> ][]" field="model_x_<?php echo $xfld; ?> " size="6"></td> </tr> <?php } ?> </table> </td> <td style="padding:0 10px 0 0" id="test"><a href="javascript:void(0)" onClick="window.theEvent=event; delThisModel(this);"><img src="images/delete.png" alt="" title="Delete this attribute combination" id="deleteicon"></a></td> </tr></table> <input type="hidden" name="model_attrs[]" value=""> <input type="hidden" name="model_image_ptr[]" value=""> <input type="hidden" name="model_childProducts_id[]" value=""> </div> <?php $last_bar = isset($prod) ? $prod : null; ?> <div id="modelSetFeeds_<?php echo $prod; ?> " class="modelSetFeeds" style="display:none; width:80%; padding: 10px;"> <?php // # Marketplace feeds // # check to make sure attributes exist by comparing products_id to master_producs_id $attributeFeed_query = tep_db_query("SELECT master_products_id, products_id \r\n\t\t\t\t\t\t\t\t\t\t FROM products \r\n\t\t\t\t\t\t\t\t\t\t WHERE master_products_id = '" . $products_id . "' \r\n\t\t\t\t\t\t\t\t\t\t AND products_id != master_products_id\r\n\t\t\t\t\t\t\t\t\t\t"); // # if attributes id's found, generate the Feed selectors if (tep_db_num_rows($attributeFeed_query) > 0) { $DBFeedMods = tep_module('dbfeed'); $DBFeedMods->adminProductEdit($theProducts_id); } //var_dump($theProducts_id); ?> <button type="button" onclick="returnPromptBox(this,null)">Cancel</button> </div> <div id="modelManager"> <div class="modelAccordion" id="modelAccordion" tabindex="0"></div> <div style="padding:15px 0 10px 2px;"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td width="23"><img src="images/add.png" title="Add attribute to model" width="22" height="23" alt=""></td><td style="padding:0 0 0 6px; font:bold 13px arial; text-align:left"> Add Models:</td><td align="right" style="padding:0 10px 0 0"> <div onmouseover="ShowContent('tips1'); return true;" onmouseout="HideContent('tips1'); return true;" class="helpicon" style="width:16px; height:16px;"><a href="javascript:ShowContent('tips1')"></a></div> <div id="tips1" style="display:none; position:absolute; border: 1px dashed #333; background-color: white; padding: 5px; text-align:left; width:300px;"> <font class="featuredpopName"><b style="white-space:nowrap;">Attributes & Models</b></font><br><br><b>#1 Add Attributes</b> - Add Attributes from the dashed box to the left. Example: Color, Size, Width, In-seam. After Adding Attributes, you must add Attribute Values.<br><br><b>#2 Attribute Values</b> - Example: Small (or SM), Large, 34B, 34C.<br><br><b>#3 Price</b> - The difference of price for this particular model. Uses price from your Prices Tab above. Default is no difference.<br><br><b>Model</b> - Arbitrary model number of product model.<br><br><b>Image</b> - Model Image. Hint: Assign different color photos for your different color attributes.<br><br><b>Avail. Stock</b> - Your available to sell stock. <u>Note:</u> If you\'ve activated an ERP module, this value will be dynamically fed from your ERP system.<br><br> <b>SKU</b> - 7 Digits typically. <br><br> <b>UPC</b> - 12 Digit Universal Identifer: <u>Note:</u> If you\'ve activated an ERP module, this value will be required to link your models to your ERP system. </div> </td></tr></table></div> <table width="100%" border="0" cellpadding="0" cellspacing="0" style="background-color:#D4EAB7; border:dashed 1px #CCC;"> <tr> <td id="new_model_attrs"> </td> <td valign="top" style="padding:10px 0 0 0" valign="top"> <table width="100%"> <tr> <td valign="top"> <table cellpadding="5" cellspacing="0" border="0" style="margin: 0 0 0 35px;"> <tr> <td align="right">Price:</td> <td><?php if (!in_array('price_sign', $pobj->disableModelFields())) { ?> <select name="new_model_price_sign" id="new_model_price_sign"><option value="+">+</option> <option value="-">-</option></select> <?php } ?> <input type="text" name="new_model_price" id="new_model_price" size="7"> </td> </tr> <table> <table style="margin: 0 0 0 35px"> <tr> <?php if (!in_array('quantity', $pobj->disableModelFields())) { echo '<td align="right" style="padding-right:5px; width:30px;" nowrap>Qty:</td>'; ?> <td><input type="text" name="new_model_quantity" id="new_model_quantity" size="6"></td> <?php } else { echo '<td colspan="2"> </td>'; } ?> </td></tr> <tr> <td valign="bottom" colspan="2" style="padding: 5px 0 0 0">Select Attribute Image:</td> </tr> </table> </td> <td> <table> <tr> <td align="right" style="padding:5px 7px 5px 0">Model:</td><td><input type="text" name="new_model_name" id="new_model_name"></td> </tr> <td align="right" style="padding:0 7px 5px 0;">SKU:</td><td><input type="text" name="new_model_sku" id="new_model_sku"></td> </tr> <tr> <td align="right" style="padding:0 7px 5px 0;">UPC:</td><td><input type="text" name="new_model_upc" id="new_model_upc"></td> </tr> <?php foreach ($pobj->getModelFields() as $xfld => $fdata) { ?> <tr> <td colspan="2"><?php echo $fdata['title']; ?> :</td> <td><input type="text" name="new_model_extra[<?php echo $xfld; ?> ]" id="new_model_extra[<?php echo $xfld; ?> ]" field="model_x_<?php echo $xfld; ?> " size="6"></td> </tr> <?php } ?> </table> </td></tr> </table> <table style="margin: 0 0 5px 40px" cellpadding="0" cellspacing="0"> <tr> <td valign="top"> <input type="file" id="new_upload_model_image" name="new_upload_model_image" style="font:normal 11px verdana;"></td> </tr> </table> </td> <td style="padding:0 10px 0 10px;"><a href="javascript:void(0)" onClick="addNewModel('new')"><img src="images/add.png" alt="" border="0" title="Add model to product"></a></td> </tr></table> </div> <div id="models_populate" style="display:none;"> <table><tr> <td><?php echo tep_draw_pull_down_menu('models_populate_cat', tep_get_category_tree(), '', 'onChange="loadPopulateProducts(this.value)"'); ?> </td> <td id="models_populate_prod_box"></td> </tr></table> <script type="text/javascript"> function loadPopulateProducts(cat) { var blk=$('models_populate_prod_box'); blk.innerHTML=''; new ajax('attrctl_populate.php?cat='+cat,{update:blk}); } </script> </div> </div> <script type="text/javascript"> var modelAccordion = new Spry.Widget.Accordion("modelAccordion"); var currOptions=<?php echo tep_js_quote_array(array_keys($opts)); ?> ; var primaryOptions=[true]; var attrSort=<?php echo tep_js_quote($attrSort); ?> ; var modelFieldList=<?php echo tep_js_quote_array($modelFieldList); ?> ; //alert(currOptions.toSource()); <?php $modattrs = tep_get_product_models($products_id); $images = array(); //if($default_image) $images[]=$default_image; $savedImages = array('default:' => '[none]', 'multiple:' => '[****]'); $addmdl = array(); foreach ($modattrs as $mid => $attrs) { $modl = tep_get_product_model_fields($products_id, $mid); $model_price = $modl['products_price'] - $base_prices[0]; $img_ptr = array(); foreach ($modl['products_image_list'] as $idx => $pimg) { if ($pimg && !isset($images[$pimg])) { $images[$pimg] = $pimg; } $img_ptr[$idx] = $pimg ? 'file:' . $pimg : 'default:'; if ($img_ptr[$idx] && !isset($savedImages[$img_ptr[$idx]])) { $savedImages[$img_ptr[$idx]] = tep_image(DIR_WS_CATALOG_IMAGES . $pimg, $pimg, MODEL_THUMB_WIDTH, MODEL_THUMB_HEIGHT); } } $grp_price = array(0 => $modl['products_price']); $discnts = array(); $grp_qry = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_GROUPS . " WHERE products_id = '{$mid}'"); while ($row = tep_db_fetch_array($grp_qry)) { $grp_price[$row['customers_group_id']] = $row['customers_group_price']; } $dsc_qry = tep_db_query("SELECT * FROM products_discount WHERE products_id='{$mid}'"); while ($row = tep_db_fetch_array($dsc_qry)) { if (!isset($discnts[$row['customers_group_id']])) { $discnts[$row['customers_group_id']] = array(); } $discnts[$row['customers_group_id']][$row['discount_qty']] = $row['discount_qty'] . ':' . $row['discount_percent']; } $pr_grps = array(); foreach ($grp_price as $cgrp => $prc) { $pr_grps[] = $cgrp . ':' . ($prc - $base_prices[$cgrp]) . (isset($discnts[$cgrp]) ? ',' . join(',', $discnts[$cgrp]) : ''); } $pr_list = join(';', $pr_grps); $date_av_t = preg_match('/^[1-9]/', $modl['products_date_available']) ? strtotime($modl['products_date_available']) : 0; $date_av = $date_av_t > 0 ? date('m/d/Y', $date_av_t) : ''; $modflds = array('model_name[]' => $modl['products_model'], 'model_sku[]' => $modl['products_sku'], 'model_upc[]' => $modl['products_upc'], 'model_asin[]' => $modl['products_asin'], 'model_ship[]' => $modl['products_ship'], 'model_date_available[]' => $date_av, 'model_quantity[]' => $modl['products_quantity'], 'model_price_sign[]' => $model_price < 0 ? '-' : '+', 'model_price[]' => sprintf("%.2f", abs($model_price)), 'model_pricing_list[]' => $pr_list, 'model_image_ptr[]' => join('/', $img_ptr), 'model_childProducts_id[]' => $mid); foreach ($pobj->getModelFields() as $xfld => $fdata) { $modflds['model_extra[' . $xfld . '][]'] = tep_get_products_extra($mid, $xfld); } $addmdl[] = "addModel(" . tep_js_quote_array(array_keys($attrs)) . "," . tep_js_quote_array(array_values($attrs)) . "," . tep_js_quote($modflds) . ");"; } ?> var savedImages=<?php echo tep_js_quote($savedImages); ?> ; var savedAttrImages=<?php echo tep_js_quote($savedAttrImages); ?> ; function showAllModels() { showOptionSelectors('new_model_attrs'); <?php echo join("\n", $addattrimg); ?> <?php echo join("\n", $addmdl); ?> } </script> <div style="display:none"> <table id="listModelImages"> <tr> <td><input type="radio" name="select_model_image" value="default:"></td> <td colspan="2">None</td> </tr> <?php foreach ($images as $img) { ?> <tr> <td><input type="radio" name="select_model_image" value="file:<?php echo htmlspecialchars($img); ?> "></td> <td><?php echo tep_image(DIR_WS_CATALOG_IMAGES . $img, $img, 40, 40); ?> </td> <td><?php echo htmlspecialchars($img); ?> </td> </tr> <?php } ?> </table> </div> <script type="text/javascript"> $('selectModelImageExisting').insertBefore($('listModelImages'),null); </script> <?php }
} $opvalsJS[] = $opid . ':{' . join(',', $opvalsJS2) . '}'; } ?> var optnNames={<?php echo join(',', $optnsJS); ?> }; var attrValues={<?php echo join(',', $opvalsJS); ?> }; var currOptions=<?php echo tep_js_quote_array(array_keys(tep_get_product_options($products_id))); ?> ; function scanFields(fields,blk,tag) { var fld; for (var e=blk.firstChild;e;e=e.nextSibling) { if (e.getAttribute && (fld=e.getAttribute(tag))) fields[fld]=e; else scanFields(fields,e,tag); } } function setField(blk,name,val,df) { if (val==null) val=df; if (!blk) return;
comments: '<?php echo addslashes($prod['comments']); ?> ', attr: <?php echo tep_js_quote_array($prod['attributes']); ?> }; <?php } ?> </script> <script type="text/javascript"> supply_requestProducts = <?php echo tep_js_quote_array($supply_request->add_product); ?> ; renderProducts(); ReloadAddProduct(); </script> </div> </td> <tr> <td class="SubTitle"><?php echo MENUE_TITLE_TOTAL; ?> </td> </tr> <tr> <td>