本文整理汇总了PHP中Attribute::getAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Attribute::getAttributes方法的具体用法?PHP Attribute::getAttributes怎么用?PHP Attribute::getAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attribute
的用法示例。
在下文中一共展示了Attribute::getAttributes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderForm
public function renderForm()
{
if (!$this->object->id) {
$this->object->price = -1;
}
$shops = Shop::getShops();
if (count($this->context->employee->getAssociatedShops()) > 1) {
$shops = array_merge(array(0 => array('id_shop' => 0, 'name' => $this->l('All shops'))), $shops);
}
$this->fields_form = array('legend' => array('title' => $this->l('Specific price rules')), 'input' => array(array('type' => 'text', 'label' => $this->l('Name:'), 'name' => 'name', 'size' => 33, 'maxlength' => 32, 'required' => true, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'select', 'label' => $this->l('Shop:'), 'name' => 'id_shop', 'options' => array('query' => $shops, 'id' => 'id_shop', 'name' => 'name'), 'condition' => Shop::isFeatureActive(), 'default_value' => Shop::getContextShopID()), array('type' => 'select', 'label' => $this->l('Currency:'), 'name' => 'id_currency', 'options' => array('query' => array_merge(array(0 => array('id_currency' => 0, 'name' => $this->l('All currencies'))), Currency::getCurrencies()), 'id' => 'id_currency', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Country:'), 'name' => 'id_country', 'options' => array('query' => array_merge(array(0 => array('id_country' => 0, 'name' => $this->l('All countries'))), Country::getCountries((int) $this->context->language->id)), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Group:'), 'name' => 'id_group', 'options' => array('query' => array_merge(array(0 => array('id_group' => 0, 'name' => $this->l('All groups'))), Group::getGroups((int) $this->context->language->id)), 'id' => 'id_group', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('From quantity:'), 'name' => 'from_quantity', 'size' => 6, 'maxlength' => 10, 'required' => true), array('type' => 'text', 'label' => $this->l('Price (tax excl.):'), 'name' => 'price', 'size' => 6, 'disabled' => $this->object->price == -1 ? 1 : 0, 'maxlength' => 10, 'suffix' => $this->context->currency->getSign('right')), array('type' => 'checkbox', 'name' => 'leave_bprice', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Leave base price'), 'val' => '1', 'checked' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'date', 'label' => $this->l('From:'), 'name' => 'from', 'size' => 12), array('type' => 'date', 'label' => $this->l('To:'), 'name' => 'to', 'size' => 12), array('type' => 'select', 'label' => $this->l('Reduction type:'), 'name' => 'reduction_type', 'options' => array('query' => array(array('reduction_type' => 'amount', 'name' => $this->l('Amount')), array('reduction_type' => 'percentage', 'name' => $this->l('Percentage'))), 'id' => 'reduction_type', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('Reduction:'), 'name' => 'reduction', 'required' => true)), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
if (($value = $this->getFieldValue($this->object, 'price')) != -1) {
$price = number_format($value, 2);
} else {
$price = '';
}
$this->fields_value = array('price' => $price, 'from_quantity' => ($value = $this->getFieldValue($this->object, 'from_quantity')) ? $value : 1, 'reduction' => number_format(($value = $this->getFieldValue($this->object, 'reduction')) ? $value : 0, 2), 'leave_bprice_on' => $price ? 0 : 1);
$attribute_groups = array();
$attributes = Attribute::getAttributes((int) $this->context->language->id);
foreach ($attributes as $attribute) {
if (!isset($attribute_groups[$attribute['id_attribute_group']])) {
$attribute_groups[$attribute['id_attribute_group']] = array('id_attribute_group' => $attribute['id_attribute_group'], 'name' => $attribute['attribute_group']);
}
$attribute_groups[$attribute['id_attribute_group']]['attributes'][] = array('id_attribute' => $attribute['id_attribute'], 'name' => $attribute['name']);
}
$features = Feature::getFeatures((int) $this->context->language->id);
foreach ($features as &$feature) {
$feature['values'] = FeatureValue::getFeatureValuesWithLang((int) $this->context->language->id, $feature['id_feature'], true);
}
$this->tpl_form_vars = array('manufacturers' => Manufacturer::getManufacturers(), 'suppliers' => Supplier::getSuppliers(), 'attributes_group' => $attribute_groups, 'features' => $features, 'categories' => Category::getSimpleCategories((int) $this->context->language->id), 'conditions' => $this->object->getConditions(), 'is_multishop' => Shop::isFeatureActive());
return parent::renderForm();
}
示例2: displayAndReturnAttributeJs
private static function displayAndReturnAttributeJs()
{
global $cookie;
$attributes = Attribute::getAttributes(intval($cookie->id_lang), true);
$attributeJs = array();
foreach ($attributes as $k => $attribute) {
$attributeJs[$attribute['id_attribute_group']][$attribute['id_attribute']] = $attribute['name'];
}
echo '
<script type="text/javascript">
var attrs = new Array();
attrs[0] = new Array(0, \'---\');';
foreach ($attributeJs as $idgrp => $group) {
echo '
attrs[' . $idgrp . '] = new Array(0, \'---\' ';
foreach ($group as $idattr => $attrname) {
echo ', ' . $idattr . ', \'' . addslashes($attrname) . '\'';
}
echo ');';
}
echo '
</script>';
return $attributeJs;
}
示例3: initContent
public function initContent()
{
if (!Combination::isFeatureActive()) {
$url = '<a href="index.php?tab=AdminPerformance&token=' . Tools::getAdminTokenLite('AdminPerformance') . '#featuresDetachables">' . $this->trans('Performance', array(), 'Admin.Global') . '</a>';
$this->displayWarning(sprintf($this->trans('This feature has been disabled. You can activate it here: %s.', array('%s' => $url), 'Admin.Catalog.Notification')));
return;
}
// Init toolbar
$this->initPageHeaderToolbar();
$this->initGroupTable();
$attributes = Attribute::getAttributes(Context::getContext()->language->id, true);
$attribute_js = array();
foreach ($attributes as $k => $attribute) {
$attribute_js[$attribute['id_attribute_group']][$attribute['id_attribute']] = $attribute['name'];
}
$attribute_groups = AttributeGroup::getAttributesGroups($this->context->language->id);
$this->product = new Product((int) Tools::getValue('id_product'));
$this->context->smarty->assign(array('tax_rates' => $this->product->getTaxesRate(), 'generate' => isset($_POST['generate']) && !count($this->errors), 'combinations_size' => count($this->combinations), 'product_name' => $this->product->name[$this->context->language->id], 'product_reference' => $this->product->reference, 'url_generator' => self::$currentIndex . '&id_product=' . (int) Tools::getValue('id_product') . '&attributegenerator&token=' . Tools::getValue('token'), 'attribute_groups' => $attribute_groups, 'attribute_js' => $attribute_js, 'toolbar_btn' => $this->toolbar_btn, 'toolbar_scroll' => true, 'show_page_header_toolbar' => $this->show_page_header_toolbar, 'page_header_toolbar_title' => $this->page_header_toolbar_title, 'page_header_toolbar_btn' => $this->page_header_toolbar_btn));
}
示例4: attributeImport
public function attributeImport($offset = false, $limit = false, &$crossStepsVariables = false, $validateOnly = false)
{
$default_language = Configuration::get('PS_LANG_DEFAULT');
$groups = array();
if ($crossStepsVariables !== false && array_key_exists('groups', $crossStepsVariables)) {
$groups = $crossStepsVariables['groups'];
}
foreach (AttributeGroup::getAttributesGroups($default_language) as $group) {
$groups[$group['name']] = (int) $group['id_attribute_group'];
}
$attributes = array();
if ($crossStepsVariables !== false && array_key_exists('attributes', $crossStepsVariables)) {
$attributes = $crossStepsVariables['attributes'];
}
foreach (Attribute::getAttributes($default_language) as $attribute) {
$attributes[$attribute['attribute_group'] . '_' . $attribute['name']] = (int) $attribute['id_attribute'];
}
$this->receiveTab();
$handle = $this->openCsvFile($offset);
if (!$handle) {
return false;
}
AdminImportController::setLocale();
$regenerate = Tools::getValue('regenerate');
$shop_is_feature_active = Shop::isFeatureActive();
$line_count = 0;
for ($current_line = 0; ($line = fgetcsv($handle, MAX_LINE_SIZE, $this->separator)) && (!$limit || $current_line < $limit); $current_line++) {
$line_count++;
if ($this->convert) {
$line = $this->utf8EncodeArray($line);
}
if (count($line) == 1 && $line[0] == null) {
$this->warnings[] = $this->l('There is an empty row in the file that won\'t be imported.');
continue;
}
$info = AdminImportController::getMaskedRow($line);
$info = array_map('trim', $info);
$this->attributeImportOne($info, $default_language, $groups, $attributes, $regenerate, $shop_is_feature_active, $validateOnly);
}
$this->closeCsvFile($handle);
if ($crossStepsVariables !== false) {
$crossStepsVariables['groups'] = $groups;
$crossStepsVariables['attributes'] = $attributes;
}
return $line_count;
}
示例5: displayAndReturnAttributeJs
protected static function displayAndReturnAttributeJs()
{
$attributes = Attribute::getAttributes(Context::getContext()->language->id, true);
$attribute_js = array();
foreach ($attributes as $k => $attribute) {
$attribute_js[$attribute['id_attribute_group']][$attribute['id_attribute']] = $attribute['name'];
}
echo '
<script type="text/javascript">
var attrs = new Array();
attrs[0] = new Array(0, \'---\');';
foreach ($attribute_js as $idgrp => $group) {
echo '
attrs[' . $idgrp . '] = new Array(0, \'---\' ';
foreach ($group as $idattr => $attrname) {
echo ', ' . $idattr . ', \'' . addslashes($attrname) . '\'';
}
echo ');';
}
echo '
</script>';
return $attribute_js;
}
示例6: displayFormAttributes
function displayFormAttributes($obj, $languages, $defaultLanguage)
{
global $currentIndex, $cookie;
$attributeJs = array();
$attributes = Attribute::getAttributes((int) $cookie->id_lang, true);
foreach ($attributes as $k => $attribute) {
$attributeJs[$attribute['id_attribute_group']][$attribute['id_attribute']] = $attribute['name'];
}
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$attributes_groups = AttributeGroup::getAttributesGroups((int) $cookie->id_lang);
$default_country = new Country((int) Configuration::get('PS_COUNTRY_DEFAULT'));
$images = Image::getImages((int) $cookie->id_lang, $obj->id);
if ($obj->id) {
echo '
<script type="text/javascript">
$(document).ready(function(){
$(\'#id_mvt_reason\').change(function(){
updateMvtStatus($(this).val());
});
updateMvtStatus($(this).val());
});
</script>
<table cellpadding="5">
<tr>
<td colspan="2"><b>' . $this->l('Add or modify combinations for this product') . '</b> -
<a href="index.php?tab=AdminCatalog&id_product=' . $obj->id . '&id_category=' . (int) Tools::getValue('id_category') . '&attributegenerator&token=' . Tools::getAdminToken('AdminCatalog' . (int) Tab::getIdFromClassName('AdminCatalog') . (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/appearance.gif" alt="combinations_generator" class="middle" title="' . $this->l('Product combinations generator') . '" /> ' . $this->l('Product combinations generator') . '</a>
</td>
</tr>
</table>
<hr style="width:100%;" /><br />
<table cellpadding="5" style="width:100%">
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" valign="top">' . $this->l('Group:') . '</td>
<td style="padding-bottom:5px;"><select name="attribute_group" id="attribute_group" style="width: 200px;" onchange="populate_attrs();">';
if (isset($attributes_groups)) {
foreach ($attributes_groups as $k => $attribute_group) {
if (isset($attributeJs[$attribute_group['id_attribute_group']])) {
echo '
<option value="' . $attribute_group['id_attribute_group'] . '">
' . htmlentities(stripslashes($attribute_group['name']), ENT_COMPAT, 'UTF-8') . ' </option>';
}
}
}
echo '
</select></td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" valign="top">' . $this->l('Attribute:') . '</td>
<td style="padding-bottom:5px;"><select name="attribute" id="attribute" style="width: 200px;">
<option value="0">---</option>
</select>
<script type="text/javascript" language="javascript">populate_attrs();</script>
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" valign="top">
<input style="width: 140px; margin-bottom: 10px;" type="button" value="' . $this->l('Add') . '" class="button" onclick="add_attr();"/><br />
<input style="width: 140px;" type="button" value="' . $this->l('Delete') . '" class="button" onclick="del_attr()"/></td>
<td align="left">
<select id="product_att_list" name="attribute_combinaison_list[]" multiple="multiple" size="4" style="width: 320px;"></select>
</td>
</tr>
<tr><td colspan="2"><hr style="width:100%;" /></td></tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Reference:') . '</td>
<td style="padding-bottom:5px;">
<input size="55" type="text" id="attribute_reference" name="attribute_reference" value="" style="width: 130px; margin-right: 44px;" />
' . $this->l('EAN13:') . '<input size="55" maxlength="13" type="text" id="attribute_ean13" name="attribute_ean13" value="" style="width: 110px; margin-left: 10px; margin-right: 44px;" />
' . $this->l('UPC:') . '<input size="55" maxlength="12" type="text" id="attribute_upc" name="attribute_upc" value="" style="width: 110px; margin-left: 10px;" />
<span class="hint" name="help_box">' . $this->l('Special characters allowed:') . ' .-_#<span class="hint-pointer"> </span></span>
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Supplier Reference:') . '</td>
<td style="padding-bottom:5px;">
<input size="55" type="text" id="attribute_supplier_reference" name="attribute_supplier_reference" value="" style="width: 130px; margin-right: 44px;" />
' . $this->l('Location:') . '<input size="55" type="text" id="attribute_location" name="attribute_location" value="" style="width: 101px; margin-left: 10px;" />
<span class="hint" name="help_box">' . $this->l('Special characters allowed:') . ' .-_#<span class="hint-pointer"> </span></span>
</td>
</tr>
<tr><td colspan="2"><hr style="width:100%;" /></td></tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Wholesale price:') . '</td>
<td style="padding-bottom:5px;">' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<input type="text" size="6" name="attribute_wholesale_price" id="attribute_wholesale_price" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\');" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . ' (' . $this->l('overrides Wholesale price on Information tab') . ')</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Impact on price:') . '</td>
<td colspan="2" style="padding-bottom:5px;">
<select name="attribute_price_impact" id="attribute_price_impact" style="width: 140px;" onchange="check_impact(); calcImpactPriceTI();">
<option value="0">' . $this->l('None') . '</option>
<option value="1">' . $this->l('Increase') . '</option>
<option value="-1">' . $this->l('Reduction') . '</option>
</select>
<span id="span_impact"> ' . $this->l('of') . ' ' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '
<input type="text" size="6" name="attribute_price" id="attribute_price" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\'); calcImpactPriceTI();"/>' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '');
if ($default_country->display_tax_label) {
echo ' ' . $this->l('(tax excl.)') . '<span ' . (Tax::excludeTaxeOption() ? 'style="display:none"' : '') . '> ' . $this->l('or') . ' ' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '
<input type="text" size="6" name="attribute_priceTI" id="attribute_priceTI" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\'); calcImpactPriceTE();"/>' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . ' ' . $this->l('(tax incl.)') . '</span> ' . $this->l('final product price will be set to') . ' ' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<span id="attribute_new_total_price">0.00</span>' . ($currency->format % 2 == 0 ? $currency->sign . ' ' : '');
}
echo '
//.........这里部分代码省略.........
示例7: getAttributes
function getAttributes($name)
{
return Attribute::getAttributes($name);
}
示例8: generateAttributeData
protected function generateAttributeData()
{
$delimiter = ';';
$line = array();
$titles = array();
$new_path = new Sampledatainstall();
$id_lang = $this->use_lang;
$f = fopen($new_path->sendPath() . 'output/attributes.vsc', 'w');
foreach ($this->attributes_fields as $field => $array) {
$titles[] = $array['label'];
}
fputcsv($f, $titles, $delimiter, '"');
$attributes = Attribute::getAttributes($id_lang);
if ($attributes) {
foreach ($attributes as $attribute) {
$a = new Attribute($attribute['id_attribute'], $id_lang);
foreach ($this->attributes_fields as $field => $array) {
$line[$field] = property_exists('Attribute', $field) && !is_array($a->{$field}) && !Tools::isEmpty($a->{$field}) ? $a->{$field} : '';
}
if (!$line[$field]) {
$line[$field] = '';
}
fputcsv($f, $line, $delimiter, '"');
}
}
fclose($f);
}
示例9: attributeImport
public function attributeImport()
{
$defaultLanguage = Configuration::get('PS_LANG_DEFAULT');
$groups = array();
foreach (AttributeGroup::getAttributesGroups($defaultLanguage) as $group) {
$groups[$group['name']] = (int) $group['id_attribute_group'];
}
$attributes = array();
foreach (Attribute::getAttributes($defaultLanguage) as $attribute) {
$attributes[$attribute['attribute_group'] . '_' . $attribute['name']] = (int) $attribute['id_attribute'];
}
$this->receiveTab();
$handle = $this->openCsvFile();
$fsep = (is_null(Tools::getValue('multiple_value_separator')) or trim(Tools::getValue('multiple_value_separator')) == '') ? ',' : Tools::getValue('multiple_value_separator');
self::setLocale();
for ($current_line = 0; $line = fgetcsv($handle, MAX_LINE_SIZE, Tools::getValue('separator')); $current_line++) {
if (Tools::getValue('convert')) {
$this->utf8_encode_array($line);
}
$info = self::getMaskedRow($line);
$info = array_map('trim', $info);
self::setDefaultValues($info);
$product = new Product((int) $info['id_product'], false, $defaultLanguage);
$id_product_attribute = $product->addProductAttribute((double) $info['price'], (double) $info['weight'], 0, (double) $info['ecotax'], (int) $info['quantity'], null, strval($info['reference']), strval($info['supplier_reference']), strval($info['ean13']), (int) $info['default_on'], strval($info['upc']));
foreach (explode($fsep, $info['options']) as $option) {
list($group, $attribute) = array_map('trim', explode(':', $option));
if (!isset($groups[$group])) {
$obj = new AttributeGroup();
$obj->is_color_group = false;
$obj->name[$defaultLanguage] = $group;
$obj->public_name[$defaultLanguage] = $group;
if (($fieldError = $obj->validateFields(UNFRIENDLY_ERROR, true)) === true and ($langFieldError = $obj->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true) {
$obj->add();
$groups[$group] = $obj->id;
} else {
$this->_errors[] = ($fieldError !== true ? $fieldError : '') . ($langFieldError !== true ? $langFieldError : '');
}
}
if (!isset($attributes[$group . '_' . $attribute])) {
$obj = new Attribute();
$obj->id_attribute_group = $groups[$group];
$obj->name[$defaultLanguage] = $attribute;
if (($fieldError = $obj->validateFields(UNFRIENDLY_ERROR, true)) === true and ($langFieldError = $obj->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true) {
$obj->add();
$attributes[$group . '_' . $attribute] = $obj->id;
} else {
$this->_errors[] = ($fieldError !== true ? $fieldError : '') . ($langFieldError !== true ? $langFieldError : '');
}
}
Db::getInstance()->Execute('INSERT INTO ' . _DB_PREFIX_ . 'product_attribute_combination (id_attribute, id_product_attribute) VALUES (' . (int) $attributes[$group . '_' . $attribute] . ',' . (int) $id_product_attribute . ')');
}
}
$this->closeCsvFile($handle);
}
示例10: attributeImport
public function attributeImport()
{
$default_language = Configuration::get('PS_LANG_DEFAULT');
$groups = array();
foreach (AttributeGroup::getAttributesGroups($default_language) as $group) {
$groups[$group['name']] = (int) $group['id_attribute_group'];
}
$attributes = array();
foreach (Attribute::getAttributes($default_language) as $attribute) {
$attributes[$attribute['attribute_group'] . '_' . $attribute['name']] = (int) $attribute['id_attribute'];
}
$this->receiveTab();
$handle = $this->openCsvFile();
AdminImportController::setLocale();
for ($current_line = 0; $line = fgetcsv($handle, MAX_LINE_SIZE, $this->separator); $current_line++) {
if (count($line) == 1 && empty($line[0])) {
continue;
}
if (Tools::getValue('convert')) {
$line = $this->utf8EncodeArray($line);
}
$info = AdminImportController::getMaskedRow($line);
$info = array_map('trim', $info);
AdminImportController::setDefaultValues($info);
if (!Shop::isFeatureActive()) {
$info['shop'] = 1;
} elseif (!isset($info['shop']) || empty($info['shop'])) {
$info['shop'] = implode($this->multiple_value_separator, Shop::getContextListShopID());
}
// Get shops for each attributes
$info['shop'] = explode($this->multiple_value_separator, $info['shop']);
$id_shop_list = array();
if (is_array($info['shop']) && count($info['shop'])) {
foreach ($info['shop'] as $shop) {
if (!empty($shop) && !is_numeric($shop)) {
$id_shop_list[] = Shop::getIdByName($shop);
} elseif (!empty($shop)) {
$id_shop_list[] = $shop;
}
}
}
if (isset($info['id_product']) && $info['id_product']) {
$product = new Product((int) $info['id_product'], false, $default_language);
} elseif (Tools::getValue('match_ref') && isset($info['product_reference']) && $info['product_reference']) {
$datas = Db::getInstance()->getRow('
SELECT p.`id_product`
FROM `' . _DB_PREFIX_ . 'product` p
' . Shop::addSqlAssociation('product', 'p') . '
WHERE p.`reference` = "' . pSQL($info['product_reference']) . '"
');
if (isset($datas['id_product']) && $datas['id_product']) {
$product = new Product((int) $datas['id_product'], false, $default_language);
}
} else {
continue;
}
$id_image = array();
//delete existing images if "delete_existing_images" is set to 1
if (array_key_exists('delete_existing_images', $info) && $info['delete_existing_images'] && !isset($this->cache_image_deleted[(int) $product->id])) {
$product->deleteImages();
$this->cache_image_deleted[(int) $product->id] = true;
}
if (isset($info['image_url']) && $info['image_url']) {
$info['image_url'] = explode(',', $info['image_url']);
if (is_array($info['image_url']) && count($info['image_url'])) {
foreach ($info['image_url'] as $url) {
$url = trim($url);
$product_has_images = (bool) Image::getImages($this->context->language->id, $product->id);
$image = new Image();
$image->id_product = (int) $product->id;
$image->position = Image::getHighestPosition($product->id) + 1;
$image->cover = !$product_has_images ? true : false;
$field_error = $image->validateFields(UNFRIENDLY_ERROR, true);
$lang_field_error = $image->validateFieldsLang(UNFRIENDLY_ERROR, true);
if ($field_error === true && $lang_field_error === true && $image->add()) {
$image->associateTo($id_shop_list);
if (!AdminImportController::copyImg($product->id, $image->id, $url, 'products', !Tools::getValue('regenerate'))) {
$this->warnings[] = sprintf(Tools::displayError('Error copying image: %s'), $url);
$image->delete();
} else {
$id_image[] = (int) $image->id;
}
} else {
$this->warnings[] = sprintf(Tools::displayError('%s cannot be saved'), isset($image->id_product) ? ' (' . $image->id_product . ')' : '');
$this->errors[] = ($field_error !== true ? $field_error : '') . (isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '') . mysql_error();
}
}
}
} elseif (isset($info['image_position']) && $info['image_position']) {
$info['image_position'] = explode(',', $info['image_position']);
if (is_array($info['image_position']) && count($info['image_position'])) {
foreach ($info['image_position'] as $position) {
// choose images from product by position
$images = $product->getImages($default_language);
if ($images) {
foreach ($images as $row) {
if ($row['position'] == (int) $position) {
$id_image[] = (int) $row['id_image'];
break;
}
//.........这里部分代码省略.........
示例11: initContentForCombinations
public function initContentForCombinations()
{
${${"GLOBALS"}["vmqqtmkyw"]} = $this->object;
if (!Combination::isFeatureActive()) {
$this->displayWarning($this->getMessage("This feature has been disabled, you can activate this feature at this page:") . $this->getMessage("link to Performances"));
return;
}
${"GLOBALS"}["weevwwkl"] = "product";
if (Validate::isLoadedObject(${${"GLOBALS"}["weevwwkl"]})) {
self::$smarty->assign("country_display_tax_label", $this->context->country->display_tax_label);
$zsahvowoo = "lang";
self::$smarty->assign("tax_exclude_taxe_option", Tax::excludeTaxeOption());
self::$smarty->assign("id_tax_rules_group", $product->id_tax_rules_group);
self::$smarty->assign("tax_rules_groups", TaxRulesGroup::getTaxRulesGroups(true));
${$zsahvowoo} = new Language($this->id_language);
self::$smarty->assign("iso_code", $lang->iso_code);
self::$smarty->assign("combinationImagesJs", $this->getCombinationImagesJs());
if ($product->is_virtual) {
$tpkpvyor = "product";
self::$smarty->assign("product", ${$tpkpvyor});
$this->displayWarning($this->getMessage("A virtual product cannot have combinations."));
} else {
${"GLOBALS"}["qqjbnscylsi"] = "attribute_js";
${"GLOBALS"}["nqxaoftbn"] = "attribute";
$bcesaxqdqqq = "images";
${"GLOBALS"}["zcxmuajd"] = "ps_stock_mvt_reason_default";
$vmytjghdfi = "attribute_js";
$nrkrfhirkx = "attributes";
${${"GLOBALS"}["qqjbnscylsi"]} = array();
$cappytc = "k";
${"GLOBALS"}["jyaoxpe"] = "attribute";
${$nrkrfhirkx} = Attribute::getAttributes($this->context->language->id, true);
foreach (${${"GLOBALS"}["ecblflvypvt"]} as ${$cappytc} => ${${"GLOBALS"}["jyaoxpe"]}) {
${$vmytjghdfi}[${${"GLOBALS"}["iixdipeiyldv"]}["id_attribute_group"]][${${"GLOBALS"}["iixdipeiyldv"]}["id_attribute"]] = ${${"GLOBALS"}["nqxaoftbn"]}["name"];
}
${"GLOBALS"}["higiwiyuxd"] = "k";
${${"GLOBALS"}["sxexnhlq"]} = new Currency((int) Configuration::get("PS_CURRENCY_DEFAULT"));
self::$smarty->assign("attributeJs", ${${"GLOBALS"}["xenfvrjowsy"]});
self::$smarty->assign("attributes_groups", AttributeGroup::getAttributesGroups($this->context->language->id));
self::$smarty->assign("currency", ${${"GLOBALS"}["sxexnhlq"]});
${"GLOBALS"}["xzqtsdnlkv"] = "images";
${$bcesaxqdqqq} = Image::getImages($this->context->language->id, $product->id);
self::$smarty->assign("tax_exclude_option", Tax::excludeTaxeOption());
$rbxbrbxg = "product";
self::$smarty->assign("ps_weight_unit", Configuration::get("PS_WEIGHT_UNIT"));
self::$smarty->assign("ps_use_ecotax", Configuration::get("PS_USE_ECOTAX"));
self::$smarty->assign("field_value_unity", $this->getFieldValue(${${"GLOBALS"}["vmqqtmkyw"]}, "unity"));
${"GLOBALS"}["vpcuib"] = "image_type";
self::$smarty->assign("reasons", ${${"GLOBALS"}["nqegxbae"]} = StockMvtReason::getStockMvtReasons($this->context->language->id));
self::$smarty->assign("ps_stock_mvt_reason_default", ${${"GLOBALS"}["zcxmuajd"]} = Configuration::get("PS_STOCK_MVT_REASON_DEFAULT"));
self::$smarty->assign("minimal_quantity", $this->getFieldValue(${${"GLOBALS"}["vmqqtmkyw"]}, "minimal_quantity") ? $this->getFieldValue(${${"GLOBALS"}["vmqqtmkyw"]}, "minimal_quantity") : 1);
self::$smarty->assign("available_date", $this->getFieldValue(${$rbxbrbxg}, "available_date") != 0 ? stripslashes(htmlentities(Tools::displayDate($this->getFieldValue(${${"GLOBALS"}["vmqqtmkyw"]}, "available_date"), version_compare(_PS_VERSION_, "1.5.5", ">=") ? null : $this->context->language->id))) : "0000-00-00");
${${"GLOBALS"}["tqkkuicfgax"]} = 0;
${"GLOBALS"}["ucamhp"] = "product";
self::$smarty->assign("imageType", ImageType::getByNameNType("small_default", "products"));
self::$smarty->assign("imageWidth", (isset(${${"GLOBALS"}["rvkjjxqs"]}["width"]) ? (int) ${${"GLOBALS"}["vpcuib"]}["width"] : 64) + 25);
foreach (${${"GLOBALS"}["xzqtsdnlkv"]} as ${${"GLOBALS"}["higiwiyuxd"]} => ${${"GLOBALS"}["inpuwydsyk"]}) {
$cshrlmyryz = "image";
${${"GLOBALS"}["dhvuermstcbs"]}[${${"GLOBALS"}["qtxqhylrbsm"]}]["obj"] = new Image(${$cshrlmyryz}["id_image"]);
$kcvbkys = "i";
++${$kcvbkys};
}
self::$smarty->assign("images", ${${"GLOBALS"}["dhvuermstcbs"]});
self::$smarty->assign(array("combinationArray" => $this->getCombinations(${${"GLOBALS"}["ucamhp"]}, ${${"GLOBALS"}["sxexnhlq"]}), "product" => ${${"GLOBALS"}["vmqqtmkyw"]}, "id_category" => $product->getDefaultCategory(), "token_generator" => "tokengenerator", "combination_exists" => Shop::isFeatureActive() && Shop::getContextShopGroup()->share_stock && count(AttributeGroup::getAttributesGroups($this->context->language->id)) > 0));
}
} else {
self::$smarty->assign("product", ${${"GLOBALS"}["vmqqtmkyw"]});
$this->displayWarning($this->getMessage("You must save this product before adding combinations."));
}
}
示例12: renderForm
public function renderForm()
{
if (!$this->object->id) {
$this->object->price = -1;
}
$this->fields_form = array('legend' => array('title' => $this->trans('Catalog price rules', array(), 'Admin.Catalog.Feature'), 'icon' => 'icon-dollar'), 'input' => array(array('type' => 'text', 'label' => $this->trans('Name', array(), 'Admin.Global'), 'name' => 'name', 'maxlength' => 255, 'required' => true), array('type' => 'select', 'label' => $this->trans('Shop', array(), 'Admin.Global'), 'name' => 'shop_id', 'options' => array('query' => Shop::getShops(), 'id' => 'id_shop', 'name' => 'name'), 'condition' => Shop::isFeatureActive(), 'default_value' => Shop::getContextShopID()), array('type' => 'select', 'label' => $this->trans('Currency', array(), 'Admin.Global'), 'name' => 'id_currency', 'options' => array('query' => array_merge(array(0 => array('id_currency' => 0, 'name' => $this->trans('All currencies', array(), 'Admin.Global'))), Currency::getCurrencies(false, true, true)), 'id' => 'id_currency', 'name' => 'name')), array('type' => 'select', 'label' => $this->trans('Country', array(), 'Admin.Global'), 'name' => 'id_country', 'options' => array('query' => array_merge(array(0 => array('id_country' => 0, 'name' => $this->trans('All countries', array(), 'Admin.Global'))), Country::getCountries((int) $this->context->language->id)), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->trans('Group', array(), 'Admin.Global'), 'name' => 'id_group', 'options' => array('query' => array_merge(array(0 => array('id_group' => 0, 'name' => $this->trans('All groups', array(), 'Admin.Global'))), Group::getGroups((int) $this->context->language->id)), 'id' => 'id_group', 'name' => 'name')), array('type' => 'text', 'label' => $this->trans('From quantity', array(), 'Admin.Catalog.Feature'), 'name' => 'from_quantity', 'maxlength' => 10, 'required' => true), array('type' => 'text', 'label' => $this->trans('Price (tax excl.)', array(), 'Admin.Catalog.Feature'), 'name' => 'price', 'disabled' => $this->object->price == -1 ? 1 : 0, 'maxlength' => 10, 'suffix' => $this->context->currency->getSign('right')), array('type' => 'checkbox', 'name' => 'leave_bprice', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->trans('Leave initial price', array(), 'Admin.Catalog.Feature'), 'val' => '1', 'checked' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'datetime', 'label' => $this->trans('From', array(), 'Admin.Global'), 'name' => 'from'), array('type' => 'datetime', 'label' => $this->trans('To', array(), 'Admin.Global'), 'name' => 'to'), array('type' => 'select', 'label' => $this->trans('Reduction type', array(), 'Admin.Catalog.Feature'), 'name' => 'reduction_type', 'options' => array('query' => array(array('reduction_type' => 'amount', 'name' => $this->trans('Amount', array(), 'Admin.Global')), array('reduction_type' => 'percentage', 'name' => $this->trans('Percentage', array(), 'Admin.Global'))), 'id' => 'reduction_type', 'name' => 'name')), array('type' => 'select', 'label' => $this->trans('Reduction with or without taxes', array(), 'Admin.Catalog.Feature'), 'name' => 'reduction_tax', 'align' => 'center', 'options' => array('query' => array(array('lab' => $this->trans('Tax included', array(), 'Admin.Global'), 'val' => 1), array('lab' => $this->trans('Tax excluded', array(), 'Admin.Global'), 'val' => 0)), 'id' => 'val', 'name' => 'lab')), array('type' => 'text', 'label' => $this->trans('Reduction', array(), 'Admin.Catalog.Feature'), 'name' => 'reduction', 'required' => true)), 'submit' => array('title' => $this->trans('Save', array(), 'Admin.Actions')));
if (($value = $this->getFieldValue($this->object, 'price')) != -1) {
$price = number_format($value, 6);
} else {
$price = '';
}
$this->fields_value = array('price' => $price, 'from_quantity' => ($value = $this->getFieldValue($this->object, 'from_quantity')) ? $value : 1, 'reduction' => number_format(($value = $this->getFieldValue($this->object, 'reduction')) ? $value : 0, 6), 'leave_bprice_on' => $price ? 0 : 1, 'shop_id' => ($value = $this->getFieldValue($this->object, 'id_shop')) ? $value : 1);
$attribute_groups = array();
$attributes = Attribute::getAttributes((int) $this->context->language->id);
foreach ($attributes as $attribute) {
if (!isset($attribute_groups[$attribute['id_attribute_group']])) {
$attribute_groups[$attribute['id_attribute_group']] = array('id_attribute_group' => $attribute['id_attribute_group'], 'name' => $attribute['attribute_group']);
}
$attribute_groups[$attribute['id_attribute_group']]['attributes'][] = array('id_attribute' => $attribute['id_attribute'], 'name' => $attribute['name']);
}
$features = Feature::getFeatures((int) $this->context->language->id);
foreach ($features as &$feature) {
$feature['values'] = FeatureValue::getFeatureValuesWithLang((int) $this->context->language->id, $feature['id_feature'], true);
}
$this->tpl_form_vars = array('manufacturers' => Manufacturer::getManufacturers(), 'suppliers' => Supplier::getSuppliers(), 'attributes_group' => $attribute_groups, 'features' => $features, 'categories' => Category::getSimpleCategories((int) $this->context->language->id), 'conditions' => $this->object->getConditions(), 'is_multishop' => Shop::isFeatureActive());
return parent::renderForm();
}
示例13: attributeImport
public function attributeImport()
{
$default_language = Configuration::get('PS_LANG_DEFAULT');
$groups = array();
foreach (AttributeGroup::getAttributesGroups($default_language) as $group) {
$groups[$group['name']] = (int) $group['id_attribute_group'];
}
$attributes = array();
foreach (Attribute::getAttributes($default_language) as $attribute) {
$attributes[$attribute['attribute_group'] . '_' . $attribute['name']] = (int) $attribute['id_attribute'];
}
$this->receiveTab();
$handle = $this->openCsvFile();
AdminImportController::setLocale();
for ($current_line = 0; $line = fgetcsv($handle, MAX_LINE_SIZE, $this->separator); $current_line++) {
if (count($line) == 1 && empty($line[0])) {
continue;
}
if (Tools::getValue('convert')) {
$line = $this->utf8EncodeArray($line);
}
$info = AdminImportController::getMaskedRow($line);
$info = array_map('trim', $info);
AdminImportController::setDefaultValues($info);
if (!Shop::isFeatureActive()) {
$info['shop'] = 1;
} elseif (!isset($info['shop']) || empty($info['shop'])) {
$info['shop'] = implode($this->multiple_value_separator, Shop::getContextListShopID());
}
// Get shops for each attributes
$info['shop'] = explode($this->multiple_value_separator, $info['shop']);
$id_shop_list = array();
foreach ($info['shop'] as $shop) {
if (!is_numeric($shop)) {
$id_shop_list[] = Shop::getIdByName($shop);
} else {
$id_shop_list[] = $shop;
}
}
if (isset($info['id_product'])) {
$product = new Product((int) $info['id_product'], false, $default_language);
} else {
continue;
}
$id_image = null;
//delete existing images if "delete_existing_images" is set to 1
if (array_key_exists('delete_existing_images', $info) && $info['delete_existing_images'] && !isset($this->cache_image_deleted[(int) $product->id])) {
$product->deleteImages();
$this->cache_image_deleted[(int) $product->id] = true;
}
if (isset($info['image_url']) && $info['image_url']) {
$product_has_images = (bool) Image::getImages($this->context->language->id, $product->id);
$url = $info['image_url'];
$image = new Image();
$image->id_product = (int) $product->id;
$image->position = Image::getHighestPosition($product->id) + 1;
$image->cover = !$product_has_images ? true : false;
$field_error = $image->validateFields(UNFRIENDLY_ERROR, true);
$lang_field_error = $image->validateFieldsLang(UNFRIENDLY_ERROR, true);
if ($field_error === true && $lang_field_error === true && $image->add()) {
$image->associateTo($id_shop_list);
if (!AdminImportController::copyImg($product->id, $image->id, $url)) {
$this->warnings[] = sprintf(Tools::displayError('Error copying image: %s'), $url);
$image->delete();
} else {
$id_image = array($image->id);
}
} else {
$this->warnings[] = sprintf(Tools::displayError('%s cannot be saved'), isset($image->id_product) ? ' (' . $image->id_product . ')' : '');
$this->errors[] = ($field_error !== true ? $field_error : '') . (isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '') . mysql_error();
}
} elseif (isset($info['image_position']) && $info['image_position']) {
$images = $product->getImages($default_language);
if ($images) {
foreach ($images as $row) {
if ($row['position'] == (int) $info['image_position']) {
$id_image = array($row['id_image']);
break;
}
}
}
if (!$id_image) {
$this->warnings[] = sprintf(Tools::displayError('No image was found for combination with id_product = %s and image position = %s.'), $product->id, (int) $info['image_position']);
}
}
$id_attribute_group = 0;
// groups
$groups_attributes = array();
if (isset($info['group'])) {
foreach (explode($this->multiple_value_separator, $info['group']) as $key => $group) {
$tab_group = explode(':', $group);
$group = trim($tab_group[0]);
if (!isset($tab_group[1])) {
$type = 'select';
} else {
$type = trim($tab_group[1]);
}
// sets group
$groups_attributes[$key]['group'] = $group;
// if position is filled
//.........这里部分代码省略.........
示例14: attributeImport
public function attributeImport()
{
global $cookie;
$defaultLanguage = Configuration::get('PS_LANG_DEFAULT');
$groups = array();
foreach (AttributeGroup::getAttributesGroups($defaultLanguage) as $group) {
$groups[$group['name']] = (int) $group['id_attribute_group'];
}
$attributes = array();
foreach (Attribute::getAttributes($defaultLanguage) as $attribute) {
$attributes[$attribute['attribute_group'] . '_' . $attribute['name']] = (int) $attribute['id_attribute'];
}
$this->receiveTab();
$handle = $this->openCsvFile();
$fsep = (is_null(Tools::getValue('multiple_value_separator')) or trim(Tools::getValue('multiple_value_separator')) == '') ? ',' : Tools::getValue('multiple_value_separator');
self::setLocale();
for ($current_line = 0; $line = fgetcsv($handle, MAX_LINE_SIZE, Tools::getValue('separator')); $current_line++) {
if (Tools::getValue('convert')) {
$line = $this->utf8_encode_array($line);
}
$info = self::getMaskedRow($line);
$info = array_map('trim', $info);
self::setDefaultValues($info);
$product = new Product((int) $info['id_product'], false, $defaultLanguage);
$id_image = null;
if (isset($info['image_url']) && $info['image_url']) {
$productHasImages = (bool) Image::getImages((int) $cookie->id_lang, (int) $product->id);
$url = $info['image_url'];
$image = new Image();
$image->id_product = (int) $product->id;
$image->position = Image::getHighestPosition($product->id) + 1;
$image->cover = !$productHasImages ? true : false;
$image->legend = self::createMultiLangField($product->name);
if (($fieldError = $image->validateFields(UNFRIENDLY_ERROR, true)) === true and ($langFieldError = $image->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true and $image->add()) {
if (!self::copyImg($product->id, $image->id, $url)) {
$this->_warnings[] = Tools::displayError('Error copying image: ') . $url;
} else {
$id_image = array($image->id);
}
} else {
$this->_warnings[] = $image->legend[$defaultLanguageId] . (isset($image->id_product) ? ' (' . $image->id_product . ')' : '') . ' ' . Tools::displayError('Cannot be saved');
$this->_errors[] = ($fieldError !== true ? $fieldError : '') . ($langFieldError !== true ? $langFieldError : '') . mysql_error();
}
} elseif (isset($info['image_position']) && $info['image_position']) {
$images = $product->getImages($defaultLanguage);
if ($images) {
foreach ($images as $row) {
if ($row['position'] == (int) $info['image_position']) {
$id_image = array($row['id_image']);
break;
}
}
}
if (!$id_image) {
$this->_warnings[] = sprintf(Tools::displayError('No image found for combination with id_product = %s and image position = %s.'), $product->id, (int) $info['image_position']);
}
}
$id_product_attribute = $product->addProductAttribute((double) $info['price'], (double) $info['weight'], 0, (double) $info['ecotax'], (int) $info['quantity'], $id_image, strval($info['reference']), strval($info['supplier_reference']), strval($info['ean13']), (int) $info['default_on'], strval($info['upc']));
foreach (explode($fsep, $info['options']) as $option) {
list($group, $attribute) = array_map('trim', explode(':', $option));
if (!isset($groups[$group])) {
$obj = new AttributeGroup();
$obj->is_color_group = false;
$obj->name[$defaultLanguage] = $group;
$obj->public_name[$defaultLanguage] = $group;
if (($fieldError = $obj->validateFields(UNFRIENDLY_ERROR, true)) === true and ($langFieldError = $obj->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true) {
$obj->add();
$groups[$group] = $obj->id;
} else {
$this->_errors[] = ($fieldError !== true ? $fieldError : '') . ($langFieldError !== true ? $langFieldError : '');
}
}
if (!isset($attributes[$group . '_' . $attribute])) {
$obj = new Attribute();
$obj->id_attribute_group = $groups[$group];
$obj->name[$defaultLanguage] = str_replace('\\n', '', str_replace('\\r', '', $attribute));
if (($fieldError = $obj->validateFields(UNFRIENDLY_ERROR, true)) === true and ($langFieldError = $obj->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true) {
$obj->add();
$attributes[$group . '_' . $attribute] = $obj->id;
} else {
$this->_errors[] = ($fieldError !== true ? $fieldError : '') . ($langFieldError !== true ? $langFieldError : '');
}
}
Db::getInstance()->Execute('INSERT INTO ' . _DB_PREFIX_ . 'product_attribute_combination (id_attribute, id_product_attribute) VALUES (' . (int) $attributes[$group . '_' . $attribute] . ',' . (int) $id_product_attribute . ')');
}
}
$this->closeCsvFile($handle);
}
示例15: displayFormAttributes
function displayFormAttributes($obj, $languages, $defaultLanguage)
{
global $currentIndex, $cookie;
$attributeJs = array();
$attributes = Attribute::getAttributes(intval($cookie->id_lang), true);
foreach ($attributes as $k => $attribute) {
$attributeJs[$attribute['id_attribute_group']][$attribute['id_attribute']] = $attribute['name'];
}
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$attributes_groups = AttributeGroup::getAttributesGroups(intval($cookie->id_lang));
$images = Image::getImages(intval($cookie->id_lang), $obj->id);
if ($obj->id) {
echo '
<table cellpadding="5">
<tr>
<td colspan="2"><b>' . $this->l('Add or modify combinations for this product') . '</b> -
<a href="index.php?tab=AdminCatalog&id_product=' . $obj->id . '&id_category=' . intval(Tools::getValue('id_category')) . '&attributegenerator&token=' . Tools::getAdminToken('AdminCatalog' . intval(Tab::getIdFromClassName('AdminCatalog')) . intval($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/appearance.gif" alt="combinations_generator" class="middle" title="' . $this->l('Product combinations generator') . '" /> ' . $this->l('Product combinations generator') . '</a>
</td>
</tr>
</table>
<hr style="width:730px;"><br />
<table cellpadding="5" style="width:100%">
<tr>
<td style="width:150px" valign="top">' . $this->l('Group:') . '</td>
<td style="padding-bottom:5px;"><select name="attribute_group" id="attribute_group" style="width: 200px;" onchange="populate_attrs();">';
if (isset($attributes_groups)) {
foreach ($attributes_groups as $k => $attribute_group) {
if (isset($attributeJs[$attribute_group['id_attribute_group']])) {
echo '
<option value="' . $attribute_group['id_attribute_group'] . '">
' . htmlentities(stripslashes($attribute_group['name']), ENT_COMPAT, 'UTF-8') . ' </option>';
}
}
}
echo '
</select></td>
</tr>
<tr>
<td style="width:150px" valign="top">' . $this->l('Attribute:') . '</td>
<td style="padding-bottom:5px;"><select name="attribute" id="attribute" style="width: 200px;">
<option value="0">---</option>
</select>
<script type="text/javascript" language="javascript">populate_attrs();</script>
</td>
</tr>
<tr>
<td style="width:150px" valign="top">
<input style="width: 140px; margin-bottom: 10px;" type="button" value="' . $this->l('Add') . '" class="button" onclick="add_attr();"/><br />
<input style="width: 140px;" type="button" value="' . $this->l('Delete') . '" class="button" onclick="del_attr()"/></td>
<td align="left">
<select id="product_att_list" name="attribute_combinaison_list[]" multiple="multiple" size="4" style="width: 320px;"></select>
</td>
</tr>
<tr><td colspan="2"><hr style="width:730px;"></td></tr>
<tr>
<td style="width:150px">' . $this->l('Reference:') . '</td>
<td style="padding-bottom:5px;">
<input size="55" type="text" id="attribute_reference" name="attribute_reference" value="" style="width: 130px; margin-right: 44px;" />
' . $this->l('EAN13:') . '<input size="55" maxlength="13" type="text" id="attribute_ean13" name="attribute_ean13" value="" style="width: 110px; margin-left: 10px;" />
<span class="hint" name="help_box">' . $this->l('Special characters allowed:') . ' .-_#<span class="hint-pointer"> </span></span>
</td>
</tr>
<tr>
<td style="width:150px">' . $this->l('Supplier Reference:') . '</td>
<td style="padding-bottom:5px;">
<input size="55" type="text" id="attribute_supplier_reference" name="attribute_supplier_reference" value="" style="width: 130px; margin-right: 44px;" />
' . $this->l('Location:') . '<input size="55" type="text" id="attribute_location" name="attribute_location" value="" style="width: 101px; margin-left: 10px;" />
<span class="hint" name="help_box">' . $this->l('Special characters allowed:') . ' .-_#<span class="hint-pointer"> </span></span>
</td>
</tr>
<tr><td colspan="2"><hr style="width:730px;"></td></tr>
<tr>
<td style="width:150px">' . $this->l('Wholesale price:') . '</td>
<td style="padding-bottom:5px;">' . ($currency->format == 1 ? $currency->sign . ' ' : '') . '<input type="text" size="6" name="attribute_wholesale_price" id="attribute_wholesale_price" value="0.00" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\');" />' . ($currency->format == 2 ? ' ' . $currency->sign : '') . ' (' . $this->l('overrides Wholesale price on Information tab') . ')</td>
</tr>
<tr>
<td style="width:150px">' . $this->l('Impact on price:') . '</td>
<td colspan="2" style="padding-bottom:5px;">
<select name="attribute_price_impact" id="attribute_price_impact" style="width: 140px;" onchange="check_impact();">
<option value="0">' . $this->l('None') . '</option>
<option value="1">' . $this->l('Increase') . '</option>
<option value="-1">' . $this->l('Reduction') . '</option>
</select> <sup>*</sup>
<span id="span_impact"> ' . $this->l('of') . ' ' . ($currency->format == 1 ? $currency->sign . ' ' : '') . '
<input type="text" size="6" name="attribute_price" id="attribute_price" value="0.00" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\');"/>' . ($currency->format == 2 ? ' ' . $currency->sign : '') . '
</span>
</td>
</tr>
<tr>
<td style="width:150px">' . $this->l('Impact on weight:') . '</td>
<td colspan="2" style="padding-bottom:5px;"><select name="attribute_weight_impact" id="attribute_weight_impact" style="width: 140px;" onchange="check_weight_impact();">
<option value="0">' . $this->l('None') . '</option>
<option value="1">' . $this->l('Increase') . '</option>
<option value="-1">' . $this->l('Reduction') . '</option>
</select>
<span id="span_weight_impact"> ' . $this->l('of') . '
<input type="text" size="6" name="attribute_weight" id="attribute_weight" value="0.00" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\');" /> ' . Configuration::get('PS_WEIGHT_UNIT') . '</span></td>
</tr>
<tr>
<td style="width:150px">' . $this->l('Eco-tax:') . '</td>
//.........这里部分代码省略.........