本文整理汇总了PHP中AttributeGroup::getAttributesGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP AttributeGroup::getAttributesGroups方法的具体用法?PHP AttributeGroup::getAttributesGroups怎么用?PHP AttributeGroup::getAttributesGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributeGroup
的用法示例。
在下文中一共展示了AttributeGroup::getAttributesGroups方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContent
function getContent()
{
$is_one_dot_five = version_compare(_PS_VERSION_, '1.5', '>');
// Smarty
$template_vars = array('id_tab' => Tools::getValue('id_tab'), 'controller' => Tools::getValue('controller'), 'tab' => Tools::getValue('tab'), 'configure' => Tools::getValue('configure'), 'tab_module' => Tools::getValue('tab_module'), 'module_name' => Tools::getValue('module_name'), 'token' => Tools::getValue('token'), 'ebay_token' => Configuration::get('EBAY_SECURITY_TOKEN'), '_module_dir_' => _MODULE_DIR_, 'ebay_categories' => EbayCategoryConfiguration::getEbayCategories($this->ebay_profile->id), 'id_lang' => $this->context->cookie->id_lang, 'id_ebay_profile' => $this->ebay_profile->id, '_path' => $this->path, 'possible_attributes' => AttributeGroup::getAttributesGroups($this->context->cookie->id_lang), 'possible_features' => Feature::getFeatures($this->context->cookie->id_lang, true), 'date' => pSQL(date('Ymdhis')), 'conditions' => $this->_translatePSConditions(EbayCategoryConditionConfiguration::getPSConditions()), 'form_items_specifics' => EbaySynchronizer::getNbSynchronizableEbayCategoryCondition(), 'form_items_specifics_mixed' => EbaySynchronizer::getNbSynchronizableEbayCategoryConditionMixed(), 'isOneDotFive' => $is_one_dot_five);
return $this->display('formItemsSpecifics.tpl', $template_vars);
}
示例2: __construct
public function __construct($moduleInstance)
{
parent::__construct($moduleInstance);
$productIdOptions = array(array('value' => 0, 'name' => 'Reference Code'), array('value' => 1, 'name' => 'EAN-13 or JAN barcode'), array('value' => 2, 'name' => 'UPC barcode'));
$this->addSelectField('Product ID', 'map_id', $productIdOptions, true, $this->l('Select the product reference group you are using in your store'));
$productManufacturerOptions = array(array('value' => 0, 'name' => 'Product Manufacturer'), array('value' => 1, 'name' => 'Product Supplier'));
$this->addSelectField('Product Manufacturer', 'map_manufacturer', $productManufacturerOptions, true, $this->l('Select the field you are using to specify the manufacturer'));
$productLinkOptions = array(array('value' => 0, 'name' => 'Use Product Link'));
$this->addSelectField('Product Link', 'map_link', $productLinkOptions, true, $this->l('URL that leads to product. For upcoming features'));
$productImageLinkOptions = array(array('value' => 0, 'name' => 'Cover Image'), array('value' => 1, 'name' => 'Random Image'));
$this->addSelectField('Product Image', 'map_image', $productImageLinkOptions, true, $this->l('Choose if you want to use cover image or some random image from product\'s gallery'));
$productCategoriesOptions = array(array('value' => 0, 'name' => 'Categories'), array('value' => 1, 'name' => 'Tags'));
$this->addSelectField('Product Categories', 'map_category', $productCategoriesOptions, true, $this->l('Choose product tags if and only if no categories are set and instead product tags are in use'));
$productPriceOptions = array(array('value' => 0, 'name' => 'Retail price with tax'), array('value' => 1, 'name' => 'Pre-tax retail price'), array('value' => 2, 'name' => 'Pre-tax wholesale price'));
$this->addSelectField('Product Prices', 'map_price_with_vat', $productPriceOptions, true, $this->l('s option specify the product price that will be used in XML. This should be left to "Retail price with tax"'));
$productMPNOptions = array(array('value' => 0, 'name' => 'Reference Code'), array('value' => 1, 'name' => 'EAN-13 or JAN barcode'), array('value' => 2, 'name' => 'UPC barcode'), array('value' => 3, 'name' => 'Supplier Reference'));
$this->addSelectField('Product Manufacturer Reference Code', 'map_mpn', $productMPNOptions, true, $this->l('This option should reflect product\' manufacturer SKU'));
$productISBNOptions = array(array('value' => 0, 'name' => 'Reference Code'), array('value' => 1, 'name' => 'EAN-13 or JAN barcode'), array('value' => 2, 'name' => 'UPC barcode'), array('value' => 3, 'name' => 'Supplier Reference'));
$this->addSelectField('Product ISBN', 'map_isbn', $productISBNOptions, true, $this->l('This field will be used if you sell books in your store, to specify the ISBN of the book'));
// Multiselect from attribute groups
$default_lang = (int) \Configuration::get('PS_LANG_DEFAULT');
$productSizesOptions = array();
$productColorOptions = array();
$attributes = \AttributeGroup::getAttributesGroups($default_lang);
foreach ($attributes as $attribute) {
if ($attribute['is_color_group']) {
$productColorOptions[] = array('value' => $attribute['id_attribute_group'], 'name' => $attribute['name']);
} else {
$productSizesOptions[] = array('value' => $attribute['id_attribute_group'], 'name' => $attribute['name']);
}
}
$this->addMultiSelectField('Size Attributes', 'map_size', $productSizesOptions, true, $this->l('Choose the attributes that you use to specify product sizes. This field is used only if Fashion Store option is enabled'))->addMultiSelectField('Color Attributes', 'map_color', $productColorOptions, true, $this->l('Choose the attributes that you use to specify product colors. This field is used only if Fashion Store option is enabled'));
}
示例3: __construct
public function __construct()
{
$this->name = 'topshop';
$this->tab = 'smart_shopping';
$this->version = '1.7.7';
$this->author = 'Roman Prokofyev';
$this->need_instance = 1;
$this->display = 'view';
$this->bootstrap = true;
//$this->ps_versions_compliancy = array('min' => '1.5.0.0', 'max' => '1.6');
$this->module_key = '2149d8638f786d69c1a762f1fbfb8124';
$this->custom_attributes = array('YAMARKET_COMPANY_NAME', 'YAMARKET_DELIVERY_PRICE', 'YAMARKET_SALES_NOTES', 'YAMARKET_COUNTRY_OF_ORIGIN', 'YAMARKET_EXPORT_TYPE', 'YAMARKET_MODEL_NAME', 'YAMARKET_DESC_TYPE', 'YAMARKET_DELIVERY_DELIVERY', 'YAMARKET_DELIVERY_PICKUP', 'YAMARKET_DELIVERY_STORE');
$this->country_of_origin_attr = Configuration::get('YAMARKET_COUNTRY_OF_ORIGIN');
$this->model_name_attr = Configuration::get('YAMARKET_MODEL_NAME');
parent::__construct();
$this->displayName = $this->l('Yandex Market');
if ($this->id && !Configuration::get('YAMARKET_COMPANY_NAME')) {
$this->warning = $this->l('You have not yet set your Company Name');
}
$this->description = $this->l('Provides price list export to Yandex Market');
$this->confirmUninstall = $this->l('Are you sure you want to delete your details ?');
// Variables fro price list
$this->id_lang = (int) Configuration::get('PS_LANG_DEFAULT');
$this->proto_prefix = _PS_BASE_URL_;
// Get groups
$attribute_groups = AttributeGroup::getAttributesGroups($this->id_lang);
$this->attibute_groups = array();
foreach ($attribute_groups as $group) {
$this->attibute_groups[$group['id_attribute_group']] = $group['public_name'];
}
// Get categories
$this->excluded_cats = explode(',', Configuration::get('TOPSHOP_EXCLUDED_CATS'));
if (!$this->excluded_cats) {
$this->excluded_cats = array();
}
$all_cats = Category::getSimpleCategories($this->id_lang);
$this->selected_cats = array();
$this->all_cats = array();
foreach ($all_cats as $cat) {
$this->all_cats[] = $cat['id_category'];
if (!in_array($cat['id_category'], $this->excluded_cats)) {
$this->selected_cats[] = $cat['id_category'];
}
}
//determine image type
$this->image_type = 'large_default';
if (Tools::substr(_PS_VERSION_, 0, 5) == '1.5.0') {
$this->image_type = 'large';
}
}
示例4: 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>
//.........这里部分代码省略.........
示例5: 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);
}
示例6: 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));
}
示例7: initContent
public function initContent()
{
if (!Combination::isFeatureActive()) {
$this->displayWarning($this->l('This feature has been disabled, you can activate it at:') . '
<a href="index.php?tab=AdminPerformance&token=' . Tools::getAdminTokenLite('AdminPerformance') . '#featuresDetachables">' . $this->l('Performance') . '</a>');
return;
}
// Init toolbar
$this->initToolbarTitle();
$this->initToolbar();
$this->initGroupTable();
$js_attributes = AdminAttributeGeneratorController::displayAndReturnAttributeJs();
$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' => $js_attributes, 'toolbar_btn' => $this->toolbar_btn, 'toolbar_scroll' => true, 'title' => $this->toolbar_title));
}
示例8: displayForm
public function displayForm()
{
global $currentIndex, $cookie;
$jsAttributes = self::displayAndReturnAttributeJs();
$attributesGroups = AttributeGroup::getAttributesGroups(intval($cookie->id_lang));
$this->product = new Product(intval(Tools::getValue('id_product')));
if (isset($_POST['generate']) and !sizeof($this->_errors)) {
echo '
<div class="module_confirmation conf confirm">
<img src="../img/admin/ok.gif" alt="" title="" style="margin-right:5px; float:left;" />
' . sizeof($this->combinations) . ' ' . $this->l('product(s) successfully created.') . '
</div>';
}
echo '
<script type="text/javascript" src="../js/attributesBack.js"></script>
<form enctype="multipart/form-data" method="post" id="generator" action=""' . $currentIndex . '&id_category=' . intval(Tools::getValue('id_category')) . 'token=' . Tools::getValue('token') . '">
<fieldset style="margin-bottom: 35px;"><legend><img src="../img/admin/asterisk.gif" />' . $this->l('Attributes generator') . '</legend>' . $this->l('Add or modify attributes for this product:') . '
<br /><br />
';
echo '
<div style="padding-top:10px; float: left; width: 570px;">
<div style="float:left;">
<label>' . $this->l('Quantity:') . '</label>
<div class="margin-form">
<input type="text" size="20" name="quantity" value="1"/>
</div>
<label>' . $this->l('Reference:') . '</label>
<div class="margin-form">
<input type="text" size="20" name="reference" value="' . $this->product->reference . '"/>
</div>
</div>
<div style="float:left; text-align:center; margin-left:20px;">
<input type="submit" class="button" style="margin-bottom:5px;" name="generate" value="' . $this->l('Generate') . '" /><br />
<input type="submit" class="button" name="back" value="' . $this->l('Back to product') . '" />
</div>
<br style="clear:both;" />
<div style="margin-top: 15px;">';
self::displayGroupeTable($jsAttributes, $attributesGroups);
echo '
</div>
</div>
<div style="float: left; margin-left: 60px;">
';
self::displayGroupSelect($jsAttributes, $attributesGroups);
echo '
<div>
<input class="button" type="button" style="margin-left: 20px;" value="' . $this->l('Add') . '" class="button" onclick="add_attr_multiple();" />
<input class="button" type="button" style="margin-left: 20px;" value="' . $this->l('Delete') . '" class="button" onclick="del_attr_multiple();" />
</div>
</div>
<br />
</fieldset>
</form>';
}
示例9: getAllAttributes
public function getAllAttributes()
{
$all_Attribut = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT `id_attribute_eco`, `value`
FROM `' . _DB_PREFIX_ . 'ec_ecopresto_attribute`');
$response = '';
$Attribut_PS = AttributeGroup::getAttributesGroups(self::getInfoEco('ID_LANG'));
foreach ($all_Attribut as $attribut) {
$attribut_eco = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT id_attribute FROM `' . _DB_PREFIX_ . 'ec_ecopresto_attribute_shop` WHERE `id_attribute_eco`=' . (int) $attribut['id_attribute_eco'] . ' AND `id_shop`=' . (int) self::getInfoEco('ID_SHOP'));
$response .= '<p>Attribut EcoPresto :' . $attribut['value'] . ' =>';
$response .= ' <select name="attribut_ps[]">
<option value="' . $attribut['id_attribute_eco'] . '_0"> Créer automatiquement </option>';
foreach ($Attribut_PS as $attributPS) {
$response .= '<option value="' . $attribut['id_attribute_eco'] . '_' . $attributPS['id_attribute_group'] . '" ' . ($attribut_eco == $attributPS['id_attribute_group'] ? 'selected="selected"' : '') . '>' . $attributPS['name'] . '</option>';
}
$response .= '</select>';
}
return $response;
}
示例10: getReadableFields
protected function getReadableFields($fields)
{
global $cookie;
$titles = array('id_product' => array('name' => $this->l('Product ID', __CLASS__), 'class' => 'prodRel'), 'active' => array('name' => $this->l('Product status', __CLASS__), 'class' => 'prodRel'), 'date_add' => array('name' => $this->l('Addition date', __CLASS__), 'class' => 'prodRel'), 'date_upd' => array('name' => $this->l('Update date', __CLASS__), 'class' => 'prodRel'), 'id_category_default' => array('name' => $this->l('Default Category ID', __CLASS__), 'class' => 'prodRel'), 'id_manufacturer' => array('name' => $this->l('Manufacturer ID', __CLASS__), 'class' => 'prodRel'), 'id_supplier' => array('name' => $this->l('Supplier ID', __CLASS__), 'class' => 'prodRel'), 'id_tax' => array('name' => $this->l('Tax ID', __CLASS__), 'class' => 'prodRel'), 'description' => array('name' => $this->l('Description', __CLASS__), 'class' => 'prodRel'), 'description_short' => array('name' => $this->l('Short Description', __CLASS__), 'class' => 'prodRel'), 'meta_description' => array('name' => $this->l('Meta Description', __CLASS__), 'class' => 'prodRel'), 'meta_keywords' => array('name' => $this->l('Meta Keywords', __CLASS__), 'class' => 'prodRel'), 'meta_title' => array('name' => $this->l('Meta Title', __CLASS__), 'class' => 'prodRel'), 'quantity' => array('name' => $this->l('Quantity in stock', __CLASS__), 'class' => 'prodRel'), 'name' => array('name' => $this->l('Product\'s name', __CLASS__), 'class' => 'prodRel'), 'reference' => array('name' => $this->l('Reference', __CLASS__), 'class' => 'prodRel'), 'supplier_reference' => array('name' => $this->l('Supplier\'s Reference', __CLASS__), 'class' => 'prodRel'), 'weight' => array('name' => $this->l('Weight', __CLASS__), 'class' => 'prodRel'), 'wholesale_price' => array('name' => $this->l('Wholesale Price', __CLASS__), 'class' => 'prodRel'), 'price' => array('name' => $this->l('Price', __CLASS__), 'class' => 'prodRel'), 'ecotax' => array('name' => $this->l('Ecotax', __CLASS__), 'class' => 'prodRel'), 'location' => array('name' => $this->l('Location', __CLASS__), 'class' => 'prodRel'), 'ean13' => array('name' => $this->l('Ean13', __CLASS__), 'class' => 'prodRel'), 'reduction_from' => array('name' => $this->l('Reduction from', __CLASS__), 'class' => 'prodRel'), 'reduction_to' => array('name' => $this->l('Reduction to', __CLASS__), 'class' => 'prodRel'), 'reduction_percent' => array('name' => $this->l('Reduction percent', __CLASS__), 'class' => 'prodRel'), 'reduction_price' => array('name' => $this->l('Reduction price', __CLASS__), 'class' => 'prodRel'), 'available_now' => array('name' => $this->l('Available now', __CLASS__), 'class' => 'prodRel'), 'available_later' => array('name' => $this->l('Available later', __CLASS__), 'class' => 'prodRel'), 'available_for_order' => array('name' => $this->l('Available for order', __CLASS__), 'class' => 'prodRel'), 'additional_shipping_cost' => array('name' => $this->l('Additional shipping cost', __CLASS__), 'class' => 'prodRel'), 'condition' => array('name' => $this->l('Condition', __CLASS__), 'class' => 'prodRel'), 'height' => array('name' => $this->l('Height', __CLASS__), 'class' => 'prodRel'), 'width' => array('name' => $this->l('Width', __CLASS__), 'class' => 'prodRel'), 'depth' => array('name' => $this->l('Depth', __CLASS__), 'class' => 'prodRel'), 'upc' => array('name' => $this->l('UPC', __CLASS__), 'class' => 'prodRel'), 'show_price' => array('name' => $this->l('Show price', __CLASS__), 'class' => 'prodRel'), 'unit_price_ratio' => array('name' => $this->l('Unit Price ratio', __CLASS__), 'class' => 'prodRel'), 'online_only' => array('name' => $this->l('Online Only', __CLASS__), 'class' => 'prodRel'), 'minimal_quantity' => array('name' => $this->l('Minimal quantity', __CLASS__), 'class' => 'prodRel'), 'id_tax_rules_group' => array('name' => $this->l('Tax Rule Group ID', __CLASS__), 'class' => 'prodRel'), 'unity' => array('name' => $this->l('Unity', __CLASS__), 'class' => 'prodRel'));
$result = array();
foreach ($fields as $field) {
$result[$field] = isset($titles[$field]) ? $titles[$field] : array('name' => $field, 'class' => 'prodRel');
}
$result['tax_rate'] = array('name' => $this->l('Tax Rate', __CLASS__), 'class' => 'prodRel');
$result['total_tax'] = array('name' => $this->l('Total Tax', __CLASS__), 'class' => 'prodRel');
$result['manufacturer_name'] = array('name' => $this->l('Manufacturer', __CLASS__), 'class' => 'prodRel');
$result['supplier_name'] = array('name' => $this->l('Supplier', __CLASS__), 'class' => 'prodRel');
$result['picture_link'] = array('name' => $this->l('Picture url', __CLASS__), 'class' => 'prodRel');
$result['product_link'] = array('name' => $this->l('Product url', __CLASS__), 'class' => 'prodRel');
$result['shipping_price'] = array('name' => $this->l('Shipping Price', __CLASS__), 'class' => 'prodRel');
$result['shipping_with_fee'] = array('name' => $this->l('Shipping price including COD fee', __CLASS__), 'class' => 'prodRel');
$result['category_name'] = array('name' => $this->l('Category Name', __CLASS__), 'class' => 'prodRel');
$result['price_with_tax'] = array('name' => $this->l('Price (tax incl)', __CLASS__), 'class' => 'prodRel');
uasort($result, array($this, 'cmpField'));
//get group of attributes
$attr_result = array();
$attrGroups = AttributeGroup::getAttributesGroups($cookie->id_lang);
foreach ($attrGroups as $ag) {
$attr_result['ag' . $ag['id_attribute_group']] = array('name' => $ag['name'], 'class' => 'attrRel');
}
uasort($attr_result, array($this, 'cmpField'));
$result = $result + $attr_result;
//get features
$feat_result = array();
$features = Feature::getFeatures($cookie->id_lang);
foreach ($features as $ft) {
$feat_result['ft' . $ft['id_feature']] = array('name' => $ft['name'], 'class' => 'featRel');
}
uasort($feat_result, array($this, 'cmpField'));
$result = $result + $feat_result;
$result['empty_field'] = array('name' => $this->l('Empty Field', __CLASS__), 'class' => 'specialRel');
return $result;
}
示例11: displayForm
/**
* Display form
*
* @global string $currentIndex Current URL in order to keep current Tab
*/
public function displayForm($token = NULL)
{
global $currentIndex;
$defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT'));
$languages = Language::getLanguages();
$obj = $this->loadObject(true);
$color = $obj->color ? $obj->color : 0;
$attributes_groups = AttributeGroup::getAttributesGroups($defaultLanguage);
echo '
<script type="text/javascript">
id_language = Number(' . $defaultLanguage . ');
var attributesGroups = new Array();
';
foreach ($attributes_groups as $attribute_group) {
echo 'attributesGroups[' . $attribute_group['id_attribute_group'] . '] = ' . $attribute_group['is_color_group'] . ';' . "\n";
}
echo '
</script>
<form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . ($token ? $token : $this->token) . '" method="post" enctype="multipart/form-data">
' . ($obj->id ? '<input type="hidden" name="id_attribute" value="' . $obj->id . '" />' : '') . '
<fieldset class="width3"><legend><img src="../img/admin/asterisk.gif" />' . $this->l('Attribute') . '</legend>
<label>' . $this->l('Name:') . ' </label>
<div class="margin-form">';
foreach ($languages as $language) {
echo '
<div id="name_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
<input size="33" type="text" name="name_' . $language['id_lang'] . '" value="' . htmlspecialchars($this->getFieldValue($obj, 'name', intval($language['id_lang']))) . '" /><sup> *</sup>
<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span>
</div>';
}
$this->displayFlags($languages, $defaultLanguage, 'name', 'name');
echo '
<div style="clear: both;"></div>
</div>
<label>' . $this->l('Group:') . ' </label>
<div class="margin-form">
<select name="id_attribute_group" id="id_attribute_group" onchange="showAttributeColorGroup(\'id_attribute_group\', \'colorAttributeProperties\')">';
foreach ($attributes_groups as $attribute_group) {
echo '<option value="' . $attribute_group['id_attribute_group'] . '"' . ($this->getFieldValue($obj, 'id_attribute_group') == $attribute_group['id_attribute_group'] ? ' selected="selected"' : '') . '>' . $attribute_group['name'] . '</option>';
}
echo '
</select><sup> *</sup>
</div>
<div id="colorAttributeProperties" style="' . ((Validate::isLoadedObject($obj) and $obj->isColorAttribute()) ? 'display: block;' : 'display: none;') . '">
<label>' . $this->l('Color:') . '</label>
<div class="margin-form">
<input type="text" size="33" name="color" value="' . (Tools::getValue('color', $color) ? htmlentities(Tools::getValue('color', $color)) : '#000000') . '" /> <sup>*</sup>
<p class="clear">' . $this->l('HTML colors only (e.g.,') . ' "lightblue", "#CC6600")</p>
</div>
<label>' . $this->l('Texture:') . ' </label>
<div class="margin-form">
<input type="file" name="texture" />
<p>' . $this->l('Upload color texture from your computer') . '<br />' . $this->l('This will override the HTML color!') . '</p>
</div>
<label>' . $this->l('Current texture:') . ' </label>
<div class="margin-form">
<p>' . (file_exists(_PS_IMG_DIR_ . $this->fieldImageSettings['dir'] . '/' . $obj->id . '.jpg') ? '<img src="../img/' . $this->fieldImageSettings['dir'] . '/' . $obj->id . '.jpg" alt="" title="" /> <a href="' . $_SERVER['REQUEST_URI'] . '&deleteImage=1"><img src="../img/admin/delete.gif" alt="' . $this->l('delete') . '" title="" /></a>' : $this->l('None')) . '</p>
</div>
</div>
<div class="margin-form">
<input type="submit" value="' . $this->l(' Save ') . '" name="submitAddattribute" class="button" />
</div>
<div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div>
</fieldset>
</form>';
}
示例12: getAttributes
public function getAttributes()
{
$attributes = AttributeGroup::getAttributesGroups($this->context->language->id);
$selectAttributes = array();
$selectAttributes[0]['id_option'] = 0;
$selectAttributes[0]['name'] = $this->l('Select size attribute');
foreach ($attributes as $attribute) {
$selectAttributes[$attribute['id_attribute_group']]['id_option'] = $attribute['id_attribute_group'];
$selectAttributes[$attribute['id_attribute_group']]['name'] = $attribute['name'];
}
return $selectAttributes;
}
示例13: displayForm
/**
* Display form
*
* @global string $currentIndex Current URL in order to keep current Tab
*/
public function displayForm($token = NULL)
{
global $currentIndex;
parent::displayForm();
if (!($obj = $this->loadObject(true))) {
return;
}
$color = $obj->color ? $obj->color : 0;
$attributes_groups = AttributeGroup::getAttributesGroups($this->_defaultFormLanguage);
$strAttributesGroups = '';
echo '
<script type="text/javascript">
var attributesGroups = {';
foreach ($attributes_groups as $attribute_group) {
$strAttributesGroups .= '"' . $attribute_group['id_attribute_group'] . '" : ' . $attribute_group['is_color_group'] . ',';
}
echo $strAttributesGroups . '};
</script>
<form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . ($token ? $token : $this->token) . '" method="post" enctype="multipart/form-data">
' . ($obj->id ? '<input type="hidden" name="id_attribute" value="' . $obj->id . '" />' : '') . '
<fieldset><legend><img src="../img/admin/asterisk.gif" />' . $this->l('Attribute') . '</legend>
<label>' . $this->l('Name:') . ' </label>
<div class="margin-form">';
foreach ($this->_languages as $language) {
echo '
<div id="name_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
<input size="33" type="text" name="name_' . $language['id_lang'] . '" value="' . htmlspecialchars($this->getFieldValue($obj, 'name', (int) $language['id_lang'])) . '" /><sup> *</sup>
<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span>
</div>';
}
echo '
<script type="text/javascript">
var flag_fields = \'name\';
</script>';
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'flag_fields', 'name', false, true);
echo '
<div class="clear"></div>
</div>
<label>' . $this->l('Group:') . ' </label>
<div class="margin-form">
<select name="id_attribute_group" id="id_attribute_group" onchange="showAttributeColorGroup(\'id_attribute_group\', \'colorAttributeProperties\')">';
foreach ($attributes_groups as $attribute_group) {
echo '<option value="' . $attribute_group['id_attribute_group'] . '"' . ($this->getFieldValue($obj, 'id_attribute_group') == $attribute_group['id_attribute_group'] ? ' selected="selected"' : '') . '>' . $attribute_group['name'] . '</option>';
}
echo '
</select><sup> *</sup>
</div>
<script type="text/javascript" src="../js/jquery/jquery-colorpicker.js"></script>
<div id="colorAttributeProperties" style="' . ((Validate::isLoadedObject($obj) and $obj->isColorAttribute()) ? 'display: block;' : 'display: none;') . '">
<label>' . $this->l('Color') . '</label>
<div class="margin-form">
<input width="20px" type="color" data-hex="true" class="color mColorPickerInput" name="color" value="' . (Tools::getValue('color', $color) ? htmlentities(Tools::getValue('color', $color)) : '#000000') . '" /> <sup>*</sup>
<p class="clear">' . $this->l('HTML colors only (e.g.,') . ' "lightblue", "#CC6600")</p>
</div>
<label>' . $this->l('Texture:') . ' </label>
<div class="margin-form">
<input type="file" name="texture" />
<p>' . $this->l('Upload color texture from your computer') . '<br />' . $this->l('This will override the HTML color!') . '</p>
</div>
<label>' . $this->l('Current texture:') . ' </label>
<div class="margin-form">
<p>' . (file_exists(_PS_IMG_DIR_ . $this->fieldImageSettings['dir'] . '/' . $obj->id . '.jpg') ? '<img src="../img/' . $this->fieldImageSettings['dir'] . '/' . $obj->id . '.jpg" alt="" title="" /> <a href="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '&deleteImage=1"><img src="../img/admin/delete.gif" alt="" title="' . $this->l('Delete') . '" />' . $this->l('Delete') . '</a>' : $this->l('None')) . '</p>
</div>
</div>
' . Module::hookExec('attributeForm', array('id_attribute' => $obj->id)) . '
<div class="margin-form">
<input type="submit" value="' . $this->l(' Save ') . '" name="submitAddattribute" class="button" />
</div>
<div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div>
</fieldset>
</form>
<script>
showAttributeColorGroup(\'id_attribute_group\', \'colorAttributeProperties\');
</script>';
}
示例14: generateAttributeGroupData
protected function generateAttributeGroupData()
{
$delimiter = ';';
$line = array();
$titles = array();
$new_path = new Sampledatainstall();
$id_lang = $this->use_lang;
$f = fopen($new_path->sendPath() . 'output/attribute_groups.vsc', 'w');
foreach ($this->attribute_groups_fields as $field => $array) {
$titles[] = $array['label'];
}
fputcsv($f, $titles, $delimiter, '"');
$attribute_groups = AttributeGroup::getAttributesGroups($id_lang);
if ($attribute_groups) {
uasort($attribute_groups, array('SampleDataInstall', 'cmp'));
foreach ($attribute_groups as $attribute_group) {
foreach ($this->attribute_groups_fields as $field => $array) {
$line[$field] = !Tools::isEmpty($attribute_group[$field]) ? $attribute_group[$field] : '';
}
if (!$line[$field]) {
$line[$field] = '';
}
fputcsv($f, $line, $delimiter, '"');
}
}
fclose($f);
}
示例15: _displayFormItemsSpecifics
private function _displayFormItemsSpecifics()
{
// Smarty
$template_vars = array('id_tab' => Tools::safeOutput(Tools::getValue('id_tab')), 'controller' => Tools::getValue('controller'), 'tab' => Tools::getValue('tab'), 'configure' => Tools::getValue('configure'), 'tab_module' => Tools::getValue('tab_module'), 'module_name' => Tools::getValue('module_name'), 'token' => Tools::getValue('token'), 'ebay_token' => Configuration::get('EBAY_SECURITY_TOKEN'), '_module_dir_' => _MODULE_DIR_, 'ebay_categories' => EbayCategoryConfiguration::getEbayCategories(), 'id_lang' => $this->context->cookie->id_lang, '_path' => $this->_path, 'possible_attributes' => AttributeGroup::getAttributesGroups($this->context->cookie->id_lang), 'possible_features' => Feature::getFeatures($this->context->cookie->id_lang, true), 'date' => pSQL(date('Ymdhis')), 'conditions' => $this->_translatePSConditions(EbayCategoryConditionConfiguration::getPSConditions()));
$this->smarty->assign($template_vars);
return $this->display(dirname(__FILE__), '/views/templates/hook/formItemsSpecifics.tpl');
}