function displayFormInformations($obj, $currency) { parent::displayForm(false); global $currentIndex, $cookie, $link; $default_country = new Country((int) Configuration::get('PS_COUNTRY_DEFAULT')); $iso = Language::getIsoById((int) $cookie->id_lang); $has_attribute = false; $qty_state = 'readonly'; $qty = Attribute::getAttributeQty($this->getFieldValue($obj, 'id_product')); if ($qty === false) { if (Validate::isLoadedObject($obj)) { $qty = $this->getFieldValue($obj, 'quantity'); } else { $qty = 1; } $qty_state = ''; } else { $has_attribute = true; } $cover = Product::getCover($obj->id); $this->_applyTaxToEcotax($obj); echo ' <div class="tab-page" id="step1"> <h4 class="tab">1. ' . $this->l('Info.') . '</h4> <script type="text/javascript"> $(document).ready(function() { updateCurrentText(); updateFriendlyURL(); $.ajax({ url: "' . dirname($currentIndex) . '/ajax.php", cache: false, dataType: "json", data: "ajaxProductManufacturers=1", success: function(j) { var options = $("select#id_manufacturer").html(); if (j) for (var i = 0; i < j.length; i++) options += \'<option value="\' + j[i].optionValue + \'">\' + j[i].optionDisplay + \'</option>\'; $("select#id_manufacturer").html(options); }, error: function(XMLHttpRequest, textStatus, errorThrown) { alert(\'Manufacturer ajax error: \'+textStatus); } }); $.ajax({ url: "' . dirname($currentIndex) . '/ajax.php", cache: false, dataType: "json", data: "ajaxProductSuppliers=1", success: function(j) { var options = $("select#id_supplier").html(); if (j) for (var i = 0; i < j.length; i++) options += \'<option value="\' + j[i].optionValue + \'">\' + j[i].optionDisplay + \'</option>\'; $("select#id_supplier").html(options); }, error: function(XMLHttpRequest, textStatus, errorThrown) { alert(\'Supplier ajax error: \'+textStatus); } }); if ($(\'#available_for_order\').is(\':checked\')){ $(\'#show_price\').attr(\'checked\', \'checked\'); $(\'#show_price\').attr(\'disabled\', \'disabled\'); } else { $(\'#show_price\').attr(\'disabled\', \'\'); } }); </script> <b>' . $this->l('Product global information') . '</b> - '; $preview_url = ''; if (isset($obj->id)) { $preview_url = $link->getProductLink($this->getFieldValue($obj, 'id'), $this->getFieldValue($obj, 'link_rewrite', $this->_defaultFormLanguage), Category::getLinkRewrite($this->getFieldValue($obj, 'id_category_default'), (int) $cookie->id_lang)); if (!$obj->active) { $admin_dir = dirname($_SERVER['PHP_SELF']); $admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1); $token = Tools::encrypt('PreviewProduct' . $obj->id); $preview_url .= $obj->active ? '' : '&adtoken=' . $token . '&ad=' . $admin_dir; } echo ' <a href="index.php?tab=AdminCatalog&id_product=' . $obj->id . '&deleteproduct&token=' . $this->token . '" style="float:right;" onclick="return confirm(\'' . $this->l('Are you sure?', __CLASS__, true, false) . '\');"> <img src="../img/admin/delete.gif" alt="' . $this->l('Delete this product') . '" title="' . $this->l('Delete this product') . '" /> ' . $this->l('Delete this product') . '</a> <a href="' . $preview_url . '" target="_blank"><img src="../img/admin/details.gif" alt="' . $this->l('View product in shop') . '" title="' . $this->l('View product in shop') . '" /> ' . $this->l('View product in shop') . '</a>'; if (file_exists(_PS_MODULE_DIR_ . 'statsproduct/statsproduct.php')) { echo ' - <a href="index.php?tab=AdminStats&module=statsproduct&id_product=' . $obj->id . '&token=' . Tools::getAdminToken('AdminStats' . (int) Tab::getIdFromClassName('AdminStats') . (int) $cookie->id_employee) . '"><img src="../modules/statsproduct/logo.gif" alt="' . $this->l('View product sales') . '" title="' . $this->l('View product sales') . '" /> ' . $this->l('View product sales') . '</a>'; } } echo ' <hr class="clear"/> <br /> <table cellpadding="5" style="width: 50%; float: left; margin-right: 20px; border-right: 1px solid #E0D0B1;"> <tr> <td class="col-left">' . $this->l('Name:') . '</td> <td style="padding-bottom:5px;" class="translatable">'; foreach ($this->_languages as $language) { echo ' <div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;"> <input size="43" type="text" id="name_' . $language['id_lang'] . '" name="name_' . $language['id_lang'] . '" value="' . stripslashes(htmlspecialchars($this->getFieldValue($obj, 'name', $language['id_lang']))) . '"' . (!$obj->id ? ' onkeyup="if (isArrowKey(event)) return; copy2friendlyURL();"' : '') . ' onkeyup="if (isArrowKey(event)) return; updateCurrentText();" onchange="updateCurrentText();" /><sup> *</sup> <span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span> </div>'; } echo ' </td> </tr> <tr> <td class="col-left">' . $this->l('Reference:') . '</td> <td style="padding-bottom:5px;"> <input size="55" type="text" name="reference" value="' . htmlentities($this->getFieldValue($obj, 'reference'), ENT_COMPAT, 'UTF-8') . '" style="width: 130px; margin-right: 44px;" /> <span class="hint" name="help_box">' . $this->l('Special characters allowed:') . ' .-_#\\<span class="hint-pointer"> </span></span> </td> </tr> <tr> <td class="col-left">' . $this->l('Supplier Reference:') . '</td> <td style="padding-bottom:5px;"> <input size="55" type="text" name="supplier_reference" value="' . htmlentities($this->getFieldValue($obj, 'supplier_reference'), ENT_COMPAT, 'UTF-8') . '" style="width: 130px; margin-right: 44px;" /> <span class="hint" name="help_box">' . $this->l('Special characters allowed:') . ' .-_#\\<span class="hint-pointer"> </span></span> </td> </tr> <tr> <td class="col-left">' . $this->l('EAN13 or JAN:') . '</td> <td style="padding-bottom:5px;"> <input size="55" maxlength="13" type="text" name="ean13" value="' . htmlentities($this->getFieldValue($obj, 'ean13'), ENT_COMPAT, 'UTF-8') . '" style="width: 130px; margin-right: 5px;" /> <span class="small">' . $this->l('(Europe, Japan)') . '</span> </td> </tr> <tr> <td class="col-left">' . $this->l('UPC:') . '</td> <td style="padding-bottom:5px;"> <input size="55" maxlength="12" type="text" name="upc" value="' . htmlentities($this->getFieldValue($obj, 'upc'), ENT_COMPAT, 'UTF-8') . '" style="width: 130px; margin-right: 5px;" /> <span class="small">' . $this->l('(US, Canada)') . '</span> </td> </tr> <tr> <td class="col-left">' . $this->l('Location (warehouse):') . '</td> <td style="padding-bottom:5px;"> <input size="55" type="text" name="location" value="' . htmlentities($this->getFieldValue($obj, 'location'), ENT_COMPAT, 'UTF-8') . '" style="width: 130px; margin-right: 44px;" /> </td> </tr> <tr> <td class="col-left">' . $this->l('Width ( package ) :') . '</td> <td style="padding-bottom:5px;"> <input size="6" maxlength="6" name="width" type="text" value="' . htmlentities($this->getFieldValue($obj, 'width'), ENT_COMPAT, 'UTF-8') . '" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\');" /> ' . Configuration::get('PS_DIMENSION_UNIT') . ' </td> </tr> <tr> <td class="col-left">' . $this->l('Height ( package ) :') . '</td> <td style="padding-bottom:5px;"> <input size="6" maxlength="6" name="height" type="text" value="' . htmlentities($this->getFieldValue($obj, 'height'), ENT_COMPAT, 'UTF-8') . '" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\');" /> ' . Configuration::get('PS_DIMENSION_UNIT') . ' </td> </tr> <tr> <td class="col-left">' . $this->l('Deep ( package ) :') . '</td> <td style="padding-bottom:5px;"> <input size="6" maxlength="6" name="depth" type="text" value="' . htmlentities($this->getFieldValue($obj, 'depth'), ENT_COMPAT, 'UTF-8') . '" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\');" /> ' . Configuration::get('PS_DIMENSION_UNIT') . ' </td> </tr> <tr> <td class="col-left">' . $this->l('Weight ( package ) :') . '</td> <td style="padding-bottom:5px;"> <input size="6" maxlength="6" name="weight" type="text" value="' . htmlentities($this->getFieldValue($obj, 'weight'), ENT_COMPAT, 'UTF-8') . '" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\');" /> ' . Configuration::get('PS_WEIGHT_UNIT') . ' </td> </tr> </table> <table cellpadding="5" style="width: 40%; float: left; margin-left: 10px;"> <tr> <td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Status:') . '</td> <td style="padding-bottom:5px;"> <input style="float:left;" onclick="toggleDraftWarning(false);showOptions(true);" type="radio" name="active" id="active_on" value="1" ' . ($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/> <label for="active_on" class="t"><img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" style="float:left; padding:0px 5px 0px 5px;" />' . $this->l('Enabled') . '</label> <br class="clear" /> <input style="float:left;" onclick="toggleDraftWarning(true);showOptions(false);" type="radio" name="active" id="active_off" value="0" ' . (!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/> <label for="active_off" class="t"><img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" style="float:left; padding:0px 5px 0px 5px" />' . $this->l('Disabled') . ($obj->active ? '' : ' (<a href="' . $preview_url . '" alt="" target="_blank">' . $this->l('View product in shop') . '</a>)') . '</label> </td> </tr> <tr id="product_options" ' . (!$obj->active ? 'style="display:none"' : '') . '> <td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Options:') . '</td> <td style="padding-bottom:5px;"> <input style="float: left;" type="checkbox" name="available_for_order" id="available_for_order" value="1" ' . ($this->getFieldValue($obj, 'available_for_order') ? 'checked="checked" ' : '') . ' onclick="if ($(this).is(\':checked\')){$(\'#show_price\').attr(\'checked\', \'checked\');$(\'#show_price\').attr(\'disabled\', \'disabled\');}else{$(\'#show_price\').attr(\'disabled\', \'\');}"/> <label for="available_for_order" class="t"><img src="../img/admin/products.gif" alt="' . $this->l('available for order') . '" title="' . $this->l('available for order') . '" style="float:left; padding:0px 5px 0px 5px" />' . $this->l('available for order') . '</label> <br class="clear" /> <input style="float: left;" type="checkbox" name="show_price" id="show_price" value="1" ' . ($this->getFieldValue($obj, 'show_price') ? 'checked="checked" ' : '') . ' /> <label for="show_price" class="t"><img src="../img/admin/gold.gif" alt="' . $this->l('display price') . '" title="' . $this->l('show price') . '" style="float:left; padding:0px 5px 0px 5px" />' . $this->l('show price') . '</label> <br class="clear" /> <input style="float: left;" type="checkbox" name="online_only" id="online_only" value="1" ' . ($this->getFieldValue($obj, 'online_only') ? 'checked="checked" ' : '') . ' /> <label for="online_only" class="t"><img src="../img/admin/basket_error.png" alt="' . $this->l('online only') . '" title="' . $this->l('online only') . '" style="float:left; padding:0px 5px 0px 5px" />' . $this->l('online only (not sold in store)') . '</label> </td> </tr> <tr> <td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Condition:') . '</td> <td style="padding-bottom:5px;"> <select name="condition" id="condition"> <option value="new" ' . ($obj->condition == 'new' ? 'selected="selected"' : '') . '>' . $this->l('New') . '</option> <option value="used" ' . ($obj->condition == 'used' ? 'selected="selected"' : '') . '>' . $this->l('Used') . '</option> <option value="refurbished" ' . ($obj->condition == 'refurbished' ? 'selected="selected"' : '') . '>' . $this->l('Refurbished') . '</option> </select> </td> </tr> <tr> <td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Manufacturer:') . '</td> <td style="padding-bottom:5px;"> <select name="id_manufacturer" id="id_manufacturer"> <option value="0">-- ' . $this->l('Choose (optional)') . ' --</option>'; if ($id_manufacturer = $this->getFieldValue($obj, 'id_manufacturer')) { echo ' <option value="' . $id_manufacturer . '" selected="selected">' . Manufacturer::getNameById($id_manufacturer) . '</option> <option disabled="disabled">----------</option>'; } echo ' </select> <a href="?tab=AdminManufacturers&addmanufacturer&token=' . Tools::getAdminToken('AdminManufacturers' . (int) Tab::getIdFromClassName('AdminManufacturers') . (int) $cookie->id_employee) . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete product information entered?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="' . $this->l('Create') . '" title="' . $this->l('Create') . '" /> <b>' . $this->l('Create') . '</b></a> </td> </tr> <tr> <td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Supplier:') . '</td> <td style="padding-bottom:5px;"> <select name="id_supplier" id="id_supplier"> <option value="0">-- ' . $this->l('Choose (optional)') . ' --</option>'; if ($id_supplier = $this->getFieldValue($obj, 'id_supplier')) { echo ' <option value="' . $id_supplier . '" selected="selected">' . Supplier::getNameById($id_supplier) . '</option> <option disabled="disabled">----------</option>'; } echo ' </select> <a href="?tab=AdminSuppliers&addsupplier&token=' . Tools::getAdminToken('AdminSuppliers' . (int) Tab::getIdFromClassName('AdminSuppliers') . (int) $cookie->id_employee) . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="' . $this->l('Create') . '" title="' . $this->l('Create') . '" /> <b>' . $this->l('Create') . '</b></a> </td> </tr> </table> <div class="clear"></div> <table cellpadding="5" style="width: 100%;"> <tr><td colspan="2"><hr style="width:100%;" /></td></tr>'; $this->displayPack($obj); echo ' <tr><td colspan="2"><hr style="width:100%;" /></td></tr>'; /* * Form for add a virtual product like software, mp3, etc... */ $productDownload = new ProductDownload(); if ($id_product_download = $productDownload->getIdFromIdProduct($this->getFieldValue($obj, 'id'))) { $productDownload = new ProductDownload($id_product_download); } ?> <script type="text/javascript"> // <![CDATA[ ThickboxI18nImage = '<?php echo $this->l('Image'); ?> '; ThickboxI18nOf = '<?php echo $this->l('of'); ?> '; ThickboxI18nClose = '<?php echo $this->l('Close'); ?> '; ThickboxI18nOrEscKey = '<?php echo $this->l('(or "Esc")'); ?> '; ThickboxI18nNext = '<?php echo $this->l('Next >'); ?> '; ThickboxI18nPrev = '<?php echo $this->l('< Previous'); ?> '; tb_pathToImage = '../img/loadingAnimation.gif'; //]]> </script> <script type="text/javascript" src="<?php echo _PS_JS_DIR_; ?> jquery/thickbox-modified.js"></script> <script type="text/javascript" src="<?php echo _PS_JS_DIR_; ?> jquery/ajaxfileupload.js"></script> <script type="text/javascript" src="<?php echo _PS_JS_DIR_; ?> date.js"></script> <style type="text/css"> <!-- @import url(<?php echo _PS_CSS_DIR_; ?> thickbox.css); --> </style> <script type="text/javascript"> //<![CDATA[ function toggleVirtualProduct(elt) { if (elt.checked) { $('#virtual_good').show('slow'); $('#virtual_good_more').show('slow'); getE('out_of_stock_1').checked = 'checked'; getE('out_of_stock_2').disabled = 'disabled'; getE('out_of_stock_3').disabled = 'disabled'; getE('label_out_of_stock_2').setAttribute('for', ''); getE('label_out_of_stock_3').setAttribute('for', ''); } else { $('#virtual_good').hide('slow'); $('#virtual_good_more').hide('slow'); getE('out_of_stock_2').disabled = false; getE('out_of_stock_3').disabled = false; getE('label_out_of_stock_2').setAttribute('for', 'out_of_stock_2'); getE('label_out_of_stock_3').setAttribute('for', 'out_of_stock_3'); } } function uploadFile() { $.ajaxFileUpload ( { url:'./uploadProductFile.php', secureuri:false, fileElementId:'virtual_product_file', dataType: 'xml', success: function (data, status) { data = data.getElementsByTagName('return')[0]; var result = data.getAttribute("result"); var msg = data.getAttribute("msg"); var fileName = data.getAttribute("filename"); if (result == "error") { $("#upload-confirmation").html('<p>error: ' + msg + '</p>'); } else { $('#virtual_product_file').remove(); $('#virtual_product_file_label').hide(); $('#file_missing').hide(); new_href = $('#delete_downloadable_product').attr('href').replace('%26deleteVirtualProduct%3Dtrue', '%26file%3D'+msg+'%26deleteVirtualProduct%3Dtrue'); $('#delete_downloadable_product').attr('href', new_href); $('#delete_downloadable_product').show(); $('#virtual_product_name').attr('value', fileName); $('#upload-confirmation').html( '<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'"><?php echo $this->l('The file'); ?> "' + fileName + '" <?php echo $this->l('has successfully been uploaded'); ?> </a>' + '<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="' + msg + '" />'); } } } ); } //]]> </script> <?php echo ' <script type="text/javascript" src="../js/price.js"></script> <script type="text/javascript"> var newLabel = \'' . $this->l('New label') . '\'; var choose_language = \'' . $this->l('Choose language:') . '\'; var required = \'' . $this->l('required') . '\'; var customizationUploadableFileNumber = ' . (int) $this->getFieldValue($obj, 'uploadable_files') . '; var customizationTextFieldNumber = ' . (int) $this->getFieldValue($obj, 'text_fields') . '; var uploadableFileLabel = 0; var textFieldLabel = 0; </script>'; ?> <tr> <td colspan="2"> <p><input type="checkbox" id="is_virtual_good" name="is_virtual_good" value="true" onclick="toggleVirtualProduct(this);" <?php if (($productDownload->id or Tools::getValue('is_virtual_good') == 'true') and $productDownload->active) { echo 'checked="checked"'; } ?> /> <label for="is_virtual_good" class="t bold" style="color: black;"><?php echo $this->l('Is this a downloadable product?'); ?> </label></p> <div id="virtual_good" <?php if (!$productDownload->id or !$productDownload->active) { echo 'style="display:none;"'; } ?> > <?php if (!ProductDownload::checkWritableDir()) { ?> <p class="alert"> <?php echo $this->l('Your download repository is not writable.'); ?> <br/> <?php echo realpath(_PS_DOWNLOAD_DIR_); ?> </p> <?php } else { ?> <?php if ($productDownload->id) { echo '<input type="hidden" id="virtual_product_id" name="virtual_product_id" value="' . $productDownload->id . '" />'; } ?> <p class="block"> <?php if (!$productDownload->checkFile()) { ?> <div style="padding:5px;width:50%;float:left;margin-right:20px;border-right:1px solid #E0D0B1"> <?php if ($productDownload->id) { ?> <p class="alert" id="file_missing"> <?php echo $this->l('This product is missing'); ?> :<br/> <?php echo realpath(_PS_DOWNLOAD_DIR_) . '/' . $productDownload->physically_filename; ?> </p> <?php } ?> <p><?php $max_upload = (int) ini_get('upload_max_filesize'); $max_post = (int) ini_get('post_max_size'); $upload_mb = min($max_upload, $max_post); echo $this->l('Your server\'s maximum upload file size is') . ': ' . $upload_mb . $this->l('Mb'); ?> </p> <?php if (!strval(Tools::getValue('virtual_product_filename'))) { ?> <label id="virtual_product_file_label" for="virtual_product_file" class="t"><?php echo $this->l('Upload a file'); ?> </label> <p><input type="file" id="virtual_product_file" name="virtual_product_file" onchange="uploadFile();" /></p> <?php } ?> <div id="upload-confirmation"> <?php if ($up_filename = strval(Tools::getValue('virtual_product_filename'))) { ?> <input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="<?php echo $up_filename; ?> " /> <?php } ?> </div> <a id="delete_downloadable_product" style="display:none;" href="confirm.php?height=200&width=300&modal=true&referer=<?php echo rawurlencode($_SERVER['REQUEST_URI'] . '&deleteVirtualProduct=true'); ?> " class="thickbox red" title="<?php echo $this->l('Delete this file'); ?> "><?php echo $this->l('Delete this file'); ?> </a> <?php } else { ?> <input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="<?php echo $productDownload->physically_filename; ?> " /> <?php echo $this->l('This is the link') . ': ' . $productDownload->getHtmlLink(false, true); ?> <a href="confirm.php?height=200&width=300&modal=true&referer=<?php echo rawurlencode($_SERVER['REQUEST_URI'] . '&deleteVirtualProduct=true'); ?> " class="thickbox red" title="<?php echo $this->l('Delete this file'); ?> "><?php echo $this->l('Delete this file'); ?> </a> <?php } // check if file exists ?> </p> <p class="block"> <label for="virtual_product_name" class="t"><?php echo $this->l('Filename'); ?> </label> <input type="text" id="virtual_product_name" name="virtual_product_name" style="width:200px" value="<?php echo $productDownload->id > 0 ? $productDownload->display_filename : htmlentities(Tools::getValue('virtual_product_name'), ENT_COMPAT, 'UTF-8'); ?> " /> <span class="hint" name="help_box" style="display:none;"><?php echo $this->l('The full filename with its extension (e.g., Book.pdf)'); ?> </span> </p> </div> <div id="virtual_good_more" style="<?php if (!$productDownload->id or !$productDownload->active) { echo 'display:none;'; } ?> padding:5px;width:40%;float:left;margin-left:10px"> <p class="block"> <label for="virtual_product_nb_downloable" class="t"><?php echo $this->l('Number of downloads'); ?> </label> <input type="text" id="virtual_product_nb_downloable" name="virtual_product_nb_downloable" value="<?php echo $productDownload->id > 0 ? $productDownload->nb_downloadable : htmlentities(Tools::getValue('virtual_product_nb_downloable'), ENT_COMPAT, 'UTF-8'); ?> " class="" size="6" /> <span class="hint" name="help_box" style="display:none"><?php echo $this->l('Number of authorized downloads per customer'); ?> </span> </p> <p class="block"> <label for="virtual_product_expiration_date" class="t"><?php echo $this->l('Expiration date'); ?> </label> <input type="text" id="virtual_product_expiration_date" name="virtual_product_expiration_date" value="<?php echo $productDownload->id > 0 ? (!empty($productDownload->date_expiration) and $productDownload->date_expiration != '0000-00-00 00:00:00') ? date('Y-m-d', strtotime($productDownload->date_expiration)) : '' : htmlentities(Tools::getValue('virtual_product_expiration_date'), ENT_COMPAT, 'UTF-8'); ?> " size="11" maxlength="10" autocomplete="off" /> <?php echo $this->l('Format: YYYY-MM-DD'); ?> <span class="hint" name="help_box" style="display:none"><?php echo $this->l('No expiration date if you leave this blank'); ?> </span> </p> <p class="block"> <label for="virtual_product_nb_days" class="t"><?php echo $this->l('Number of days'); ?> </label> <input type="text" id="virtual_product_nb_days" name="virtual_product_nb_days" value="<?php echo $productDownload->id > 0 ? $productDownload->nb_days_accessible : htmlentities(Tools::getValue('virtual_product_nb_days'), ENT_COMPAT, 'UTF-8'); ?> " class="" size="4" /><sup> *</sup> <span class="hint" name="help_box" style="display:none"><?php echo $this->l('How many days this file can be accessed by customers'); ?> - <em>(<?php echo $this->l('set to zero for unlimited access'); ?> )</em></span> </p> </div> <?php } // check if download directory is writable ?> </div> </td> </tr> <tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr> <script type="text/javascript"> if ($('#is_virtual_good').attr('checked')) { $('#virtual_good').show('slow'); $('#virtual_good_more').show('slow'); } </script> <?php echo ' <tr> <td class="col-left">' . $this->l('Pre-tax wholesale price:') . '</td> <td style="padding-bottom:5px;"> ' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<input size="11" maxlength="14" name="wholesale_price" type="text" value="' . htmlentities($this->getFieldValue($obj, 'wholesale_price'), ENT_COMPAT, 'UTF-8') . '" onchange="this.value = this.value.replace(/,/g, \'.\');" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . ' <span style="margin-left:10px">' . $this->l('The wholesale price at which you bought this product') . '</span> </td> </tr>'; echo ' <tr> <td class="col-left">' . $this->l('Pre-tax retail price:') . '</td> <td style="padding-bottom:5px;"> ' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<input size="11" maxlength="14" id="priceTE" name="price" type="text" value="' . htmlentities($this->getFieldValue($obj, 'price'), ENT_COMPAT, 'UTF-8') . '" onchange="this.value = this.value.replace(/,/g, \'.\');" onkeyup="if (isArrowKey(event)) return; calcPriceTI();" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . '<sup> *</sup> <span style="margin-left:2px">' . $this->l('The pre-tax retail price to sell this product') . '</span> </td> </tr>'; $tax_rules_groups = TaxRulesGroup::getTaxRulesGroups(true); $taxesRatesByGroup = TaxRulesGroup::getAssociatedTaxRatesByIdCountry(Country::getDefaultCountryId()); $ecotaxTaxRate = Tax::getProductEcotaxRate(); echo '<script type="text/javascript">'; echo 'noTax = ' . (Tax::excludeTaxeOption() ? 'true' : 'false'), ";\n"; echo 'taxesArray = new Array ();' . "\n"; echo 'taxesArray[0] = 0', ";\n"; foreach ($tax_rules_groups as $tax_rules_group) { $tax_rate = array_key_exists($tax_rules_group['id_tax_rules_group'], $taxesRatesByGroup) ? $taxesRatesByGroup[$tax_rules_group['id_tax_rules_group']] : 0; echo 'taxesArray[' . $tax_rules_group['id_tax_rules_group'] . ']=' . $tax_rate . "\n"; } echo ' ecotaxTaxRate = ' . $ecotaxTaxRate / 100 . '; </script>'; echo ' <tr> <td class="col-left">' . $this->l('Tax rule:') . '</td> <td style="padding-bottom:5px;"> <span ' . (Tax::excludeTaxeOption() ? 'style="display:none;"' : '') . '> <select onChange="javascript:calcPriceTI(); unitPriceWithTax(\'unit\');" name="id_tax_rules_group" id="id_tax_rules_group" ' . (Tax::excludeTaxeOption() ? 'disabled="disabled"' : '') . '> <option value="0">' . $this->l('No Tax') . '</option>'; foreach ($tax_rules_groups as $tax_rules_group) { echo '<option value="' . $tax_rules_group['id_tax_rules_group'] . '" ' . ($this->getFieldValue($obj, 'id_tax_rules_group') == $tax_rules_group['id_tax_rules_group'] ? ' selected="selected"' : '') . '>' . Tools::htmlentitiesUTF8($tax_rules_group['name']) . '</option>'; } echo '</select> <a href="?tab=AdminTaxRulesGroup&addtax_rules_group&token=' . Tools::getAdminToken('AdminTaxRulesGroup' . (int) Tab::getIdFromClassName('AdminTaxRulesGroup') . (int) $cookie->id_employee) . '&id_product=' . (int) $obj->id . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="' . $this->l('Create') . '" title="' . $this->l('Create') . '" /> <b>' . $this->l('Create') . '</b></a></span> '; if (Tax::excludeTaxeOption()) { echo '<span style="margin-left:10px; color:red;">' . $this->l('Taxes are currently disabled') . '</span> (<b><a href="index.php?tab=AdminTaxes&token=' . Tools::getAdminToken('AdminTaxes' . (int) Tab::getIdFromClassName('AdminTaxes') . (int) $cookie->id_employee) . '">' . $this->l('Tax options') . '</a></b>)'; echo '<input type="hidden" value="' . (int) $this->getFieldValue($obj, 'id_tax_rules_group') . '" name="id_tax_rules_group" />'; } echo '</td> </tr> '; if (Configuration::get('PS_USE_ECOTAX')) { echo ' <tr> <td class="col-left">' . $this->l('Eco-tax (tax incl.):') . '</td> <td style="padding-bottom:5px;"> ' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<input size="11" maxlength="14" id="ecotax" name="ecotax" type="text" value="' . $this->getFieldValue($obj, 'ecotax') . '" onkeyup="if (isArrowKey(event))return; calcPriceTE(); this.value = this.value.replace(/,/g, \'.\'); if (parseInt(this.value) > getE(\'priceTE\').value) this.value = getE(\'priceTE\').value; if (isNaN(this.value)) this.value = 0;" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . ' <span style="margin-left:10px">(' . $this->l('already included in price') . ')</span> </td> </tr>'; } if ($default_country->display_tax_label) { echo ' <tr ' . (Tax::excludeTaxeOption() ? 'style="display:none"' : '') . '> <td class="col-left">' . $this->l('Retail price with tax:') . '</td> <td style="padding-bottom:5px;"> ' . ($currency->format % 2 != 0 ? ' ' . $currency->sign : '') . ' <input size="11" maxlength="14" id="priceTI" type="text" value="" onchange="noComma(\'priceTI\');" onkeyup="if (isArrowKey(event)) return; calcPriceTE();" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . ' </td> </tr>'; } else { echo '<input size="11" maxlength="14" id="priceTI" type="hidden" value="" onchange="noComma(\'priceTI\');" onkeyup="if (isArrowKey(event)) return; calcPriceTE();" />'; } echo ' <tr id="tr_unit_price"> <td class="col-left">' . $this->l('Unit price without tax:') . '</td> <td style="padding-bottom:5px;"> ' . ($currency->format % 2 != 0 ? ' ' . $currency->sign : '') . ' <input size="11" maxlength="14" id="unit_price" name="unit_price" type="text" value="' . ($this->getFieldValue($obj, 'unit_price_ratio') != 0 ? Tools::ps_round($this->getFieldValue($obj, 'price') / $this->getFieldValue($obj, 'unit_price_ratio'), 2) : 0) . '" onkeyup="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\'); unitPriceWithTax(\'unit\');"/>' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . ' ' . $this->l('per') . ' <input size="6" maxlength="10" id="unity" name="unity" type="text" value="' . (Validate::isCleanHtml($this->getFieldValue($obj, 'unity')) ? htmlentities($this->getFieldValue($obj, 'unity'), ENT_QUOTES, 'UTF-8') : '') . '" onkeyup="if (isArrowKey(event)) return ;unitySecond();" onchange="unitySecond();"/>' . (Configuration::get('PS_TAX') && $default_country->display_tax_label ? '<span style="margin-left:15px">' . $this->l('or') . ' ' . ($currency->format % 2 != 0 ? ' ' . $currency->sign : '') . '<span id="unit_price_with_tax">0.00</span>' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . ' ' . $this->l('per') . ' <span id="unity_second">' . (Validate::isCleanHtml($this->getFieldValue($obj, 'unity')) ? htmlentities($this->getFieldValue($obj, 'unity'), ENT_QUOTES, 'UTF-8') : '') . '</span> ' . $this->l('with tax') : '') . '</span> <p>' . $this->l('Eg. $15 per Lb') . '</p> </td> </tr> <tr> <td class="col-left"> </td> <td style="padding-bottom:5px;"> <input type="checkbox" name="on_sale" id="on_sale" style="padding-top: 5px;" ' . ($this->getFieldValue($obj, 'on_sale') ? 'checked="checked"' : '') . 'value="1" /> <label for="on_sale" class="t">' . $this->l('Display "on sale" icon on product page and text on product listing') . '</label> </td> </tr> <tr> <td class="col-left"><b>' . $this->l('Final retail price:') . '</b></td> <td style="padding-bottom:5px;"> <span style="' . ($default_country->display_tax_label ? '' : 'display:none') . '"> ' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<span id="finalPrice" style="font-weight: bold;"></span>' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . '<span' . (!Configuration::get('PS_TAX') ? ' style="display:none;"' : '') . '> (' . $this->l('tax incl.') . ')</span> </span> <span' . (!Configuration::get('PS_TAX') ? ' style="display:none;"' : '') . '>'; if ($default_country->display_tax_label) { echo ' / '; } echo ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<span id="finalPriceWithoutTax" style="font-weight: bold;"></span>' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . ' ' . ($default_country->display_tax_label ? '(' . $this->l('tax excl.') . ')' : '') . '</span> </td> </tr> <tr> <td class="col-left"> </td> <td> <div class="hint clear" style="display: block;width: 70%;">' . $this->l('You can define many discounts and specific price rules in the Prices tab') . '</div> </td> </tr> <tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>'; if ((int) Configuration::get('PS_STOCK_MANAGEMENT')) { if (!$has_attribute) { if ($obj->id) { echo ' <tr><td class="col-left">' . $this->l('Stock Movement:') . '</td> <td style="padding-bottom:5px;"> <select id="id_mvt_reason" name="id_mvt_reason"> <option value="-1">--</option>'; $reasons = StockMvtReason::getStockMvtReasons((int) $cookie->id_lang); foreach ($reasons as $reason) { echo '<option rel="' . $reason['sign'] . '" value="' . $reason['id_stock_mvt_reason'] . '" ' . (Configuration::get('PS_STOCK_MVT_REASON_DEFAULT') == $reason['id_stock_mvt_reason'] ? 'selected="selected"' : '') . '>' . $reason['name'] . '</option>'; } echo '</select> <input id="mvt_quantity" type="text" name="mvt_quantity" size="3" maxlength="10" value="0"/> <span style="display:none;" id="mvt_sign"></span> </td> </tr> <tr> <td class="col-left"> </td> <td> <div class="hint clear" style="display: block;width: 70%;">' . $this->l('Choose the reason and enter the quantity that you want to increase or decrease in your stock') . '</div> </td> </tr>'; } else { echo '<tr><td class="col-left">' . $this->l('Initial stock:') . '</td> <td style="padding-bottom:5px;"> <input size="3" maxlength="10" name="quantity" type="text" value="0" /> </td>'; } echo '<tr> <td class="col-left">' . $this->l('Minimum quantity:') . '</td> <td style="padding-bottom:5px;"> <input size="3" maxlength="10" name="minimal_quantity" id="minimal_quantity" type="text" value="' . ($this->getFieldValue($obj, 'minimal_quantity') ? $this->getFieldValue($obj, 'minimal_quantity') : 1) . '" /> <p>' . $this->l('The minimum quantity to buy this product (set to 1 to disable this feature)') . '</p> </td> </tr>'; } if ($obj->id) { echo ' <tr><td class="col-left">' . $this->l('Quantity in stock:') . '</td> <td style="padding-bottom:5px;"><b>' . $qty . '</b><input type="hidden" name="quantity" value="' . $qty . '" /></td> </tr> '; } if ($has_attribute) { echo '<tr> <td class="col-left"> </td> <td> <div class="hint clear" style="display: block;width: 70%;">' . $this->l('You used combinations, for this reason you cannot edit your stock quantity here, but in the Combinations tab') . '</div> </td> </tr>'; } } else { echo '<tr> <td colspan="2">' . $this->l('The stock management is disabled') . '</td> </tr>'; echo ' <tr> <td class="col-left">' . $this->l('Minimum quantity:') . '</td> <td style="padding-bottom:5px;"> <input size="3" maxlength="10" name="minimal_quantity" id="minimal_quantity" type="text" value="' . ($this->getFieldValue($obj, 'minimal_quantity') ? $this->getFieldValue($obj, 'minimal_quantity') : 1) . '" /> <p>' . $this->l('The minimum quantity to buy this product (set to 1 to disable this feature)') . '</p> </td> </tr> '; } echo ' <tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr> <tr> <td class="col-left">' . $this->l('Additional shipping cost:') . '</td> <td style="padding-bottom:5px;"> <input type="text" name="additional_shipping_cost" value="' . Tools::safeOutput($this->getFieldValue($obj, 'additional_shipping_cost')) . '" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : ''); if ($default_country->display_tax_label) { echo ' (' . $this->l('tax excl.') . ')'; } echo '<p>' . $this->l('Carrier tax will be applied.') . '</p> </td> </tr> <tr> <td class="col-left">' . $this->l('Displayed text when in-stock:') . '</td> <td style="padding-bottom:5px;" class="translatable">'; foreach ($this->_languages as $language) { echo ' <div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;"> <input size="30" type="text" id="available_now_' . $language['id_lang'] . '" name="available_now_' . $language['id_lang'] . '" value="' . stripslashes(htmlentities($this->getFieldValue($obj, 'available_now', $language['id_lang']), ENT_COMPAT, 'UTF-8')) . '" /> <span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span> </div>'; } echo ' </td> </tr> <tr> <td class="col-left">' . $this->l('Displayed text when allowed to be back-ordered:') . '</td> <td style="padding-bottom:5px;" class="translatable">'; foreach ($this->_languages as $language) { echo ' <div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;"> <input size="30" type="text" id="available_later_' . $language['id_lang'] . '" name="available_later_' . $language['id_lang'] . '" value="' . stripslashes(htmlentities($this->getFieldValue($obj, 'available_later', $language['id_lang']), ENT_COMPAT, 'UTF-8')) . '" /> <span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span> </div>'; } echo ' </td> </tr> <script type="text/javascript"> calcPriceTI(); </script> <tr> <td class="col-left">' . $this->l('When out of stock:') . '</td> <td style="padding-bottom:5px;"> <input type="radio" name="out_of_stock" id="out_of_stock_1" value="0" ' . ((int) $this->getFieldValue($obj, 'out_of_stock') == 0 ? 'checked="checked"' : '') . '/> <label for="out_of_stock_1" class="t" id="label_out_of_stock_1">' . $this->l('Deny orders') . '</label> <br /><input type="radio" name="out_of_stock" id="out_of_stock_2" value="1" ' . ($this->getFieldValue($obj, 'out_of_stock') == 1 ? 'checked="checked"' : '') . '/> <label for="out_of_stock_2" class="t" id="label_out_of_stock_2">' . $this->l('Allow orders') . '</label> <br /><input type="radio" name="out_of_stock" id="out_of_stock_3" value="2" ' . ($this->getFieldValue($obj, 'out_of_stock') == 2 ? 'checked="checked"' : '') . '/> <label for="out_of_stock_3" class="t" id="label_out_of_stock_3">' . $this->l('Default:') . ' <i>' . $this->l((int) Configuration::get('PS_ORDER_OUT_OF_STOCK') ? 'Allow orders' : 'Deny orders') . '</i> (' . $this->l('as set in') . ' <a href="index.php?tab=AdminPPreferences&token=' . Tools::getAdminToken('AdminPPreferences' . (int) Tab::getIdFromClassName('AdminPPreferences') . (int) $cookie->id_employee) . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false) . '\');">' . $this->l('Preferences') . '</a>)</label> </td> </tr> <tr> <td colspan="2" style="padding-bottom:5px;"> <hr style="width:100%;" /> </td> </tr> <tr> <td class="col-left"><label for="id_category_default" class="t">' . $this->l('Default category:') . '</label></td> <td> <div id="no_default_category" style="color: red;font-weight: bold;display: none;">' . $this->l('Please check a category in order to select the default category.') . '</div> <script type="text/javascript"> var post_selected_cat; </script>'; $default_category = Tools::getValue('id_category', 1); if (!$obj->id) { $selectedCat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->_defaultFormLanguage); echo ' <script type="text/javascript"> post_selected_cat = \'' . implode(',', array_keys($selectedCat)) . '\'; </script>'; } else { if (Tools::isSubmit('categoryBox')) { $selectedCat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->_defaultFormLanguage); } else { $selectedCat = Product::getProductCategoriesFull($obj->id, $this->_defaultFormLanguage); } } echo '<select id="id_category_default" name="id_category_default">'; foreach ($selectedCat as $cat) { echo '<option value="' . $cat['id_category'] . '" ' . ($obj->id_category_default == $cat['id_category'] ? 'selected' : '') . '>' . $cat['name'] . '</option>'; } echo '</select> </td> </tr> <tr id="tr_categories"> <td colspan="2"> '; // Translations are not automatic for the moment ;) $trads = array('Home' => $this->l('Home'), 'selected' => $this->l('selected'), 'Collapse All' => $this->l('Collapse All'), 'Expand All' => $this->l('Expand All'), 'Check All' => $this->l('Check All'), 'Uncheck All' => $this->l('Uncheck All')); echo Helper::renderAdminCategorieTree($trads, $selectedCat) . ' </td> </tr> <tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr> <tr><td colspan="2"> <span onclick="$(\'#seo\').slideToggle();" style="cursor: pointer"><img src="../img/admin/arrow.gif" alt="' . $this->l('SEO') . '" title="' . $this->l('SEO') . '" style="float:left; margin-right:5px;"/>' . $this->l('Click here to improve product\'s rank in search engines (SEO)') . '</span><br /> <div id="seo" style="display: none; padding-top: 15px;"> <table> <tr> <td class="col-left">' . $this->l('Meta title:') . '</td> <td class="translatable">'; foreach ($this->_languages as $language) { echo ' <div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;"> <input size="55" type="text" id="meta_title_' . $language['id_lang'] . '" name="meta_title_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'meta_title', $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" /> <span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span> </div>'; } echo ' <p class="clear">' . $this->l('Product page title; leave blank to use product name') . '</p> </td> </tr> <tr> <td class="col-left">' . $this->l('Meta description:') . '</td> <td class="translatable">'; foreach ($this->_languages as $language) { echo ' <div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;"> <input size="55" type="text" id="meta_description_' . $language['id_lang'] . '" name="meta_description_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'meta_description', $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" /> <span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span> </div>'; } echo ' <p class="clear">' . $this->l('A single sentence for HTML header') . '</p> </td> </tr> <tr> <td class="col-left">' . $this->l('Meta keywords:') . '</td> <td class="translatable">'; foreach ($this->_languages as $language) { echo ' <div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;"> <input size="55" type="text" id="meta_keywords_' . $language['id_lang'] . '" name="meta_keywords_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'meta_keywords', $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" /> <span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span> </div>'; } echo ' <p class="clear">' . $this->l('Keywords for HTML header, separated by a comma') . '</p> </td> </tr> <tr> <td class="col-left">' . $this->l('Friendly URL:') . '</td> <td class="translatable">'; foreach ($this->_languages as $language) { echo ' <div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;"> <input size="55" type="text" id="link_rewrite_' . $language['id_lang'] . '" name="link_rewrite_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'link_rewrite', $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" onkeyup="if (isArrowKey(event)) return ;updateFriendlyURL();" onchange="updateFriendlyURL();" /><sup> *</sup> <span class="hint" name="help_box">' . $this->l('Only letters and the "less" character are allowed') . '<span class="hint-pointer"> </span></span> </div>'; } echo ' <p class="clear" style="padding:10px 0 0 0">' . '<a style="cursor:pointer" class="button" onmousedown="updateFriendlyURLByName();">' . $this->l('Generate') . '</a> ' . $this->l('Friendly-url from product\'s name.') . '<br /><br />'; echo ' ' . $this->l('Product link will look like this:') . ' ' . (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . '/<b>id_product</b>-<span id="friendly-url"></span>.html</p> </td> </tr>'; echo '</td></tr></table> </div> </td></tr> <tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr> <tr> <td class="col-left">' . $this->l('Short description:') . '<br /><br /><i>(' . $this->l('appears in the product lists and on the top of the product page') . ')</i></td> <td style="padding-bottom:5px;" class="translatable">'; foreach ($this->_languages as $language) { echo ' <div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . ';float: left;"> <textarea class="rte" cols="100" rows="10" id="description_short_' . $language['id_lang'] . '" name="description_short_' . $language['id_lang'] . '">' . htmlentities(stripslashes($this->getFieldValue($obj, 'description_short', $language['id_lang'])), ENT_COMPAT, 'UTF-8') . '</textarea> </div>'; } echo ' </td> </tr> <tr> <td class="col-left">' . $this->l('Description:') . '<br /><br /><i>(' . $this->l('appears in the body of the product page') . ')</i></td> <td style="padding-bottom:5px;" class="translatable">'; foreach ($this->_languages as $language) { echo ' <div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . ';float: left;"> <textarea class="rte" cols="100" rows="20" id="description_' . $language['id_lang'] . '" name="description_' . $language['id_lang'] . '">' . htmlentities(stripslashes($this->getFieldValue($obj, 'description', $language['id_lang'])), ENT_COMPAT, 'UTF-8') . '</textarea> </div>'; } echo ' </td> </tr>'; echo ' <tr> <td class="col-left">' . $this->l('Tags:') . '</td> <td style="padding-bottom:5px;" class="translatable">'; if ($obj->id) { $obj->tags = Tag::getProductTags((int) $obj->id); } foreach ($this->_languages as $language) { echo '<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;"> <input size="55" type="text" id="tags_' . $language['id_lang'] . '" name="tags_' . $language['id_lang'] . '" value="' . htmlentities(Tools::getValue('tags_' . $language['id_lang'], $obj->getTags($language['id_lang'], true)), ENT_COMPAT, 'UTF-8') . '" /> <span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' !<>;?=+#"°{}_$%<span class="hint-pointer"> </span></span> </div>'; } echo ' <p class="clear">' . $this->l('Tags separated by commas (e.g., dvd, dvd player, hifi)') . '</p> </td> </tr>'; $accessories = Product::getAccessoriesLight((int) $cookie->id_lang, $obj->id); if ($postAccessories = Tools::getValue('inputAccessories')) { $postAccessoriesTab = explode('-', Tools::getValue('inputAccessories')); foreach ($postAccessoriesTab as $accessoryId) { if (!$this->haveThisAccessory($accessoryId, $accessories) and $accessory = Product::getAccessoryById($accessoryId)) { $accessories[] = $accessory; } } } echo ' <tr> <td class="col-left">' . $this->l('Accessories:') . '<br /><br /><i>' . $this->l('(Do not forget to Save the product afterward)') . '</i></td> <td style="padding-bottom:5px;"> <div id="divAccessories">'; foreach ($accessories as $accessory) { echo htmlentities($accessory['name'], ENT_COMPAT, 'UTF-8') . (!empty($accessory['reference']) ? ' (' . $accessory['reference'] . ')' : '') . ' <span onclick="delAccessory(' . $accessory['id_product'] . ');" style="cursor: pointer;"><img src="../img/admin/delete.gif" class="middle" alt="" /></span><br />'; } echo '</div> <input type="hidden" name="inputAccessories" id="inputAccessories" value="'; foreach ($accessories as $accessory) { echo (int) $accessory['id_product'] . '-'; } echo '" /> <input type="hidden" name="nameAccessories" id="nameAccessories" value="'; foreach ($accessories as $accessory) { echo htmlentities($accessory['name'], ENT_COMPAT, 'UTF-8') . '¤'; } echo '" /> <script type="text/javascript"> var formProduct; var accessories = new Array(); </script> <link rel="stylesheet" type="text/css" href="' . __PS_BASE_URI__ . 'css/jquery.autocomplete.css" /> <script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/jquery/jquery.autocomplete.js"></script> <div id="ajax_choose_product" style="padding:6px; padding-top:2px; width:600px;"> <p class="clear">' . $this->l('Begin typing the first letters of the product name, then select the product from the drop-down list:') . '</p> <input type="text" value="" id="product_autocomplete_input" /> <img onclick="$(this).prev().search();" style="cursor: pointer;" src="../img/admin/add.gif" alt="' . $this->l('Add an accessory') . '" title="' . $this->l('Add an accessory') . '" /> </div> <script type="text/javascript"> urlToCall = null; /* function autocomplete */ $(function() { $(\'#product_autocomplete_input\') .autocomplete(\'ajax_products_list.php\', { minChars: 1, autoFill: true, max:20, matchContains: true, mustMatch:true, scroll:false, cacheLength:0, formatItem: function(item) { return item[1]+\' - \'+item[0]; } }).result(addAccessory); $(\'#product_autocomplete_input\').setOptions({ extraParams: {excludeIds : getAccessorieIds()} }); }); </script> </td> </tr> <tr><td colspan="2" style="padding-bottom:10px;"><hr style="width:100%;" /></td></tr> <tr> <td colspan="2" style="text-align:center;"> <input type="submit" value="' . $this->l('Save') . '" name="submitAdd' . $this->table . '" class="button" /> <input type="submit" value="' . $this->l('Save and stay') . '" name="submitAdd' . $this->table . 'AndStay" class="button" /></td> </tr> </table> <br /> </div>'; // TinyMCE global $cookie; $iso = Language::getIsoById((int) $cookie->id_lang); $isoTinyMCE = file_exists(_PS_ROOT_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en'; $ad = dirname($_SERVER["PHP_SELF"]); echo ' <script type="text/javascript"> var iso = \'' . $isoTinyMCE . '\' ; var pathCSS = \'' . _THEME_CSS_DIR_ . '\' ; var ad = \'' . $ad . '\' ; </script> <script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/tiny_mce/tiny_mce.js"></script> <script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/tinymce.inc.js"></script> <script type="text/javascript"> toggleVirtualProduct(getE(\'is_virtual_good\')); unitPriceWithTax(\'unit\'); </script>'; $categoryBox = Tools::getValue('categoryBox', array()); }
public function initFormPrices($obj) { $data = $this->createTemplate($this->tpl_form); $product = $obj; if ($obj->id) { $shops = Shop::getShops(); $countries = Country::getCountries($this->context->language->id); $groups = Group::getGroups($this->context->language->id); $currencies = Currency::getCurrencies(); $attributes = $obj->getAttributesGroups((int) $this->context->language->id); $combinations = array(); foreach ($attributes as $attribute) { $combinations[$attribute['id_product_attribute']]['id_product_attribute'] = $attribute['id_product_attribute']; if (!isset($combinations[$attribute['id_product_attribute']]['attributes'])) { $combinations[$attribute['id_product_attribute']]['attributes'] = ''; } $combinations[$attribute['id_product_attribute']]['attributes'] .= $attribute['attribute_name'] . ' - '; $combinations[$attribute['id_product_attribute']]['price'] = Tools::displayPrice(Tools::convertPrice(Product::getPriceStatic((int) $obj->id, false, $attribute['id_product_attribute']), $this->context->currency), $this->context->currency); } foreach ($combinations as &$combination) { $combination['attributes'] = rtrim($combination['attributes'], ' - '); } $data->assign('specificPriceModificationForm', $this->_displaySpecificPriceModificationForm($this->context->currency, $shops, $currencies, $countries, $groups)); $data->assign('ecotax_tax_excl', $obj->ecotax); $this->_applyTaxToEcotax($obj); $data->assign(array('shops' => $shops, 'admin_one_shop' => count($this->context->employee->getAssociatedShops()) == 1, 'currencies' => $currencies, 'countries' => $countries, 'groups' => $groups, 'combinations' => $combinations, 'multi_shop' => Shop::isFeatureActive(), 'link' => new Link())); } else { $this->displayWarning($this->l('You must save this product before adding specific pricing')); $product->id_tax_rules_group = (int) Product::getIdTaxRulesGroupMostUsed(); $data->assign('ecotax_tax_excl', 0); } // prices part $data->assign(array('link' => $this->context->link, 'currency' => $currency = $this->context->currency, 'tax_rules_groups' => TaxRulesGroup::getTaxRulesGroups(true), 'taxesRatesByGroup' => TaxRulesGroup::getAssociatedTaxRatesByIdCountry($this->context->country->id), 'ecotaxTaxRate' => Tax::getProductEcotaxRate(), 'tax_exclude_taxe_option' => Tax::excludeTaxeOption(), 'ps_use_ecotax' => Configuration::get('PS_USE_ECOTAX'))); $product->price = Tools::convertPrice($product->price, $this->context->currency, true, $this->context); if ($product->unit_price_ratio != 0) { $data->assign('unit_price', Tools::ps_round($product->price / $product->unit_price_ratio, 2)); } else { $data->assign('unit_price', 0); } $data->assign('ps_tax', Configuration::get('PS_TAX')); $data->assign('country_display_tax_label', $this->context->country->display_tax_label); $data->assign(array('currency', $this->context->currency, 'product' => $product, 'token' => $this->token)); $this->tpl_form_vars['custom_form'] = $data->fetch(); }
/** * @brief Validate Method * * @return update the module depending on klarna webservices */ private function _postValidation() { $klarna = new Klarna(); if ($_POST['klarna_mod'] == 'live') { Configuration::updateValue('KLARNA_MOD', Klarna::LIVE); } else { Configuration::updateValue('KLARNA_MOD', Klarna::BETA); } if (isset($_POST['klarna_active_invoice']) && $_POST['klarna_active_invoice']) { Configuration::updateValue('KLARNA_ACTIVE_INVOICE', true); } else { Configuration::deleteByName('KLARNA_ACTIVE_INVOICE'); } if (isset($_POST['klarna_active_partpayment']) && $_POST['klarna_active_partpayment']) { Configuration::updateValue('KLARNA_ACTIVE_PARTPAYMENT', true); } else { Configuration::deleteByName('KLARNA_ACTIVE_PARTPAYMENT'); } if (isset($_POST['klarna_email']) && $_POST['klarna_email']) { Configuration::updateValue('KLARNA_EMAIL', true); } else { Configuration::deleteByName('KLARNA_EMAIL'); } foreach ($this->countries as $country) { Db::getInstance()->delete(_DB_PREFIX_ . 'klarna_payment_pclasses', 'country = "' . (int) $country['code'] . '"'); Configuration::updateValue('KLARNA_STORE_ID_' . $country['name'], null); Configuration::updateValue('KLARNA_SECRET_' . $country['name'], null); } foreach ($this->countries as $key => $country) { if (isset($_POST['activate' . $country['name']])) { $storeId = (int) Tools::getValue('klarnaStoreId' . $country['name']); $secret = pSQL(Tools::getValue('klarnaSecret' . $country['name'])); if ($storeId > 0 && $secret == '' || $storeId <= 0 && $secret != '') { $this->_postErrors[] = $this->l('your credentials are incorrect and can\'t be used in ') . $country['name']; } elseif ($storeId >= 0 && $secret != '') { $error = false; try { $klarna->config($storeId, Tools::safeOutput($secret), $country['code'], $country['langue'], $country['currency'], Configuration::get('KLARNA_MOD'), 'mysql', $this->_getDb()); $PClasses = $klarna->fetchPClasses($country['code']); } catch (Exception $e) { $error = true; $this->_postErrors[] = (int) $e->getCode() . ': ' . Tools::safeOutput($e->getMessage()); } if (!$error) { Configuration::updateValue('KLARNA_STORE_ID_' . $country['name'], $storeId); Configuration::updateValue('KLARNA_SECRET_' . $country['name'], $secret); Configuration::updateValue('KLARNA_INVOICE_FEE_' . $country['name'], (double) Tools::getValue('klarnaInvoiceFee' . $country['name'])); Configuration::updateValue('KLARNA_MINIMUM_VALUE_' . $country['name'], (double) Tools::getValue('klarnaMinimumValue' . $country['name'])); Configuration::updateValue('KLARNA_MAXIMUM_VALUE_' . $country['name'], $_POST['klarnaMaximumValue' . $country['name']] != 0 ? (double) Tools::getValue('klarnaMaximumValue' . $country['name']) : 99999); $id_product = Db::getInstance()->getValue('SELECT `id_product` FROM `' . _DB_PREFIX_ . 'product_lang` WHERE `name` = \'invoiceFee' . $country['name'] . '\''); $taxeRules = TaxRulesGroup::getAssociatedTaxRatesByIdCountry(Country::getByIso($key)); $maxiPrice = 0; $idTaxe = 0; foreach ($taxeRules as $key => $val) { if ((int) $val > $maxiPrice) { $maxiPrice = (int) $val; $idTaxe = $key; } } if ($id_product != null) { $productInvoicefee = new Product((int) $id_product); $productInvoicefee->price = (double) Tools::getValue('klarnaInvoiceFee' . $country['name']); if (_PS_VERSION_ >= 1.5) { StockAvailable::setProductOutOfStock((int) $productInvoicefee->id, true, null, 0); } if ($idTaxe != 0) { $productInvoicefee->id_tax_rules_group = (int) $idTaxe; } $productInvoicefee->update(); } else { $productInvoicefee = new Product(); $productInvoicefee->out_of_stock = 1; $productInvoicefee->available_for_order = true; $productInvoicefee->id_category_default = 2; if ($idTaxe != 0) { $productInvoicefee->id_tax_rules_group = (int) $idTaxe; } $languages = Language::getLanguages(false); foreach ($languages as $language) { $productInvoicefee->name[$language['id_lang']] = 'invoiceFee' . $country['name']; $productInvoicefee->link_rewrite[$language['id_lang']] = 'invoiceFee' . $country['name']; } $productInvoicefee->price = (double) Tools::getValue('klarnaInvoiceFee' . $country['name']); if (_PS_VERSION_ >= 1.5) { $productInvoicefee->active = false; } $productInvoicefee->add(); if (_PS_VERSION_ >= 1.5) { StockAvailable::setProductOutOfStock((int) $productInvoicefee->id, true, null, 0); } } Configuration::updateValue('KLARNA_INV_FEE_ID_' . $country['name'], $productInvoicefee->id); $this->_postValidations[] = $this->l('Your account has been updated to be used in ') . $country['name']; } $error = false; } } } }