Exemplo n.º 1
0
    protected function _prepareForm()
    {
        $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'action' => $this->getUrl('*/*/descriptionTemplateAssignType', ['_current' => true]), 'method' => 'post']]);
        $fieldset = $form->addFieldset('categories_mode', []);
        $fieldset->addField('block-title', 'label', ['value' => $this->__('Description Policy is required to Create New ASIN/ISBN'), 'field_extra_attributes' => 'id="categories_mode_block_title" style="font-weight: bold;font-size:18px;margin-bottom:0px"']);
        $this->css->add(<<<CSS
    #categories_mode_block_title .admin__field-control{
        width: 90%;
    }
CSS
);
        $fieldset->addField('block-notice', 'label', ['value' => $this->__('Below you can select the most convenient for you way to set Description Policy:'), 'field_extra_attributes' => 'style="margin-bottom: 0;"']);
        $fieldset->addField('mode1', 'radios', ['name' => 'mode', 'field_extra_attributes' => 'style="margin: 4px 0 0 0; font-weight: bold"', 'values' => [['value' => 'same', 'label' => 'All Products same Description Policy']], 'note' => <<<HTML
<div style="padding-top: 3px; padding-left: 26px; font-weight: normal">
    {$this->__('New ASIN(s)/ISBN(s) will be created using the same Description Policy.')}
</div>
<div style="margin: 7px 52px">
    <b>{$this->__('Description Policy')}</b>:
    <span id="description_template_title" style="font-style: italic; color: #808080">{$this->__('Not selected')}</span>
    &nbsp;<a href="javascript:void(0);" id="edit_description_template">{$this->__('Edit')}</a>
    <input id="description_template_id" name="description_template_id" value="" type="hidden" />
    <input id="products_ids" name="products_ids" type="hidden" value="">
</div>
<div style="margin: 7px 52px; display: none;" class="validation-advice" id="same_description_template_error" >
    {$this->__('Please select Description Policy.')}
</div>
HTML
]);
        $fieldset->addField('mode2', 'radios', ['name' => 'mode', 'field_extra_attributes' => 'style="margin: 4px 0 0 0; font-weight: bold"', 'values' => [['value' => 'category', 'label' => 'Based on Magento Categories']], 'note' => '<div style="padding-top: 3px; padding-left: 26px; font-weight: normal">' . $this->__('Products will have Description Policies set according to the Magento Categories.') . '</div>']);
        $fieldset->addField('mode3', 'radios', ['name' => 'mode', 'field_extra_attributes' => 'style="margin: 4px 0 0 0; font-weight: bold"', 'values' => [['value' => 'manually', 'label' => 'Set Manually for each Product']], 'note' => '<div style="padding-top: 3px; padding-left: 26px; font-weight: normal">' . $this->__('Set Description Policies for each Product (or a group of Products) manually.') . '</div>']);
        $form->setUseContainer(true);
        $this->setForm($form);
        return parent::_prepareForm();
    }
Exemplo n.º 2
0
 protected function _prepareForm()
 {
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'action' => $this->getUrl('*/*/save'), 'method' => 'post', 'enctype' => 'multipart/form-data']]);
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
    protected function _prepareForm()
    {
        $form = $this->_formFactory->create();
        $urlComponents = $this->getHelper('Component')->getEnabledComponents();
        $componentForUrl = count($urlComponents) == 1 ? array_shift($urlComponents) : \Ess\M2ePro\Helper\Component\Ebay::NICK;
        $form->addField('block_notice_configuration_advanced_settings', self::HELP_BLOCK, ['no_collapse' => true, 'no_hide' => true, 'content' => $this->__(<<<HTML
                    <p>M2E Pro is developed to work based on standard Magento functionality. 
                    One of the main aspects of its work is a dynamic event catching of the Product Data
                    changes - Price, Quantity, Images, Attributes, etc.</p><br>
                    <p>However, if Product Data is changed via Magmi Import Tool,
                    M2E Pro will not catch all of the changes. It is related to the fact that Magmi Import Tool
                    (along with many other similar tools) makes changes directly in Magento Database
                    without any Core Magento Functions involved. Inability to catch the events of Product Data
                    change leads to inability to deliver these changes to the channels (eBay, Amazon, etc.).</p><br>
                    <p>If you are using Magmi Import Tool to update the Product Data,
                    which implements changes directly into the Magento Database, please, use a
                    <a href="%url1%" target="_blank">Magmi Plugin</a> However, if you are a developer and 
                    change the Product Data directly in the Database, you can use a predefined 
                    <a href="%url2%" target="_blank">M2E Pro Models</a></p><br>
                    <p>Only in case you cannot use these features, we would recommend you to enable <br> an 
                    additional option - <strong>Track Direct Database Changes</strong>.</p><br>
                    <p><strong>Warning:</strong> Track Вirect Database changes feature is resource-intensive and may 
                    affect Performance of your Magento Site and Synchronization with Channels. Choose 'Yes' only if you
                    cannot use other predefined M2E Pro Models and you are absolutely confident that you need to
                    use this functionality.</p>
HTML
, $this->getHelper('Module\\Support')->getDocumentationUrl(NULL, NULL, 'x/yIQVAQ'), $this->getHelper('Module\\Support')->getDocumentationUrl(NULL, NULL, 'x/xYQVAQ'))]);
        $fieldSet = $form->addFieldset('direct_database_changes_field', ['legend' => false, 'collabsable' => false]);
        $inspectorMode = (int) $this->synchronizationConfig->getGroupValue('/global/magento_products/inspector/', 'mode');
        $button = $this->createBlock('Magento\\Button', '', ['data' => ['id' => 'save_inspector_mode', 'label' => $this->__('Save'), 'onclick' => 'DevelopersObj.saveDirectDatabaseChanges()', 'style' => 'display: none;', 'class' => 'primary']]);
        $fieldSet->addField('inspector_mode', self::SELECT, ['name' => 'inspector_mode', 'label' => $this->__('Track Direct Database Changes'), 'values' => [['value' => 0, 'label' => $this->__('No')], ['value' => 1, 'label' => $this->__('Yes')]], 'value' => $inspectorMode, 'after_element_html' => '&nbsp;&nbsp;&nbsp;' . $button->toHtml()]);
        $this->setForm($form);
        return parent::_prepareForm();
    }
Exemplo n.º 4
0
 protected function _prepareForm()
 {
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'action' => 'javascript:void(0)', 'method' => 'post']]);
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 5
0
 protected function _prepareForm()
 {
     $template = $this->getHelper('Data\\GlobalData')->getValue('tmp_template');
     $formData = !is_null($template) ? array_merge($template->getData(), $template->getChildObject()->getData()) : [];
     $defaults = array('stop_status_disabled' => Synchronization::STOP_STATUS_DISABLED_YES, 'stop_out_off_stock' => Synchronization::STOP_OUT_OFF_STOCK_YES, 'stop_qty_magento' => Synchronization::STOP_QTY_NONE, 'stop_qty_magento_value' => '0', 'stop_qty_magento_value_max' => '10', 'stop_qty_calculated' => Synchronization::STOP_QTY_NONE, 'stop_qty_calculated_value' => '0', 'stop_qty_calculated_value_max' => '10');
     $formData = array_merge($defaults, $formData);
     $isEdit = !!$this->getRequest()->getParam('id');
     $form = $this->_formFactory->create();
     $form->addField('amazon_template_synchronization_stop', self::HELP_BLOCK, ['content' => $this->__('Stop Rules define the Conditions when Amazon Items Listing must be
 inactivated, depending on Magento Product state.<br/><br/>
 <b>Note:</b> If all Stop Conditions are set to <i>No</i> or <i>No Action</i>,
 then the Stop Option for Amazon Items is disabled.<br/>
 If all Stop Conditions are enabled, then an Item will be inactivated if at least one of the
 Stop Conditions is met.<br/><br/>
 More detailed information about ability to work with this Page you can find
 <a href="%url%" target="_blank">here</a>.', $this->getHelper('Module\\Support')->getDocumentationUrl(NULL, NULL, 'x/HIMVAQ'))]);
     $fieldset = $form->addFieldset('magento_block_ebay_template_synchronization_form_data_stop_rules', ['legend' => $this->__('Stop Conditions'), 'collapsable' => false]);
     $fieldset->addField('stop_status_disabled', 'select', ['name' => 'stop_status_disabled', 'label' => $this->__('Stop When Status Disabled'), 'value' => $formData['stop_status_disabled'], 'values' => [Synchronization::STOP_STATUS_DISABLED_NONE => $this->__('No'), Synchronization::STOP_STATUS_DISABLED_YES => $this->__('Yes')], 'tooltip' => $this->__('Automatically stops Item(s) if its status has been changed to \'Disabled\' in Magento.')]);
     $fieldset->addField('stop_out_off_stock', 'select', ['name' => 'stop_out_off_stock', 'label' => $this->__('Stop When Out Of Stock'), 'value' => $formData['stop_out_off_stock'], 'values' => [Synchronization::STOP_OUT_OFF_STOCK_NONE => $this->__('No'), Synchronization::STOP_OUT_OFF_STOCK_YES => $this->__('Yes')], 'tooltip' => $this->__('Automatically stops Item(s) if its Stock availability has been changed to \'Out of Stock\'
                 in Magento.')]);
     $fieldset->addField('stop_qty_magento', 'select', ['name' => 'stop_qty_magento', 'label' => $this->__('Stop When Magento Quantity Is'), 'value' => $formData['stop_qty_magento'], 'values' => [Synchronization::STOP_QTY_NONE => $this->__('No Action'), Synchronization::STOP_QTY_LESS => $this->__('Less or Equal'), Synchronization::STOP_QTY_BETWEEN => $this->__('Between')], 'tooltip' => $this->__('Automatically stops Item(s) if Magento Quantity has been changed and meets the Conditions.')])->addCustomAttribute('qty_type', 'magento');
     $fieldset->addField('stop_qty_magento_value', 'text', ['container_id' => 'stop_qty_magento_value_container', 'name' => 'stop_qty_magento_value', 'label' => $this->__('Quantity'), 'value' => $formData['stop_qty_magento_value'], 'class' => 'validate-digits', 'required' => true]);
     $fieldset->addField('stop_qty_magento_value_max', 'text', ['container_id' => 'stop_qty_magento_value_max_container', 'name' => 'stop_qty_magento_value_max', 'label' => $this->__('Max Quantity'), 'value' => $formData['stop_qty_magento_value_max'], 'class' => 'validate-digits M2ePro-validate-conditions-between', 'required' => true]);
     $fieldset->addField('stop_qty_calculated', 'select', ['name' => 'stop_qty_calculated', 'label' => $this->__('Stop When Calculated Quantity Is'), 'value' => $formData['stop_qty_calculated'], 'values' => [Synchronization::STOP_QTY_NONE => $this->__('No Action'), Synchronization::STOP_QTY_LESS => $this->__('Less or Equal'), Synchronization::STOP_QTY_BETWEEN => $this->__('Between')], 'tooltip' => $this->__('Automatically stops Item(s) if Calculated Quantity according to the Selling Format
                 Policy has been changed and meets the Conditions.')])->addCustomAttribute('qty_type', 'calculated');
     $fieldset->addField('stop_qty_calculated_value', 'text', ['container_id' => 'stop_qty_calculated_value_container', 'name' => 'stop_qty_calculated_value', 'label' => $this->__('Quantity'), 'value' => $formData['stop_qty_calculated_value'], 'class' => 'validate-digits', 'required' => true]);
     $fieldset->addField('stop_qty_calculated_value_max', 'text', ['container_id' => 'stop_qty_calculated_value_max_container', 'name' => 'stop_qty_calculated_value_max', 'label' => $this->__('Max Quantity'), 'value' => $formData['stop_qty_calculated_value_max'], 'class' => 'validate-digits M2ePro-validate-conditions-between', 'required' => true]);
     $jsFormData = ['stop_status_disabled', 'stop_out_off_stock', 'stop_qty_magento', 'stop_qty_magento_value', 'stop_qty_magento_value_max', 'stop_qty_calculated', 'stop_qty_calculated_value', 'stop_qty_calculated_value_max'];
     foreach ($jsFormData as $item) {
         $this->js->add("M2ePro.formData.{$item} = '{$this->getHelper('Data')->escapeJs($formData[$item])}';");
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 6
0
 protected function _prepareForm()
 {
     $defaultStoreId = $this->getHelper('Magento\\Store')->getDefaultStoreId();
     // ---------------------------------------
     $userId = $this->authSession->getUser()->getId();
     $userInfo = $this->user->load($userId)->getData();
     $tempPath = defined('Mage_Shipping_Model_Config::XML_PATH_ORIGIN_CITY') ? \Magento\Shipping\Model\Config::XML_PATH_ORIGIN_CITY : 'shipping/origin/city';
     $userInfo['city'] = $this->_storeManager->getStore($defaultStoreId)->getConfig($tempPath);
     $tempPath = defined('Mage_Shipping_Model_Config::XML_PATH_ORIGIN_POSTCODE') ? \Magento\Shipping\Model\Config::XML_PATH_ORIGIN_POSTCODE : 'shipping/origin/postcode';
     $userInfo['postal_code'] = $this->_storeManager->getStore($defaultStoreId)->getConfig($tempPath);
     $userInfo['country'] = $this->_storeManager->getStore($defaultStoreId)->getConfig('general/country/default');
     // ---------------------------------------
     $licenseFormData = $userInfo;
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'method' => 'post', 'action' => $this->getUrl('*/*/save')]]);
     $fieldSet = $form->addFieldset('create_new_license', ['legend' => '', 'collapsable' => false]);
     $fieldSet->addField('create_new_license_email', 'text', ['name' => 'email', 'label' => $this->__('Email'), 'title' => $this->__('Email'), 'value' => isset($licenseFormData['email']) ? $licenseFormData['email'] : '', 'required' => true]);
     $fieldSet->addField('create_new_license_firstname', 'text', ['name' => 'firstname', 'label' => $this->__('First Name'), 'title' => $this->__('First Name'), 'value' => isset($licenseFormData['firstname']) ? $licenseFormData['firstname'] : '', 'required' => true]);
     $fieldSet->addField('create_new_license_lastname', 'text', ['name' => 'lastname', 'label' => $this->__('Last Name'), 'title' => $this->__('Last Name'), 'value' => isset($licenseFormData['lastname']) ? $licenseFormData['lastname'] : '', 'required' => true]);
     $fieldSet->addField('create_new_license_country', self::SELECT, ['name' => 'country', 'label' => $this->__('Country'), 'title' => $this->__('Country'), 'values' => $this->country->toOptionArray(), 'value' => isset($licenseFormData['country']) ? $licenseFormData['country'] : '', 'required' => true]);
     $fieldSet->addField('create_new_license_city', 'text', ['name' => 'city', 'label' => $this->__('City'), 'title' => $this->__('City'), 'value' => isset($licenseFormData['city']) ? $licenseFormData['city'] : '', 'required' => true]);
     $fieldSet->addField('create_new_license_postal_code', 'text', ['name' => 'postal_code', 'label' => $this->__('Postal Code'), 'title' => $this->__('Postal Code'), 'value' => isset($licenseFormData['postal_code']) ? $licenseFormData['postal_code'] : '', 'required' => true]);
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 7
0
 protected function _prepareForm()
 {
     $form = $this->_formFactory->create(['data' => ['id' => 'variation_manager_sku_form', 'action' => 'javascript:void(0)', 'method' => 'post']]);
     $fieldset = $form->addFieldset('general_fieldset', []);
     $fieldset->addField('sku', 'text', ['name' => 'sku', 'label' => $this->__('SKU'), 'required' => true]);
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 8
0
 protected function _prepareForm()
 {
     $this->prepareGroupsGrid();
     $form = $this->_formFactory->create();
     $containerHtml = $this->getChildHtml('group_grid');
     $form->addField('custom_listing_auto_action_mode_category', 'Ess\\M2ePro\\Block\\Adminhtml\\Magento\\Form\\Element\\CustomContainer', ['text' => $containerHtml, 'field_extra_attributes' => 'style="width: 100%"']);
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 9
0
 protected function _prepareForm()
 {
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'method' => 'post', 'action' => 'javascript:void(0)']]);
     $fieldSet = $form->addFieldset('change_license', ['legend' => '', 'collapsable' => false]);
     $key = $this->getHelper('Data')->escapeHtml($this->getHelper('Module\\License')->getKey());
     $fieldSet->addField('new_license_key', 'text', ['name' => 'new_license_key', 'label' => $this->__('New License Key'), 'title' => $this->__('New License Key'), 'value' => $key, 'required' => true]);
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 10
0
    protected function _prepareForm()
    {
        $template = $this->getHelper('Data\\GlobalData')->getValue('tmp_template');
        $formData = !is_null($template) ? array_merge($template->getData(), $template->getChildObject()->getData()) : [];
        $defaults = array('relist_mode' => Synchronization::RELIST_MODE_YES, 'relist_filter_user_lock' => Synchronization::RELIST_FILTER_USER_LOCK_YES, 'relist_send_data' => Synchronization::RELIST_SEND_DATA_NONE, 'relist_status_enabled' => Synchronization::RELIST_STATUS_ENABLED_YES, 'relist_is_in_stock' => Synchronization::RELIST_IS_IN_STOCK_YES, 'relist_qty_magento' => Synchronization::RELIST_QTY_NONE, 'relist_qty_magento_value' => '1', 'relist_qty_magento_value_max' => '10', 'relist_qty_calculated' => Synchronization::RELIST_QTY_NONE, 'relist_qty_calculated_value' => '1', 'relist_qty_calculated_value_max' => '10');
        $formData = array_merge($defaults, $formData);
        $isEdit = !!$this->getRequest()->getParam('id');
        $form = $this->_formFactory->create();
        $form->addField('amazon_template_synchronization_general', self::HELP_BLOCK, ['content' => $this->__(<<<HTML
                    <p>If <strong>Relist Action</strong> is enabled and the specified conditions are met,
                    M2E Pro will relist Items that have been inactive on Amazon. 
                    (Relist Action will not list Items that have not been Listed yet)</p><br>
                    <p>If the Item does not get automatically Relisted (usually because of the errors returned 
                    by Amazon), M2E Pro will attempt to relist the Item again only if there is a change of 
                    Product Status, Stock Availability or Quantity in Magento.</p><br>
                    <p>More detailed information about how to work with this Page you can find 
                    <a href="%url%">here</a>.</p>
HTML
, $this->getHelper('Module\\Support')->getDocumentationUrl(NULL, NULL, 'x/SQItAQ'))]);
        $fieldset = $form->addFieldset('magento_block_amazon_template_synchronization_relist_filters', ['legend' => $this->__('General'), 'collapsable' => false]);
        $fieldset->addField('relist_mode', 'select', ['name' => 'relist_mode', 'label' => $this->__('Relist Action'), 'value' => $formData['relist_mode'], 'values' => [Synchronization::RELIST_MODE_NONE => $this->__('Disabled'), Synchronization::RELIST_MODE_YES => $this->__('Enabled')], 'tooltip' => $this->__('Enables/Disables the Relist Action for the Listings, which use current Synchronization Policy.')]);
        $fieldset->addField('relist_filter_user_lock', 'select', ['container_id' => 'relist_filter_user_lock_tr_container', 'name' => 'relist_filter_user_lock', 'label' => $this->__('Relist When Stopped Manually'), 'value' => $formData['relist_filter_user_lock'], 'values' => [Synchronization::RELIST_FILTER_USER_LOCK_YES => $this->__('No'), Synchronization::RELIST_FILTER_USER_LOCK_NONE => $this->__('Yes')], 'tooltip' => $this->__('Automatically Relists Item(s) even it has been Stopped manually within M2E Pro.')]);
        $fieldset->addField('relist_send_data', 'select', ['container_id' => 'relist_send_data_tr_container', 'name' => 'relist_send_data', 'label' => $this->__('Synchronize Data'), 'value' => $formData['relist_send_data'], 'values' => [Synchronization::RELIST_SEND_DATA_NONE => $this->__('No'), Synchronization::RELIST_SEND_DATA_YES => $this->__('Yes')], 'tooltip' => $this->__('<p><strong>No:</strong> Items are Relisted on eBay as per previously Listed Information and 
                    Settings, ignoring any changes that have been made in Magento. (Recommended)</p>
                    <p><strong>Yes:</strong> Any changes made to Items in Magento will be Reflected on Amazon 
                    Listings after they are Relisted.</p>')]);
        $fieldset = $form->addFieldset('magento_block_amazon_template_synchronization_relist_rules', ['legend' => $this->__('Relist Conditions'), 'collapsable' => false]);
        $fieldset->addField('relist_status_enabled', 'select', ['name' => 'relist_status_enabled', 'label' => $this->__('Product Status'), 'value' => $formData['relist_status_enabled'], 'values' => [Synchronization::RELIST_STATUS_ENABLED_NONE => $this->__('Any'), Synchronization::RELIST_STATUS_ENABLED_YES => $this->__('Enabled')], 'class' => 'M2ePro-validate-stop-relist-conditions-product-status', 'tooltip' => $this->__('<p><strong>Enabled:</strong> List Items on Amazon automatically if they have status Enabled 
                    in Magento Product. (Recommended)</p> 
                    <p><strong>Any:</strong> List Items with any Magento Product status on Amazon automatically.</p>')]);
        $fieldset->addField('relist_is_in_stock', 'select', ['name' => 'relist_is_in_stock', 'label' => $this->__('Stock Availability'), 'value' => $formData['relist_is_in_stock'], 'values' => [Synchronization::RELIST_IS_IN_STOCK_NONE => $this->__('Any'), Synchronization::RELIST_IS_IN_STOCK_YES => $this->__('In Stock')], 'class' => 'M2ePro-validate-stop-relist-conditions-stock-availability', 'tooltip' => $this->__('<p><strong>In Stock:</strong> List Items automatically if Products are in Stock. 
                    (Recommended.)</p>
                    <p><strong>Any:</strong> List Items automatically, regardless of Stock availability.</p>')]);
        $fieldset->addField('relist_qty_magento', 'select', ['name' => 'relist_qty_magento', 'label' => $this->__('Magento Quantity'), 'value' => $formData['relist_qty_magento'], 'values' => [Synchronization::RELIST_QTY_NONE => $this->__('Any'), Synchronization::RELIST_QTY_MORE => $this->__('More or Equal'), Synchronization::RELIST_QTY_BETWEEN => $this->__('Between')], 'class' => 'M2ePro-validate-stop-relist-conditions-item-qty', 'tooltip' => $this->__('<p><strong>Any:</strong> List Items automatically with any Quantity available.</p>
                    <p><strong>More or Equal:</strong> List Items automatically if the Quantity available in 
                    Magento is at least equal to the number you set. (Recommended)</p>
                    <p><strong>Between:</strong> List Items automatically if the Quantity available in Magento is
                    between the minimum and maximum numbers you set.</p>')])->addCustomAttribute('qty_type', 'magento');
        $fieldset->addField('relist_qty_magento_value', 'text', ['container_id' => 'relist_qty_magento_value_container', 'name' => 'relist_qty_magento_value', 'label' => $this->__('Quantity'), 'value' => $formData['relist_qty_magento_value'], 'class' => 'validate-digits', 'required' => true]);
        $fieldset->addField('relist_qty_magento_value_max', 'text', ['container_id' => 'relist_qty_magento_value_max_container', 'name' => 'relist_qty_magento_value_max', 'label' => $this->__('Max Quantity'), 'value' => $formData['relist_qty_magento_value_max'], 'class' => 'validate-digits M2ePro-validate-conditions-between', 'required' => true]);
        $fieldset->addField('relist_qty_calculated', 'select', ['name' => 'relist_qty_calculated', 'label' => $this->__('Calculated Quantity'), 'value' => $formData['relist_qty_calculated'], 'values' => [Synchronization::RELIST_QTY_NONE => $this->__('Any'), Synchronization::RELIST_QTY_MORE => $this->__('More or Equal'), Synchronization::RELIST_QTY_BETWEEN => $this->__('Between')], 'class' => 'M2ePro-validate-stop-relist-conditions-item-qty', 'tooltip' => $this->__('<p><strong>Any:</strong> List Items automatically with any Quantity available.</p>
                    <p><strong>More or Equal:</strong> List Items automatically if the calculated Quantity is at
                    least equal to the number you set, according to the Price, Quantity and Format Policy. 
                    (Recommended)</p>
                    <p><strong>Between:</strong> List Items automatically if the Quantity is between the minimum 
                    and maximum numbers you set, according to the Price, Quantity and Format Policy.</p>')])->addCustomAttribute('qty_type', 'calculated');
        $fieldset->addField('relist_qty_calculated_value', 'text', ['container_id' => 'relist_qty_calculated_value_container', 'name' => 'relist_qty_calculated_value', 'label' => $this->__('Quantity'), 'value' => $formData['relist_qty_calculated_value'], 'class' => 'validate-digits', 'required' => true]);
        $fieldset->addField('relist_qty_calculated_value_max', 'text', ['container_id' => 'relist_qty_calculated_value_max_container', 'name' => 'relist_qty_calculated_value_max', 'label' => $this->__('Max Quantity'), 'value' => $formData['relist_qty_calculated_value_max'], 'class' => 'validate-digits M2ePro-validate-conditions-between', 'required' => true]);
        $jsFormData = ['relist_mode', 'relist_status_enabled', 'relist_is_in_stock', 'relist_qty_magento', 'relist_qty_magento_value', 'relist_qty_magento_value_max', 'relist_qty_calculated', 'relist_qty_calculated_value', 'relist_qty_calculated_value_max'];
        foreach ($jsFormData as $item) {
            $this->js->add("M2ePro.formData.{$item} = '{$this->getHelper('Data')->escapeJs($formData[$item])}';");
        }
        $this->setForm($form);
        return parent::_prepareForm();
    }
Exemplo n.º 11
0
 protected function _prepareForm()
 {
     $form = $this->_formFactory->create();
     $fieldSet = $form->addFieldset('field_module', ['legend' => $this->__('Module'), 'collapsable' => false]);
     $fieldSet->addField('m2e_version', 'note', ['label' => $this->__('Version'), 'text' => $this->getHelper('Module')->getVersion()]);
     $fieldSet->addField('m2e_revision', 'note', ['label' => $this->__('Revision'), 'text' => $this->getHelper('Module')->getRevision()]);
     $fieldSet = $form->addFieldset('field_magento', ['legend' => $this->__('Magento'), 'collapsable' => false]);
     $fieldSet->addField('magento_edition', 'note', ['label' => $this->__('Edition'), 'text' => ucfirst($this->getHelper('Magento')->getEditionName())]);
     $fieldSet->addField('magento_version', 'note', ['label' => $this->__('Version'), 'text' => $this->getHelper('Magento')->getVersion()]);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 12
0
 protected function _prepareForm()
 {
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form']]);
     $fieldset = $form->addFieldset('accounts', []);
     $url = 'https://scgi.ebay.com/ws/eBayISAPI.dll?RegisterEnterInfo&bizflow=2';
     $fieldset->addField('message', self::MESSAGES, ['messages' => [['type' => \Magento\Framework\Message\MessageInterface::TYPE_NOTICE, 'content' => $this->__('If you do not have an existing account, you can click
                         <a href="%url%" target="_blank">here</a> to register one.', $url)]]]);
     $fieldset->addField('mode', 'radios', ['label' => $this->__('What the Type of Account do You Want to Onboard?'), 'css_class' => 'account-mode-choose', 'name' => 'mode', 'values' => [['value' => 'production', 'label' => $this->__('Live Account')], ['value' => 'sandbox', 'label' => $this->__('Sandbox Account')], ['value' => '', 'label' => '']], 'value' => 'production']);
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 13
0
 protected function _prepareForm()
 {
     $template = $this->getHelper('Data\\GlobalData')->getValue('tmp_template');
     $formData = !is_null($template) ? array_merge($template->getData(), $template->getChildObject()->getData()) : ['title' => ''];
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'method' => 'post', 'action' => $this->getUrl('*/*/save'), 'enctype' => 'multipart/form-data']]);
     $fieldset = $form->addFieldset('magento_block_amazon_template_synchronization_general_general', ['legend' => $this->__('General'), 'collapsable' => false]);
     $fieldset->addField('title', 'text', ['name' => 'title', 'label' => $this->__('Title'), 'value' => $formData['title'], 'class' => 'M2ePro-synchronization-tpl-title', 'tooltip' => $this->__('Short meaningful Policy Title for your internal use.'), 'required' => true]);
     $dataBlock = $this->createBlock('Amazon\\Template\\Synchronization\\Edit\\Data');
     $form->addField('container_html', self::CUSTOM_CONTAINER, ['text' => $dataBlock->toHtml()]);
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 14
0
 protected function _prepareForm()
 {
     $templateModel = $this->getHelper('Data\\GlobalData')->getValue('tmp_template')->getData();
     $formData = !empty($templateModel) ? $templateModel : ['title' => ''];
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'method' => 'post', 'action' => $this->getUrl('*/*/save'), 'enctype' => 'multipart/form-data']]);
     $fieldSet = $form->addFieldset('magento_block_template_description_edit_main_general', ['legend' => $this->__('General'), 'collapsable' => false]);
     $fieldSet->addField('title', 'text', ['name' => 'general[title]', 'label' => $this->__('Title'), 'title' => $this->__('Title'), 'value' => $formData['title'], 'class' => 'input-text M2ePro-description-template-title', 'required' => true, 'tooltip' => $this->__('Short meaningful Policy Title for your internal use.')]);
     $dataBlock = $this->createBlock('Amazon\\Template\\Description\\Edit\\Data');
     $form->addField('content_html', self::CUSTOM_CONTAINER, ['text' => $dataBlock->toHtml()]);
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 15
0
    protected function _prepareForm()
    {
        $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'method' => 'post', 'enctype' => 'multipart/form-data']]);
        $fieldset = $form->addFieldset('contact_us', []);
        $fieldset->addField('subject', 'text', ['name' => 'subject', 'required' => true, 'label' => $this->__('Subject')]);
        $fieldset->addField('contact_name', 'text', ['name' => 'contact_name', 'required' => true, 'label' => $this->__('Contact Name')]);
        $fieldset->addField('contact_mail', 'text', ['name' => 'contact_mail', 'required' => true, 'class' => 'M2ePro-validate-email', 'label' => $this->__('Contact Email')]);
        if ($this->getHelper('Module\\Support')->isTypePremium()) {
            $fieldset->addField('severity', 'select', ['name' => 'severity', 'label' => $this->__('Severity'), 'values' => ['minor' => $this->__('Minor'), 'important' => $this->__('Important'), 'critical' => $this->__('Critical')]]);
        }
        $values = ['none' => $this->__('General Issue')];
        if ($this->getHelper('Component\\Ebay')->isEnabled()) {
            $values[\Ess\M2ePro\Helper\Component\Ebay::NICK] = $this->getHelper('Component\\Ebay')->getChannelTitle() . ' ' . $this->__('Issue');
        }
        if ($this->getHelper('Component\\Amazon')->isEnabled()) {
            $values[\Ess\M2ePro\Helper\Component\Amazon::NICK] = $this->getHelper('Component\\Amazon')->getChannelTitle() . ' ' . $this->__('Issue');
        }
        $referrer = $this->getRequest()->getParam('referrer', false);
        if (count($values) > 1 && !$referrer) {
            $fieldset->addField('component', 'select', ['name' => 'component', 'label' => $this->__('Problem Type'), 'values' => $values, 'value' => 'none']);
        } else {
            $fieldset->addField('component', 'hidden', ['name' => 'component', 'value' => $referrer]);
        }
        $fieldset->addField('description', 'textarea', ['label' => $this->__('Description'), 'name' => 'description', 'style' => 'height: 250px', 'value' => <<<TEXT
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


Please provide any additional information below.
TEXT
]);
        $fieldset->addField('files', 'file', ['css_class' => 'no-margin-bottom', 'container_id' => 'more_button_container', 'label' => $this->__('Attachment'), 'name' => 'files[]', 'onchange' => 'SupportObj.toggleMoreButton()', 'style' => 'margin-top: 5px']);
        $fieldset->addField('more_attachments', 'button', ['container_id' => 'more_attachments_container', 'label' => '', 'value' => $this->__('Attach Another File'), 'class' => 'action-default', 'onclick' => 'SupportObj.moreAttachments()']);
        $fieldset->addField('send_button', 'button', ['label' => '', 'value' => $this->__('Submit'), 'class' => 'action-primary right', 'onclick' => 'SupportObj.saveClick()']);
        $this->jsUrl->add($this->getUrl('*/support/save'), 'formSubmit');
        $this->js->add(<<<JS
    require([
        'M2ePro/Support',
    ], function(){
        window.SupportObj = new Support();
    });
JS
);
        $form->setUseContainer(true);
        $this->setForm($form);
        return parent::_prepareForm();
    }
Exemplo n.º 16
0
 protected function _prepareForm()
 {
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form']]);
     $fieldset = $form->addFieldset('block_notice_wizard_installation_step_license', ['legend' => '']);
     $fieldset->addField('form_email', 'text', ['name' => 'email', 'label' => $this->__('Email'), 'value' => $this->getUserInfoValue('email'), 'required' => true, 'disabled' => $this->getData('isLicenseStepFinished')]);
     $fieldset->addField('first_name', 'text', ['name' => 'firstname', 'label' => $this->__('First Name'), 'value' => $this->getUserInfoValue('firstname'), 'required' => true, 'disabled' => $this->getData('isLicenseStepFinished')]);
     $fieldset->addField('last_name', 'text', ['name' => 'lastname', 'label' => $this->__('Last Name'), 'value' => $this->getUserInfoValue('lastname'), 'required' => true, 'disabled' => $this->getData('isLicenseStepFinished')]);
     $fieldset->addField('country', 'select', ['name' => 'country', 'label' => $this->__('Country'), 'value' => $this->getUserInfoValue('country'), 'values' => $this->getData('available_countries'), 'required' => true, 'disabled' => $this->getData('isLicenseStepFinished')]);
     $fieldset->addField('city', 'text', ['name' => 'city', 'label' => $this->__('City'), 'value' => $this->getUserInfoValue('city'), 'required' => true, 'disabled' => $this->getData('isLicenseStepFinished')]);
     $fieldset->addField('postal_code', 'text', ['name' => 'postal_code', 'label' => $this->__('Postal Code'), 'value' => $this->getUserInfoValue('postal_code'), 'required' => true, 'disabled' => $this->getData('isLicenseStepFinished')]);
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 17
0
 protected function _prepareForm()
 {
     $global = $this->getHelper('Data\\GlobalData');
     $listing = $global->getValue('edit_listing');
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'action' => 'javascript:void(0)', 'method' => 'post']]);
     $form->addField('id', 'hidden', ['name' => 'id']);
     $fieldset = $form->addFieldset('edit_listing_fieldset', []);
     $fieldset->addField('title', 'text', ['name' => 'title', 'class' => 'validate-no-empty M2ePro-listing-title', 'label' => $this->__('Title'), 'field_extra_attributes' => 'style="margin-bottom: 0;"']);
     if ($listing) {
         $form->addValues($listing->getData());
     }
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 18
0
 protected function _prepareForm()
 {
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form']]);
     $fieldset = $form->addFieldset('accounts', []);
     $marketplacesCollection = $this->amazonFactory->getObject('Marketplace')->getCollection()->addFieldToFilter('developer_key', array('notnull' => true))->setOrder('sorder', 'ASC');
     $marketplaces = [['value' => '', 'label' => '']];
     foreach ($marketplacesCollection->getItems() as $item) {
         $marketplace = array_merge($item->getData(), $item->getChildObject()->getData());
         $marketplaces[$marketplace['id']] = $marketplace['title'];
     }
     $fieldset->addField('marketplace_id', 'select', ['label' => $this->__('What the Marketplace do You Want to Onboard?'), 'css_class' => 'account-mode-choose', 'name' => 'marketplace_id', 'values' => $marketplaces]);
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 19
0
 protected function _prepareForm()
 {
     if ($this->getData('nick') == '') {
         throw new \Ess\M2ePro\Model\Exception\Logic('You should set template "nick"');
     }
     $form = $this->_formFactory->create(['data' => ['id' => 'new_template_form_' . $this->getData('nick'), 'action' => 'javascript:void(0)', 'method' => 'post']]);
     $form->addField('new_template_form_help_block', self::HELP_BLOCK, ['content' => $this->__('<p>Saving Policy under a distinctive title will let you easily and quickly search for 
                 it in case you need to use it in a different M2E Pro Listing in the future.</p><br>
                 <p>More detailed information you can find 
                 <a href="%url%" target="_blank">here</a>.</p>', $this->getHelper('Module\\Support')->getDocumentationUrl(NULL, NULL, 'x/8wItAQ'))]);
     $fieldset = $form->addFieldset('new_template_fieldset', []);
     $fieldset->addField('template_title_' . $this->getData('nick'), 'text', ['name' => $this->getData('nick') . '[template_title]', 'class' => 'M2ePro-validate-ebay-template-title', 'label' => $this->__('Title'), 'placeholder' => $this->__('Please specify Policy Title'), 'required' => true]);
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 20
0
 protected function _prepareForm()
 {
     $form = $this->_formFactory->create();
     $form->addField('show', 'hidden', ['name' => 'show', 'value' => 1]);
     $fieldset = $form->addFieldset('magento_block_ebay_template_description_form', ['legend' => $this->__('Select Product')]);
     if ($errorMessage = $this->getData('error_message')) {
         $fieldset->addField('messages', self::MESSAGES, ['messages' => [['type' => MessageInterface::TYPE_ERROR, 'content' => $errorMessage]]]);
     }
     $viewButton = $this->createBlock('Magento\\Button')->addData(['label' => $this->__('View'), 'type' => 'submit']);
     $randomButton = $this->createBlock('Magento\\Button')->addData(['label' => $this->__('View Random Product'), 'type' => 'submit', 'onclick' => '$(\'product_id\').value = \'\'; return true;']);
     $fieldset->addField('product_id', 'text', ['name' => 'id', 'value' => $this->getData('product_id'), 'label' => $this->__('Enter Product Id'), 'after_element_html' => $viewButton->toHtml() . $this->__('or') . $randomButton->toHtml()]);
     $fieldset->addField('store_id', self::STORE_SWITCHER, ['value' => $this->getData('store_id')]);
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 21
0
 protected function _prepareForm()
 {
     $form = $this->_formFactory->create();
     $form->addField('auto_mode', 'hidden', ['name' => 'auto_mode', 'value' => \Ess\M2ePro\Model\Listing::AUTO_MODE_WEBSITE]);
     $fieldSet = $form->addFieldset('auto_website_fieldset_container', []);
     $fieldSet->addField('auto_website_adding_mode', self::SELECT, ['name' => 'auto_website_adding_mode', 'label' => $this->__('Product Added to Website'), 'title' => $this->__('Product Added to Website'), 'values' => [['value' => \Ess\M2ePro\Model\Listing::ADDING_MODE_NONE, 'label' => $this->__('No Action')], ['value' => \Ess\M2ePro\Model\Listing::ADDING_MODE_ADD, 'label' => $this->__('Add to the Listing')]], 'value' => $this->formData['auto_website_adding_mode'], 'tooltip' => $this->__('You need to provide additional settings for Magento Products to be listed automatically.'), 'style' => 'width: 350px']);
     $fieldSet->addField('auto_website_adding_add_not_visible', self::SELECT, ['name' => 'auto_website_adding_add_not_visible', 'label' => $this->__('Add not Visible Individually Products'), 'title' => $this->__('Add not Visible Individually Products'), 'values' => [['value' => \Ess\M2ePro\Model\Listing::AUTO_ADDING_ADD_NOT_VISIBLE_NO, 'label' => $this->__('No')], ['value' => \Ess\M2ePro\Model\Listing::AUTO_ADDING_ADD_NOT_VISIBLE_YES, 'label' => $this->__('Yes')]], 'value' => $this->formData['auto_website_adding_add_not_visible'], 'field_extra_attributes' => 'id="auto_website_adding_add_not_visible_field"', 'tooltip' => $this->__('Set to <strong>Yes</strong> if you want the Magento Products with
                 Visibility \'Not visible Individually\' to be added to the Listing
                 Automatically.<br/>
                 If set to <strong>No</strong>, only Variation (i.e.
                 Parent) Magento Products will be added to the Listing Automatically,
                 excluding Child Products.')]);
     $fieldSet->addField('auto_website_deleting_mode', self::SELECT, ['name' => 'auto_website_deleting_mode', 'label' => $this->__('Product Deleted from Magento'), 'title' => $this->__('Product Deleted from Magento'), 'values' => [['value' => \Ess\M2ePro\Model\Listing::DELETING_MODE_NONE, 'label' => $this->__('No Action')], ['value' => \Ess\M2ePro\Model\Listing::DELETING_MODE_STOP, 'label' => $this->__('Stop on Channel')], ['value' => \Ess\M2ePro\Model\Listing::DELETING_MODE_STOP_REMOVE, 'label' => $this->__('Stop on Channel and Delete from Listing')]], 'value' => $this->formData['auto_website_deleting_mode'], 'style' => 'width: 350px']);
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 22
0
 protected function _prepareForm()
 {
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'method' => 'post']]);
     $form->addField('source_help_block', self::HELP_BLOCK, ['content' => $this->__('<p>After an M2E Pro listing is successfully configured and created, Magento Products should
                 be added into it. <br> The Products you add to the Listing will further be Listed on eBay.</p><br>
                 <p>There are several different options of how Magento products can be found/selected 
                 and added to the Listing.</p><br>
                 <p>More detailed information you can find <a href="%url%" target="_blank">here</a>.</p>', $this->getHelper('Module\\Support')->getDocumentationUrl(NULL, NULL, 'x/dwItAQ'))]);
     $fieldset = $form->addFieldset('source_mode', []);
     $defaultSource = $this->getRequest()->getParam('source', \Ess\M2ePro\Block\Adminhtml\Ebay\Listing\Product\Add\SourceMode::MODE_PRODUCT);
     $fieldset->addField('block-title', 'label', ['value' => $this->__('Choose how you want to display Products for selection'), 'field_extra_attributes' => 'style="font-weight: bold;font-size:18px;margin-bottom:0px"']);
     $fieldset->addField('source1', 'radios', ['name' => 'source', 'field_extra_attributes' => 'style="margin: 4px 0 0 0; font-weight: bold"', 'values' => [['value' => \Ess\M2ePro\Block\Adminhtml\Ebay\Listing\Product\Add\SourceMode::MODE_PRODUCT, 'label' => 'Products List']], 'value' => $defaultSource, 'note' => '<div style="padding-top: 3px; padding-left: 26px; font-weight: normal">' . $this->__('Products displayed as a list without any grouping.') . '</div>']);
     $fieldset->addField('source2', 'radios', ['name' => 'source', 'field_extra_attributes' => 'style="margin: 4px 0 0 0; font-weight: bold"', 'values' => [['value' => \Ess\M2ePro\Block\Adminhtml\Ebay\Listing\Product\Add\SourceMode::MODE_CATEGORY, 'label' => 'Categories']], 'value' => $defaultSource, 'note' => '<div style="padding-top: 3px; padding-left: 26px; font-weight: normal">' . $this->__('Products grouped by Magento Categories.') . '</div>']);
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 23
0
 protected function _prepareForm()
 {
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form']]);
     $form->addField('group_id', 'hidden', ['name' => 'id', 'value' => $this->formData['id']]);
     $form->addField('auto_mode', 'hidden', ['name' => 'auto_mode', 'value' => \Ess\M2ePro\Model\Listing::AUTO_MODE_CATEGORY]);
     $fieldSet = $form->addFieldset('category_form_container_field', []);
     $fieldSet->addField('group_title', 'text', ['name' => 'title', 'label' => $this->__('Title'), 'title' => $this->__('Title'), 'class' => 'M2ePro-required-when-visible M2ePro-validate-category-group-title', 'value' => $this->getHelper('Data')->escapeHtml($this->formData['title']), 'required' => true]);
     $fieldSet->addField('adding_mode', 'Ess\\M2ePro\\Block\\Adminhtml\\Magento\\Form\\Element\\Select', ['name' => 'adding_mode', 'label' => $this->__('Product Assigned to Categories'), 'title' => $this->__('Product Assigned to Categories'), 'values' => [['label' => $this->__('No Action'), 'value' => \Ess\M2ePro\Model\Listing::ADDING_MODE_NONE], ['label' => $this->__('Add to the Listing'), 'value' => \Ess\M2ePro\Model\Listing::ADDING_MODE_ADD]], 'value' => $this->formData['adding_mode'], 'tooltip' => $this->__('You need to provide additional settings for Magento Products to be listed automatically.'), 'style' => 'width: 350px']);
     $fieldSet->addField('adding_add_not_visible', 'Ess\\M2ePro\\Block\\Adminhtml\\Magento\\Form\\Element\\Select', ['name' => 'adding_add_not_visible', 'label' => $this->__('Add not Visible Individually Products'), 'title' => $this->__('Add not Visible Individually Products'), 'values' => [['label' => $this->__('No'), 'value' => \Ess\M2ePro\Model\Listing::AUTO_ADDING_ADD_NOT_VISIBLE_NO], ['label' => $this->__('Yes'), 'value' => \Ess\M2ePro\Model\Listing::AUTO_ADDING_ADD_NOT_VISIBLE_YES]], 'value' => $this->formData['adding_add_not_visible'], 'field_extra_attributes' => 'id="adding_add_not_visible_field"', 'tooltip' => $this->__('Set to <strong>Yes</strong> if you want the Magento Products with
                 Visibility \'Not visible Individually\' to be added to the Listing
                 Automatically.<br/>
                 If set to <strong>No</strong>, only Variation (i.e.
                 Parent) Magento Products will be added to the Listing Automatically,
                 excluding Child Products.')]);
     $fieldSet->addField('deleting_mode', 'Ess\\M2ePro\\Block\\Adminhtml\\Magento\\Form\\Element\\Select', ['name' => 'deleting_mode', 'label' => $this->__('Product Deleted from Categories'), 'title' => $this->__('Product Deleted from Categories'), 'values' => [['label' => $this->__('No Action'), 'value' => \Ess\M2ePro\Model\Listing::DELETING_MODE_NONE], ['label' => $this->__('Stop on Channel'), 'value' => \Ess\M2ePro\Model\Listing::DELETING_MODE_STOP], ['label' => $this->__('Stop on Channel and Delete from Listing'), 'value' => \Ess\M2ePro\Model\Listing::DELETING_MODE_STOP_REMOVE]], 'value' => $this->formData['deleting_mode'], 'style' => 'width: 350px']);
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 24
0
    protected function _prepareForm()
    {
        /** @var \Ess\M2ePro\Model\Ebay\Order $order */
        $order = $this->getHelper('Data\\GlobalData')->getValue('order')->getChildObject();
        $buyerEmail = $order->getData('buyer_email');
        if (stripos($buyerEmail, 'Invalid Request') !== false) {
            $buyerEmail = '';
        }
        try {
            $regionCode = $order->getShippingAddress()->getRegionCode();
        } catch (\Exception $e) {
            $regionCode = null;
        }
        $address = $order->getShippingAddress()->getData();
        $form = $this->_formFactory->create(['data' => ['id' => 'edit_form']]);
        $fieldset = $form->addFieldset('order_address_info', ['legend' => $this->__('Order Address Information')]);
        $fieldset->addField('buyer_name', 'text', ['name' => 'buyer_name', 'label' => $this->__('Buyer Name'), 'value' => $this->getHelper('Data')->escapeHtml($order->getData('buyer_name')), 'required' => true]);
        $fieldset->addField('buyer_email', 'text', ['name' => 'buyer_email', 'label' => $this->__('Buyer Email'), 'value' => $this->getHelper('Data')->escapeHtml($buyerEmail), 'required' => true]);
        $fieldset->addField('street_0', 'text', ['name' => 'street[0]', 'label' => $this->__('Street Address'), 'value' => isset($address['street'][0]) ? $this->getHelper('Data')->escapeHtml($address['street'][0]) : '', 'required' => true]);
        $fieldset->addField('street_1', 'text', ['name' => 'street[1]', 'label' => '', 'value' => isset($address['street'][1]) ? $this->getHelper('Data')->escapeHtml($address['street'][1]) : '']);
        $fieldset->addField('city', 'text', ['name' => 'city', 'label' => $this->__('City'), 'value' => $this->getHelper('Data')->escapeHtml($address['city']), 'required' => true]);
        $fieldset->addField('country_code', 'select', ['name' => 'country_code', 'label' => $this->__('Country'), 'values' => $this->getHelper('Magento')->getCountries(), 'value' => $address['country_code'], 'required' => true]);
        $fieldset->addField('state', 'text', ['container_id' => 'state_td', 'label' => $this->__('Region/State')]);
        $fieldset->addField('postal_code', 'text', ['name' => 'postal_code', 'label' => $this->__('Zip/Postal Code'), 'value' => $this->getHelper('Data')->escapeHtml($address['postal_code'])]);
        $fieldset->addField('phone', 'text', ['name' => 'phone', 'label' => $this->__('Telephone'), 'value' => $this->getHelper('Data')->escapeHtml($address['phone'])]);
        $form->setUseContainer(true);
        $this->setForm($form);
        $this->jsUrl->addUrls($this->getHelper('Data')->getControllerActions('Order'));
        $this->jsUrl->add($this->getUrl('*/ebay_order/saveShippingAddress', array('order_id' => $this->getRequest()->getParam('id'))), 'formSubmit');
        $this->js->add("M2ePro.formData.region = '" . $this->getHelper('Data')->escapeJs($regionCode) . "';");
        $this->js->add(<<<JS
    require([
        'M2ePro/Order/Edit/ShippingAddress',
    ], function(){
        window.OrderEditShippingAddressObj = new OrderEditShippingAddress('country_code', 'state_td', 'state');
        OrderEditShippingAddressObj.initObservers();
    });
JS
);
        return parent::_prepareForm();
    }
Exemplo n.º 25
0
    protected function _prepareForm()
    {
        $form = $this->_formFactory->create(['data' => ['id' => 'categories_mode_form', 'method' => 'post']]);
        $fieldset = $form->addFieldset('categories_mode', []);
        $fieldset->addField('block-title', 'label', ['value' => $this->__('You need to choose eBay Categories for Products in order to list them on eBay.'), 'field_extra_attributes' => 'id="categories_mode_block_title" style="font-weight: bold;font-size:18px;margin-bottom:0px"']);
        $this->css->add(<<<CSS
    #categories_mode_block_title .admin__field-control{
        width: 90%;
    }
CSS
);
        $fieldset->addField('block-notice', 'label', ['value' => $this->__('Choose one of the Options below.'), 'field_extra_attributes' => 'style="margin-bottom: 0;"']);
        $fieldset->addField('mode1', 'radios', ['name' => 'mode', 'field_extra_attributes' => 'style="margin: 4px 0 0 0; font-weight: bold"', 'values' => [['value' => 'same', 'label' => 'All Products same Category']], 'note' => '<div style="padding-top: 3px; padding-left: 26px; font-weight: normal">' . $this->__('Products will be Listed using the same eBay Category.') . '</div>']);
        $fieldset->addField('mode_same_remember_checkbox', 'checkbox', ['name' => 'mode_same_remember_checkbox', 'after_element_html' => '&nbsp;&nbsp; <span style="color: #808080; font-size: 1.2rem; vertical-align: top;">' . $this->__('Remember my choice and skip this step in the future.') . '</span>', 'value' => 1, 'checked' => false, 'disabled' => true, 'field_extra_attributes' => 'style="margin-top: 2px; margin-bottom: 0; padding-left: 56px;"']);
        $fieldset->addField('mode2', 'radios', ['name' => 'mode', 'field_extra_attributes' => 'style="margin: 4px 0 0 0; font-weight: bold"', 'values' => [['value' => 'category', 'label' => 'Based on Magento Categories']], 'note' => '<div style="padding-top: 3px; padding-left: 26px; font-weight: normal">' . $this->__('Products will have eBay Categories set according to the Magento Categories.') . '</div>']);
        $fieldset->addField('mode3', 'radios', ['name' => 'mode', 'field_extra_attributes' => 'style="margin: 4px 0 0 0; font-weight: bold"', 'values' => [['value' => 'product', 'label' => 'Get suggested Categories']], 'note' => '<div style="padding-top: 3px; padding-left: 26px; font-weight: normal">' . $this->__('Get eBay to suggest Categories for your Products based on the Title and Magento Attribute set.') . '</div>']);
        $fieldset->addField('mode4', 'radios', ['name' => 'mode', 'field_extra_attributes' => 'style="margin: 4px 0 0 0; font-weight: bold"', 'values' => [['value' => 'manually', 'label' => 'Set Manually for each Product']], 'note' => '<div style="padding-top: 3px; padding-left: 26px; font-weight: normal">' . $this->__('Set eBay Categories for each Product (or a group of Products) manually.') . '</div>']);
        $form->setUseContainer(true);
        $this->setForm($form);
        return parent::_prepareForm();
    }
Exemplo n.º 26
0
    protected function _prepareForm()
    {
        $account = $this->getHelper('Data\\GlobalData')->getValue('temp_data');
        $websites = $this->getHelper('Magento\\Store\\Website')->getWebsites(true);
        // ---------------------------------------
        // ---------------------------------------
        $temp = $this->customerGroup->getCollection()->toArray();
        $groups = $temp['items'];
        // ---------------------------------------
        // ---------------------------------------
        $productTaxClasses = $this->taxClass->getCollection()->addFieldToFilter('class_type', \Magento\Tax\Model\ClassModel::TAX_CLASS_TYPE_CUSTOMER)->toOptionArray();
        $none = array('value' => \Ess\M2ePro\Model\Magento\Product::TAX_CLASS_ID_NONE, 'label' => $this->__('None'));
        array_unshift($productTaxClasses, $none);
        // ---------------------------------------
        // TODO NOT SUPPORTED FEATURES
        //        $this->isStorePickupEnabled = $account->getChildObject()->isPickupStoreEnabled();
        $formData = !is_null($account) ? array_merge($account->getData(), $account->getChildObject()->getData()) : [];
        $formData['magento_orders_settings'] = !empty($formData['magento_orders_settings']) ? json_decode($formData['magento_orders_settings'], true) : array();
        $defaults = array('magento_orders_settings' => array('listing' => array('mode' => Account::MAGENTO_ORDERS_LISTINGS_MODE_YES, 'store_mode' => Account::MAGENTO_ORDERS_LISTINGS_STORE_MODE_DEFAULT, 'store_id' => NULL), 'listing_other' => array('mode' => Account::MAGENTO_ORDERS_LISTINGS_OTHER_MODE_YES, 'product_mode' => Account::MAGENTO_ORDERS_LISTINGS_OTHER_PRODUCT_MODE_IMPORT, 'product_tax_class_id' => \Ess\M2ePro\Model\Magento\Product::TAX_CLASS_ID_NONE, 'store_id' => NULL), 'number' => array('source' => Account::MAGENTO_ORDERS_NUMBER_SOURCE_MAGENTO, 'prefix' => array('mode' => Account::MAGENTO_ORDERS_NUMBER_PREFIX_MODE_NO, 'prefix' => '')), 'customer' => array('mode' => Account::MAGENTO_ORDERS_CUSTOMER_MODE_GUEST, 'id' => NULL, 'website_id' => NULL, 'group_id' => NULL, 'notifications' => array('invoice_created' => false, 'order_created' => false)), 'creation' => array('mode' => Account::MAGENTO_ORDERS_CREATE_CHECKOUT_AND_PAID, 'reservation_days' => 0), 'tax' => array('mode' => Account::MAGENTO_ORDERS_TAX_MODE_MIXED), 'in_store_pickup_statuses' => array('mode' => 0, 'ready_for_pickup' => '', 'picked_up' => ''), 'status_mapping' => array('mode' => Account::MAGENTO_ORDERS_STATUS_MAPPING_MODE_DEFAULT, 'new' => Account::MAGENTO_ORDERS_STATUS_MAPPING_NEW, 'paid' => Account::MAGENTO_ORDERS_STATUS_MAPPING_PAID, 'shipped' => Account::MAGENTO_ORDERS_STATUS_MAPPING_SHIPPED), 'qty_reservation' => array('days' => 1), 'invoice_mode' => Account::MAGENTO_ORDERS_INVOICE_MODE_YES, 'shipment_mode' => Account::MAGENTO_ORDERS_SHIPMENT_MODE_YES));
        $formData = $this->getHelper('Data')->arrayReplaceRecursive($defaults, $formData);
        $form = $this->_formFactory->create();
        $form->addField('ebay_accounts_orders', self::HELP_BLOCK, ['content' => $this->__(<<<HTML
<p>Specify how M2E Pro should manage the imported from eBay Orders for the Items listed using 
M2E Pro or other tools.</p><br>
<p><strong>Note:</strong> If an eBay Order is received, Magento Product QTY decreases only if a 
Magento Order is created.</p><br>
<p>More detailed information about how to work with this 
Page you can find <a href="%url%" target="_blank">here</a>.</p>
HTML
, $this->getHelper('Module\\Support')->getDocumentationUrl(NULL, NULL, 'x/LgItAQ'))]);
        $fieldset = $form->addFieldset('listed_by_m2e', ['legend' => $this->__('Product Is Listed By M2E Pro'), 'collapsable' => false]);
        $fieldset->addField('magento_orders_listings_mode', 'select', ['name' => 'magento_orders_settings[listing][mode]', 'label' => $this->__('Create Order in Magento'), 'values' => [Account::MAGENTO_ORDERS_LISTINGS_MODE_YES => $this->__('Yes'), Account::MAGENTO_ORDERS_LISTINGS_MODE_NO => $this->__('No')], 'value' => $formData['magento_orders_settings']['listing']['mode'], 'tooltip' => $this->__('Choose whether a Magento Order should be created if an eBay Order is received for
                    an eBay Item Listed using M2E Pro.')]);
        $fieldset->addField('magento_orders_listings_store_mode', 'select', ['container_id' => 'magento_orders_listings_store_mode_container', 'name' => 'magento_orders_settings[listing][store_mode]', 'label' => $this->__('Magento Store View Source'), 'values' => [Account::MAGENTO_ORDERS_LISTINGS_STORE_MODE_DEFAULT => $this->__('Use Store View from Listing'), Account::MAGENTO_ORDERS_LISTINGS_STORE_MODE_CUSTOM => $this->__('Choose Store View Manually')], 'value' => $formData['magento_orders_settings']['listing']['store_mode'], 'tooltip' => $this->__('Choose to specify the Magento Store View here or to keep the Magento
                    Store View used in the M2E Pro Listing.')]);
        $fieldset->addField('magento_orders_listings_store_id', self::STORE_SWITCHER, ['container_id' => 'magento_orders_listings_store_id_container', 'name' => 'magento_orders_settings[listing][store_id]', 'label' => $this->__('Magento Store View'), 'required' => true, 'value' => $formData['magento_orders_settings']['listing']['store_id'], 'has_empty_option' => true, 'has_default_option' => false, 'tooltip' => $this->__('The Magento Store View that Orders will be placed in.')]);
        $fieldset = $form->addFieldset('listed_by_other', ['legend' => $this->__('Product Is Listed By Any Other Software'), 'collapsable' => false]);
        $fieldset->addField('magento_orders_listings_other_mode', 'select', ['name' => 'magento_orders_settings[listing_other][mode]', 'label' => $this->__('Create Order in Magento'), 'values' => [Account::MAGENTO_ORDERS_LISTINGS_OTHER_MODE_NO => $this->__('No'), Account::MAGENTO_ORDERS_LISTINGS_OTHER_MODE_YES => $this->__('Yes')], 'value' => $formData['magento_orders_settings']['listing_other']['mode'], 'tooltip' => $this->__('Choose whether a Magento Order should be created if an eBay Order is received for
                    an eBay Item <b>not</b> Listed using M2E Pro.')]);
        $fieldset->addField('magento_orders_listings_other_store_id', self::STORE_SWITCHER, ['container_id' => 'magento_orders_listings_other_store_id_container', 'name' => 'magento_orders_settings[listing_other][store_id]', 'label' => $this->__('Magento Store View'), 'required' => true, 'value' => $formData['magento_orders_settings']['listing_other']['store_id'], 'has_empty_option' => false, 'has_default_option' => false, 'tooltip' => $this->__('The Magento Store View that Orders will be placed in.')]);
        $fieldset->addField('magento_orders_listings_other_product_mode', 'select', ['container_id' => 'magento_orders_listings_other_product_mode_container', 'name' => 'magento_orders_settings[listing_other][product_mode]', 'label' => $this->__('Product Not Found'), 'values' => [Account::MAGENTO_ORDERS_LISTINGS_OTHER_PRODUCT_MODE_IGNORE => $this->__('Do Not Create Order'), Account::MAGENTO_ORDERS_LISTINGS_OTHER_PRODUCT_MODE_IMPORT => $this->__('Create Product and Order')], 'value' => $formData['magento_orders_settings']['listing_other']['product_mode'], 'tooltip' => $this->__('Choose what should happen if an Order is received for a Product that
                         does not exist in your Magento Inventory.') . '<span id="magento_orders_listings_other_product_mode_note">' . $this->__('<br/><b>Note:</b> Only Simple Products without Variations can be created in Magento.
                            If there is a Product with Variations on eBay, M2E Pro creates different
                            Simple Products for each Variation.') . '</span>']);
        $values = [];
        foreach ($productTaxClasses as $taxClass) {
            $values[$taxClass['value']] = $taxClass['label'];
        }
        $fieldset->addField('magento_orders_listings_other_product_tax_class_id', 'select', ['container_id' => 'magento_orders_listings_other_product_tax_class_id_container', 'name' => 'magento_orders_settings[listing_other][product_tax_class_id]', 'label' => $this->__('Product Tax Class'), 'values' => $values, 'value' => $formData['magento_orders_settings']['listing_other']['product_tax_class_id'], 'tooltip' => $this->__('Tax Class which will be used for Products created by M2E Pro.')]);
        $fieldset = $form->addFieldset('magento_block_ebay_accounts_magento_orders_number', ['legend' => $this->__('Magento Order Number'), 'collapsable' => true]);
        $fieldset->addField('magento_orders_number_source', 'select', ['name' => 'magento_orders_settings[number][source]', 'label' => $this->__('Source'), 'values' => [Account::MAGENTO_ORDERS_NUMBER_SOURCE_MAGENTO => $this->__('Magento'), Account::MAGENTO_ORDERS_NUMBER_SOURCE_CHANNEL => $this->__('eBay')], 'value' => $formData['magento_orders_settings']['number']['source'], 'tooltip' => $this->__('If source is set to Magento, Magento Order numbers are created basing on your Magento Settings.
                    If source is set to eBay, Magento Order numbers are the same as eBay Order numbers.')]);
        $fieldset->addField('magento_orders_number_prefix_mode', 'select', ['name' => 'magento_orders_settings[number][prefix][mode]', 'label' => $this->__('Use Prefix'), 'values' => [Account::MAGENTO_ORDERS_NUMBER_PREFIX_MODE_NO => $this->__('No'), Account::MAGENTO_ORDERS_NUMBER_PREFIX_MODE_YES => $this->__('Yes')], 'value' => $formData['magento_orders_settings']['number']['prefix']['mode'], 'tooltip' => $this->__('Choose to set prefix before Magento Order number.')]);
        $fieldset->addField('magento_orders_number_prefix_prefix', 'text', ['container_id' => 'magento_orders_number_prefix_container', 'class' => 'M2ePro-account-order-number-prefix', 'name' => 'magento_orders_settings[number][prefix][prefix]', 'label' => $this->__('Prefix'), 'value' => $formData['magento_orders_settings']['number']['prefix']['prefix'], 'required' => true, 'maxlength' => 5]);
        $fieldset->addField('sample_magento_order_id', 'hidden', ['value' => $this->getHelper('Magento')->getNextMagentoOrderId()]);
        $fieldset->addField('sample_ebay_order_id', 'hidden', ['value' => '110194096334-27192305001']);
        $fieldset->addField('order_number_example', 'label', ['label' => '', 'note' => $this->__('e.g.') . ' <span id="order_number_example_container"></span>']);
        $fieldset = $form->addFieldset('magento_block_ebay_accounts_magento_orders_customer', ['legend' => $this->__('Customer Settings'), 'collapsable' => true]);
        $fieldset->addField('magento_orders_customer_mode', 'select', ['name' => 'magento_orders_settings[customer][mode]', 'label' => $this->__('Customer'), 'values' => [Account::MAGENTO_ORDERS_CUSTOMER_MODE_GUEST => $this->__('Guest Account'), Account::MAGENTO_ORDERS_CUSTOMER_MODE_PREDEFINED => $this->__('Predefined Customer'), Account::MAGENTO_ORDERS_CUSTOMER_MODE_NEW => $this->__('Create New')], 'value' => $formData['magento_orders_settings']['customer']['mode'], 'tooltip' => $this->__('<b>Guest Account:</b> Magento Guest Checkout Option must be enabled to use this Option.
                    Use the default Guest Account. Do not create a Customer Account.<br/><br/>
                    <b>Predefined Customer:</b> Use a specific Customer for all Orders.
                    You should specify the Magento Customer ID to use.<br/><br/>
                    <b>Create New:</b> Create a new Customer in Magento for the Order.
                    If an existing Magento Customer has the same email address as the email address used for the
                    eBay Order, the Order will be assigned to that Customer instead.')]);
        $fieldset->addField('magento_orders_customer_id', 'text', ['container_id' => 'magento_orders_customer_id_container', 'class' => 'validate-digits M2ePro-account-customer-id', 'name' => 'magento_orders_settings[customer][id]', 'label' => $this->__('Customer ID'), 'value' => $formData['magento_orders_settings']['customer']['id'], 'required' => true]);
        $values = [];
        foreach ($websites as $website) {
            $values[$website['website_id']] = $website['name'];
        }
        $fieldset->addField('magento_orders_customer_new_website_id', 'select', ['container_id' => 'magento_orders_customer_new_website_id_container', 'name' => 'magento_orders_settings[customer][website_id]', 'label' => $this->__('Associate to Website'), 'values' => $values, 'value' => $formData['magento_orders_settings']['customer']['website_id'], 'required' => true]);
        $values = [];
        foreach ($groups as $group) {
            $values[$group['customer_group_id']] = $group['customer_group_code'];
        }
        $fieldset->addField('magento_orders_customer_new_group_id', 'select', ['container_id' => 'magento_orders_customer_new_group_id_container', 'name' => 'magento_orders_settings[customer][group_id]', 'label' => $this->__('Customer Group'), 'values' => $values, 'value' => $formData['magento_orders_settings']['customer']['group_id'], 'required' => true]);
        $value = [];
        $formData['magento_orders_settings']['customer']['notifications']['order_created'] && ($value[] = 'order_created');
        $formData['magento_orders_settings']['customer']['notifications']['invoice_created'] && ($value[] = 'invoice_created');
        $fieldset->addField('magento_orders_customer_new_notifications', 'multiselect', ['container_id' => 'magento_orders_customer_new_notifications_container', 'name' => 'magento_orders_settings[customer][notifications][]', 'label' => $this->__('Send Emails When The Following Is Created'), 'values' => [['label' => $this->__('Magento Order'), 'value' => 'order_created'], ['label' => $this->__('Invoice'), 'value' => 'invoice_created']], 'value' => $value, 'tooltip' => $this->__('<p>Necessary emails will be sent according to Magento Settings in 
                    Stores > Configuration > Sales > Sales Emails.</p>
                    <p>Hold Ctrl Button to choose more than one Option.</p>')]);
        $fieldset = $form->addFieldset('magento_block_ebay_accounts_magento_orders_rules', ['legend' => $this->__('Order Creation Rules'), 'collapsable' => true]);
        $fieldset->addField('magento_orders_creation_mode', 'select', ['name' => 'magento_orders_settings[creation][mode]', 'label' => $this->__('Create Magento Order When'), 'values' => [Account::MAGENTO_ORDERS_CREATE_IMMEDIATELY => $this->__('Immediately'), Account::MAGENTO_ORDERS_CREATE_CHECKOUT => $this->__('Checkout Is Completed'), Account::MAGENTO_ORDERS_CREATE_PAID => $this->__('Payment Is Received'), Account::MAGENTO_ORDERS_CREATE_CHECKOUT_AND_PAID => $this->__('Checkout Is Completed & Payment Received')], 'value' => $formData['magento_orders_settings']['creation']['mode'], 'tooltip' => $this->__('Choose the stage of the eBay Order process at which the Magento Order should be created.
                     You can also choose for how long to reserve Stock as soon as an eBay Order is received,
                     to ensure you can fulfil the eBay Order in case there is a delay between the Order being made
                     and the Magento Order being created.')]);
        $values = [0 => $this->__('Never')];
        for ($day = 7; $day <= 10; $day++) {
            $values[$day] = $this->__('In %d% days', $day);
        }
        $fieldset->addField('magento_orders_creation_reservation_days', 'select', ['container_id' => 'magento_orders_creation_reservation_days_container', 'name' => 'magento_orders_settings[creation][reservation_days]', 'label' => $this->__('Automatic Cancellation'), 'values' => $values, 'value' => $formData['magento_orders_settings']['creation']['reservation_days'], 'tooltip' => $this->__('Magento Orders, which were not paid in a definite time interval,
                    will be cancelled. Unpaid Item Process will be launched for such Orders on eBay.')]);
        $values = [];
        for ($day = 1; $day <= 14; $day++) {
            if ($day == 1) {
                $values[$day] = $this->__('For %number% day', $day);
            } else {
                $values[$day] = $this->__('For %number% days', $day);
            }
        }
        $fieldset->addField('magento_orders_qty_reservation_days', 'select', ['container_id' => 'magento_orders_qty_reservation_days_container', 'name' => 'magento_orders_settings[qty_reservation][days]', 'label' => $this->__('Reserve Quantity'), 'values' => $values, 'value' => $formData['magento_orders_settings']['qty_reservation']['days'], 'tooltip' => $this->__('Choose how long to set Stock aside after an eBay Order is made,
                    to allow time for the eBay process to reach the point at which a Magento Order is created.')]);
        $fieldset = $form->addFieldset('magento_block_ebay_accounts_magento_orders_tax', ['legend' => $this->__('Order Tax Settings'), 'collapsable' => true]);
        $fieldset->addField('magento_orders_tax_mode', 'select', ['name' => 'magento_orders_settings[tax][mode]', 'label' => $this->__('Tax Source'), 'values' => [Account::MAGENTO_ORDERS_TAX_MODE_NONE => $this->__('None'), Account::MAGENTO_ORDERS_TAX_MODE_CHANNEL => $this->__('eBay'), Account::MAGENTO_ORDERS_TAX_MODE_MAGENTO => $this->__('Magento'), Account::MAGENTO_ORDERS_TAX_MODE_MIXED => $this->__('eBay & Magento')], 'value' => $formData['magento_orders_settings']['tax']['mode'], 'tooltip' => $this->__('Choose the Tax Settings for your Magento Order:
                    <br/>
                    <br/><b>eBay</b> - Magento Orders use Tax Settings from the eBay Listing.
                    <br/><b>Magento</b> - Magento Orders use Magento Tax Settings.
                    <br/><b>eBay & Magento</b> - Magento Orders use Tax Settings from the eBay Listing.
                    If there are no Tax Settings set in eBay, Magento Tax Settings are used.
                    <br/><b>None</b> - No Tax Settings are set.')]);
        $fieldset = $form->addFieldset('magento_block_ebay_accounts_magento_orders_status_mapping', ['legend' => $this->__('Order Status Mapping'), 'collapsable' => true]);
        $fieldset->addField('magento_orders_status_mapping_mode', 'select', ['name' => 'magento_orders_settings[status_mapping][mode]', 'label' => $this->__('Status Mapping'), 'values' => [Account::MAGENTO_ORDERS_STATUS_MAPPING_MODE_DEFAULT => $this->__('Default Order Statuses'), Account::MAGENTO_ORDERS_STATUS_MAPPING_MODE_CUSTOM => $this->__('Custom Order Statuses')], 'value' => $formData['magento_orders_settings']['status_mapping']['mode'], 'tooltip' => $this->__('Match stages in the eBay Order process to Order Statuses in Magento.
                     You can also choose whether to create invoices and shipment notifications automatically.')]);
        $isDisabledStatus = $formData['magento_orders_settings']['status_mapping']['mode'] == Account::MAGENTO_ORDERS_STATUS_MAPPING_MODE_DEFAULT;
        if ($formData['magento_orders_settings']['status_mapping']['mode'] == Account::MAGENTO_ORDERS_STATUS_MAPPING_MODE_DEFAULT) {
            $formData['magento_orders_settings']['status_mapping']['new'] = Account::MAGENTO_ORDERS_STATUS_MAPPING_NEW;
            $formData['magento_orders_settings']['status_mapping']['paid'] = Account::MAGENTO_ORDERS_STATUS_MAPPING_PAID;
            $formData['magento_orders_settings']['status_mapping']['shipped'] = Account::MAGENTO_ORDERS_STATUS_MAPPING_SHIPPED;
            $formData['magento_orders_settings']['invoice_mode'] = Account::MAGENTO_ORDERS_INVOICE_MODE_YES;
            $formData['magento_orders_settings']['shipment_mode'] = Account::MAGENTO_ORDERS_SHIPMENT_MODE_YES;
        }
        $statusList = $this->orderConfig->getStatuses();
        $fieldset->addField('magento_orders_status_mapping_new', 'select', ['name' => 'magento_orders_settings[status_mapping][new]', 'label' => $this->__('Checkout Is Completed'), 'values' => $statusList, 'value' => $formData['magento_orders_settings']['status_mapping']['new'], 'disabled' => $isDisabledStatus]);
        $invoiceModeDisabled = $isDisabledStatus ? 'disabled="disabled"' : '';
        $invoiceModeChecked = $formData['magento_orders_settings']['status_mapping']['mode'] == Account::MAGENTO_ORDERS_STATUS_MAPPING_MODE_DEFAULT || $formData['magento_orders_settings']['invoice_mode'] == Account::MAGENTO_ORDERS_INVOICE_MODE_YES ? 'checked="checked"' : '';
        $fieldset->addField('magento_orders_status_mapping_paid', 'select', ['container_id' => 'magento_orders_status_mapping_paid_container', 'name' => 'magento_orders_settings[status_mapping][paid]', 'label' => $this->__('Payment Is Completed'), 'values' => $statusList, 'value' => $formData['magento_orders_settings']['status_mapping']['paid'], 'disabled' => $isDisabledStatus])->setAfterElementHtml(<<<HTML
<label for="magento_orders_invoice_mode">
<input id="magento_orders_invoice_mode"
       name="magento_orders_settings[invoice_mode]"
       type="checkbox" {$invoiceModeChecked} {$invoiceModeDisabled}> {$this->__('Automatic Invoice Creation')}</label>
HTML
);
        $shipmentModeDisabled = $isDisabledStatus ? 'disabled="disabled"' : '';
        $shipmentModeChecked = $formData['magento_orders_settings']['status_mapping']['mode'] == Account::MAGENTO_ORDERS_STATUS_MAPPING_MODE_DEFAULT || $formData['magento_orders_settings']['shipment_mode'] == Account::MAGENTO_ORDERS_SHIPMENT_MODE_YES ? 'checked="checked"' : '';
        $fieldset->addField('magento_orders_status_mapping_shipped', 'select', ['container_id' => 'magento_orders_status_mapping_shipped_container', 'name' => 'magento_orders_settings[status_mapping][shipped]', 'label' => $this->__('Shipping Is Completed'), 'values' => $statusList, 'value' => $formData['magento_orders_settings']['status_mapping']['shipped'], 'disabled' => $isDisabledStatus])->setAfterElementHtml(<<<HTML
<label for="magento_orders_shipment_mode">
<input id="magento_orders_shipment_mode"
       name="magento_orders_settings[shipment_mode]"
       type="checkbox" {$shipmentModeChecked} {$shipmentModeDisabled}> {$this->__('Automatic Shipment Creation')}</label>
HTML
);
        $this->setForm($form);
        $formData['magento_orders_settings']['listing']['mode'] = $this->getHelper('Data')->escapeJs($formData['magento_orders_settings']['listing']['mode']);
        $formData['magento_orders_settings']['listing']['store_mode'] = $this->getHelper('Data')->escapeJs($formData['magento_orders_settings']['listing']['store_mode']);
        $formData['magento_orders_settings']['listing']['store_id'] = $this->getHelper('Data')->escapeJs($formData['magento_orders_settings']['listing']['store_id']);
        $formData['magento_orders_settings']['listing_other']['mode'] = $this->getHelper('Data')->escapeJs($formData['magento_orders_settings']['listing_other']['mode']);
        $formData['magento_orders_settings']['listing_other']['store_id'] = $this->getHelper('Data')->escapeJs($formData['magento_orders_settings']['listing_other']['store_id']);
        $formData['magento_orders_settings']['listing_other']['product_mode'] = $this->getHelper('Data')->escapeJs($formData['magento_orders_settings']['listing_other']['product_mode']);
        $formData['magento_orders_settings']['customer']['mode'] = $this->getHelper('Data')->escapeJs($formData['magento_orders_settings']['customer']['mode']);
        $formData['magento_orders_settings']['customer']['id'] = $this->getHelper('Data')->escapeJs($formData['magento_orders_settings']['customer']['id']);
        $formData['magento_orders_settings']['customer']['website_id'] = $this->getHelper('Data')->escapeJs($formData['magento_orders_settings']['customer']['website_id']);
        $formData['magento_orders_settings']['customer']['group_id'] = $this->getHelper('Data')->escapeJs($formData['magento_orders_settings']['customer']['group_id']);
        $this->js->add(<<<JS

    M2ePro.formData.magento_orders_listings_mode = "{$formData['magento_orders_settings']['listing']['mode']}";
    M2ePro.formData.magento_orders_listings_store_mode
        = "{$formData['magento_orders_settings']['listing']['store_mode']}";
    M2ePro.formData.magento_orders_listings_store_id
        = "{$formData['magento_orders_settings']['listing']['store_id']}";

    M2ePro.formData.magento_orders_listings_other_mode
        = "{$formData['magento_orders_settings']['listing_other']['mode']}";
    M2ePro.formData.magento_orders_listings_other_store_id
        = "{$formData['magento_orders_settings']['listing_other']['store_id']}";
    M2ePro.formData.magento_orders_listings_other_product_mode
        = "{$formData['magento_orders_settings']['listing_other']['product_mode']}";

    M2ePro.formData.magento_orders_customer_mode = "{$formData['magento_orders_settings']['customer']['mode']}";
    M2ePro.formData.magento_orders_customer_id = "{$formData['magento_orders_settings']['customer']['id']}";
    M2ePro.formData.magento_orders_customer_new_website_id
        = "{$formData['magento_orders_settings']['customer']['website_id']}";
    M2ePro.formData.magento_orders_customer_new_group_id
        = "{$formData['magento_orders_settings']['customer']['group_id']}";

JS
);
        return parent::_prepareForm();
    }
Exemplo n.º 27
0
    protected function _prepareForm()
    {
        $form = $this->_formFactory->create();
        $attributes = $this->getHelper('Magento\\Attribute')->getGeneralFromAllAttributeSets();
        /** @var $account \Ess\M2ePro\Model\Account */
        $account = $this->getHelper('Data\\GlobalData')->getValue('temp_data');
        $formData = !is_null($account) ? array_merge($account->getData(), $account->getChildObject()->getData()) : [];
        if (isset($formData['other_listings_mapping_settings'])) {
            $formData['other_listings_mapping_settings'] = (array) json_decode($formData['other_listings_mapping_settings'], true);
        }
        if (isset($formData['other_listings_move_settings'])) {
            $formData['other_listings_move_settings'] = (array) json_decode($formData['other_listings_move_settings'], true);
            if (isset($formData['other_listings_move_settings']['synch'])) {
                $formData['other_listings_move_synch'] = $formData['other_listings_move_settings']['synch'];
            }
        }
        $defaults = array('related_store_id' => 0, 'other_listings_synchronization' => Account::OTHER_LISTINGS_SYNCHRONIZATION_YES, 'other_listings_mapping_mode' => Account::OTHER_LISTINGS_MAPPING_MODE_YES, 'other_listings_mapping_settings' => array(), 'other_listings_move_mode' => Account::OTHER_LISTINGS_MOVE_TO_LISTINGS_DISABLED, 'other_listings_move_synch' => Account::OTHER_LISTINGS_MOVE_TO_LISTINGS_SYNCH_MODE_NONE);
        $formData = array_merge($defaults, $formData);
        $isEdit = !!$this->getRequest()->getParam('id');
        $form->addField('amazon_accounts_other_listings', self::HELP_BLOCK, ['content' => $this->__(<<<HTML
<p>This tab of the Account settings contains main configurations for the 3rd Party Listing management. 
You can set preferences whether you would like to import 3rd Party Listings 
(Items that were Listed on eBay either directly on the channel or with the help of other than M2E Pro tool), 
automatically map them to Magento Product, etc..</p><br>
<p>More detailed information you can find <a href="%url%" target="_blank">here</a>.</p>
HTML
, $this->getHelper('Module\\Support')->getDocumentationUrl(NULL, NULL, 'x/NAItAQ'))]);
        $fieldset = $form->addFieldset('general', ['legend' => $this->__('General'), 'collapsable' => false]);
        $fieldset->addField('other_listings_synchronization', 'select', ['name' => 'other_listings_synchronization', 'label' => $this->__('Import 3rd Party Listings'), 'values' => [Account::OTHER_LISTINGS_SYNCHRONIZATION_YES => $this->__('Yes'), Account::OTHER_LISTINGS_SYNCHRONIZATION_NO => $this->__('No')], 'value' => $formData['other_listings_synchronization'], 'tooltip' => $this->__('Allows importing 3rd Party Listings.')]);
        $fieldset->addField('related_store_id', self::STORE_SWITCHER, ['container_id' => 'marketplaces_related_store_id_container', 'name' => 'related_store_id', 'label' => $this->__('Related Store View'), 'value' => $formData['related_store_id'], 'tooltip' => $this->__('Store View, which will be associated with chosen Marketplace of the current Account.')]);
        $fieldset->addField('other_listings_mapping_mode', 'select', ['container_id' => 'other_listings_mapping_mode_tr', 'name' => 'other_listings_mapping_mode', 'class' => 'M2ePro-require-select-attribute', 'label' => $this->__('Product Mapping'), 'values' => [Account::OTHER_LISTINGS_MAPPING_MODE_YES => $this->__('Yes'), Account::OTHER_LISTINGS_MAPPING_MODE_NO => $this->__('No')], 'value' => $formData['other_listings_mapping_mode'], 'tooltip' => $this->__('Choose whether imported Amazon Listings should automatically map to a 
                    Product in your Magento Inventory.')]);
        $fieldset = $form->addFieldset('magento_block_amazon_accounts_other_listings_product_mapping', ['legend' => $this->__('Magento Product Mapping Settings'), 'collapsable' => false, 'tooltip' => $this->__('<p>In this section you can provide settings for automatic Mapping of the newly imported 
                    3rd Party Listings to the appropriate Magento Products. </p><br>
                    <p>The imported Items are mapped based on the correspondence between Amazon Item values and 
                    Magento Product Attribute values. </p>')]);
        $mappingSettings = $formData['other_listings_mapping_settings'];
        $preparedAttributes = [];
        foreach ($attributes as $attribute) {
            $attrs = ['attribute_code' => $attribute['code']];
            if (isset($mappingSettings['sku']['mode']) && $mappingSettings['sku']['mode'] == Account::OTHER_LISTINGS_MAPPING_SKU_MODE_CUSTOM_ATTRIBUTE && $mappingSettings['sku']['attribute'] == $attribute['code']) {
                $attrs['selected'] = 'selected';
            }
            $preparedAttributes[] = ['attrs' => $attrs, 'value' => Account::OTHER_LISTINGS_MAPPING_SKU_MODE_CUSTOM_ATTRIBUTE, 'label' => $attribute['label']];
        }
        $mappingSkuPriority = isset($mappingSettings['sku']['priority']) ? (int) $mappingSettings['sku']['priority'] : Account::OTHER_LISTINGS_MAPPING_SKU_DEFAULT_PRIORITY;
        $fieldset->addField('mapping_sku_mode', self::SELECT, ['name' => 'mapping_sku_mode', 'label' => $this->__('SKU'), 'class' => 'attribute-mode-select M2ePro-custom-attribute-can-be-created', 'values' => [Account::OTHER_LISTINGS_MAPPING_SKU_MODE_NONE => $this->__('None'), Account::OTHER_LISTINGS_MAPPING_SKU_MODE_DEFAULT => $this->__('Product SKU'), Account::OTHER_LISTINGS_MAPPING_SKU_MODE_PRODUCT_ID => $this->__('Product ID'), ['label' => $this->__('Magento Attributes'), 'value' => $preparedAttributes]], 'value' => isset($mappingSettings['sku']['mode']) && $mappingSettings['sku']['mode'] != Account::OTHER_LISTINGS_MAPPING_SKU_MODE_CUSTOM_ATTRIBUTE ? $mappingSettings['sku']['mode'] : ''])->setAfterElementHtml(<<<HTML
<div id="mapping_sku_priority_td">
    {$this->__('Priority')}: <input style="width: 50px;"
                                    name="mapping_sku_priority"
                                    value="{$mappingSkuPriority}"
                                    type="text"
                                    class="input-text admin__control-text required-entry _required">
</div>
HTML
);
        $fieldset->addField('mapping_sku_attribute', 'hidden', ['name' => 'mapping_sku_attribute', 'value' => isset($mappingSettings['sku']['attribute']) ? $mappingSettings['sku']['attribute'] : '']);
        $modeCustomAttribute = Account::OTHER_LISTINGS_MAPPING_GENERAL_ID_MODE_CUSTOM_ATTRIBUTE;
        $preparedAttributes = [];
        foreach ($attributes as $attribute) {
            $attrs = ['attribute_code' => $attribute['code']];
            if (isset($mappingSettings['general_id']['mode']) && $mappingSettings['general_id']['mode'] == $modeCustomAttribute && $mappingSettings['general_id']['attribute'] == $attribute['code']) {
                $attrs['selected'] = 'selected';
            }
            $preparedAttributes[] = ['attrs' => $attrs, 'value' => Account::OTHER_LISTINGS_MAPPING_GENERAL_ID_MODE_CUSTOM_ATTRIBUTE, 'label' => $attribute['label']];
        }
        $mappingGeneralIdPriority = isset($mappingSettings['general_id']['priority']) ? (int) $mappingSettings['general_id']['priority'] : Account::OTHER_LISTINGS_MAPPING_GENERAL_ID_DEFAULT_PRIORITY;
        $fieldset->addField('mapping_general_id_mode', self::SELECT, ['name' => 'mapping_general_id_mode', 'label' => $this->__('ASIN / ISBN'), 'class' => 'attribute-mode-select M2ePro-custom-attribute-can-be-created', 'values' => [Account::OTHER_LISTINGS_MAPPING_GENERAL_ID_MODE_NONE => $this->__('None'), ['label' => $this->__('Magento Attributes'), 'value' => $preparedAttributes]], 'value' => isset($mappingSettings['general_id']['mode']) && $mappingSettings['general_id']['mode'] != $modeCustomAttribute ? $mappingSettings['general_id']['mode'] : ''])->setAfterElementHtml(<<<HTML
<div id="mapping_general_id_priority_td">
    {$this->__('Priority')}: <input style="width: 50px;"
                                    name="mapping_general_id_priority"
                                    value="{$mappingGeneralIdPriority}"
                                    type="text"
                                    class="input-text admin__control-text required-entry _required">
</div>
HTML
);
        $fieldset->addField('mapping_general_id_attribute', 'hidden', ['name' => 'mapping_general_id_attribute', 'value' => isset($mappingSettings['general_id']['attribute']) ? $mappingSettings['general_id']['attribute'] : '']);
        $preparedAttributes = [];
        foreach ($attributes as $attribute) {
            $attrs = ['attribute_code' => $attribute['code']];
            if (isset($mappingSettings['title']['mode']) && $mappingSettings['title']['mode'] == Account::OTHER_LISTINGS_MAPPING_TITLE_MODE_CUSTOM_ATTRIBUTE && $mappingSettings['title']['attribute'] == $attribute['code']) {
                $attrs['selected'] = 'selected';
            }
            $preparedAttributes[] = ['attrs' => $attrs, 'value' => Account::OTHER_LISTINGS_MAPPING_TITLE_MODE_CUSTOM_ATTRIBUTE, 'label' => $attribute['label']];
        }
        $mappingTitlePriority = isset($mappingSettings['title']['priority']) ? (int) $mappingSettings['title']['priority'] : Account::OTHER_LISTINGS_MAPPING_TITLE_DEFAULT_PRIORITY;
        $fieldset->addField('mapping_title_mode', self::SELECT, ['name' => 'mapping_title_mode', 'label' => $this->__('Listing Title'), 'class' => 'attribute-mode-select M2ePro-custom-attribute-can-be-created', 'values' => [Account::OTHER_LISTINGS_MAPPING_TITLE_MODE_NONE => $this->__('None'), Account::OTHER_LISTINGS_MAPPING_TITLE_MODE_DEFAULT => $this->__('Product Name'), ['label' => $this->__('Magento Attributes'), 'value' => $preparedAttributes]], 'value' => isset($mappingSettings['title']['mode']) && $mappingSettings['title']['mode'] != Account::OTHER_LISTINGS_MAPPING_TITLE_MODE_CUSTOM_ATTRIBUTE ? $mappingSettings['title']['mode'] : ''])->setAfterElementHtml(<<<HTML
<div id="mapping_title_priority_td">
    {$this->__('Priority')}: <input style="width: 50px;"
                                    name="mapping_title_priority"
                                    value="{$mappingTitlePriority}"
                                    type="text"
                                    class="input-text admin__control-text required-entry _required">
</div>
HTML
);
        $fieldset->addField('mapping_title_attribute', 'hidden', ['name' => 'mapping_title_attribute', 'value' => isset($mappingSettings['title']['attribute']) ? $mappingSettings['title']['attribute'] : '']);
        $fieldset = $form->addFieldset('magento_block_amazon_accounts_other_listings_move_mode', ['legend' => $this->__('Auto Moving Mapped Amazon Items To M2E Pro Listings'), 'collapsable' => false]);
        $fieldset->addField('other_listings_move_mode', 'select', ['name' => 'other_listings_move_mode', 'label' => $this->__('Move Mapped Amazon Items'), 'values' => [Account::OTHER_LISTINGS_MOVE_TO_LISTINGS_ENABLED => $this->__('Yes'), Account::OTHER_LISTINGS_MOVE_TO_LISTINGS_DISABLED => $this->__('No')], 'value' => $formData['other_listings_move_mode'], 'tooltip' => $this->__('<p>Enable this option if you would like Amazon Items which have already been Mapped to 
                    Magento Products to be automatically Moved from the 3rd Party Listings to M2E Pro 
                    Listings for further management.</p><br>
                    <p><strong>Note:</strong> Auto Map and Move Actions are performed only during the 
                    first 3rd Party Listing Synchronization. Afterwards, it can be performed manually on 
                    the 3rd Party Listings Page.</p>')]);
        $fieldset->addField('other_listings_move_synch', 'select', ['container_id' => 'other_listings_move_synch_tr', 'name' => 'other_listings_move_synch', 'label' => $this->__('Immediate Synchronization'), 'values' => [Account::OTHER_LISTINGS_MOVE_TO_LISTINGS_SYNCH_MODE_NONE => $this->__('None'), Account::OTHER_LISTINGS_MOVE_TO_LISTINGS_SYNCH_MODE_ALL => $this->__('Price and QTY'), Account::OTHER_LISTINGS_MOVE_TO_LISTINGS_SYNCH_MODE_PRICE => $this->__('Price Only'), Account::OTHER_LISTINGS_MOVE_TO_LISTINGS_SYNCH_MODE_QTY => $this->__('QTY Only')], 'value' => $formData['other_listings_move_synch'], 'tooltip' => $this->__('Updates Price and / or Quantity of Amazon Listing with Magento values.')]);
        $this->setForm($form);
        $this->jsTranslator->add('If Yes is chosen, you must select at least one Attribute for Product Mapping.', $this->__('If Yes is chosen, you must select at least one Attribute for Product Mapping.'));
        return parent::_prepareForm();
    }
Exemplo n.º 28
0
    protected function _prepareForm()
    {
        $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'method' => 'post', 'action' => 'javascript:void(0)', 'enctype' => 'multipart/form-data', 'class' => 'admin__scope-old']]);
        $fieldset = $form->addFieldset('general_fieldset', ['legend' => $this->__('General'), 'collapsable' => false]);
        $title = $this->amazonFactory->getObject('Listing')->getCollection()->getSize() == 0 ? 'Default' : '';
        $accountId = '';
        $storeId = '';
        // ---------------------------------------
        $sessionKey = 'amazon_listing_create';
        $sessionData = $this->getHelper('Data\\Session')->getValue($sessionKey);
        isset($sessionData['title']) && ($title = $sessionData['title']);
        isset($sessionData['account_id']) && ($accountId = $sessionData['account_id']);
        isset($sessionData['store_id']) && ($storeId = $sessionData['store_id']);
        // ---------------------------------------
        $fieldset->addField('title', 'text', ['name' => 'title', 'label' => $this->__('Title'), 'value' => $title, 'required' => true, 'class' => 'M2ePro-listing-title', 'tooltip' => $this->__('Create a descriptive and meaningful Title for your M2E Pro Listing. <br/>
                    This is used for reference within M2E Pro and will not appear on your Amazon Listings.')]);
        $fieldset = $form->addFieldset('amazon_settings_fieldset', ['legend' => $this->__('Amazon Settings'), 'collapsable' => false]);
        // ---------------------------------------
        $accountsCollection = $this->amazonFactory->getObject('Account')->getCollection()->setOrder('title', 'ASC');
        $accountsCollection->getSelect()->reset(\Zend_Db_Select::COLUMNS)->columns(['value' => 'id', 'label' => 'title']);
        // ---------------------------------------
        $accounts = $accountsCollection->getConnection()->fetchAssoc($accountsCollection->getSelect());
        $accountSelect = $this->elementFactory->create('select', ['data' => ['html_id' => 'account_id', 'name' => 'account_id', 'style' => 'width: 50%;', 'value' => $accountId, 'values' => $accounts, 'required' => count($accounts) > 1]]);
        $accountSelect->setForm($form);
        $fieldset->addField('account_container', self::CUSTOM_CONTAINER, ['label' => $this->__('Account'), 'style' => 'line-height: 32px; display: initial;', 'required' => count($accounts) > 1, 'text' => <<<HTML
    <span id="account_label"></span>
    {$accountSelect->toHtml()}
HTML
, 'after_element_html' => $this->createBlock('Magento\\Button')->setData(['id' => 'add_account_button', 'label' => $this->__('Add Another'), 'style' => 'margin-left: 5px;' . ($this->getRequest()->getParam('wizard', false) ? 'display: none;' : ''), 'onclick' => '', 'class' => 'primary'])->toHtml(), 'tooltip' => $this->__('This is the user name of your Amazon Account.')]);
        // ---------------------------------------
        $marketplacesCollection = $this->amazonFactory->getObject('Marketplace')->getCollection()->setOrder('sorder', 'ASC')->setOrder('title', 'ASC');
        $marketplacesCollection->getSelect()->reset(\Zend_Db_Select::COLUMNS)->columns(['value' => 'id', 'label' => 'title', 'url' => 'url']);
        // ---------------------------------------
        $fieldset->addField('marketplace_info', self::CUSTOM_CONTAINER, ['css_class' => 'no-margin-bottom', 'label' => $this->__('Marketplace'), 'field_extra_attributes' => 'id="marketplace_info" style="display: none; margin-top: 0px"', 'text' => '<span id="marketplace_title"></span><p class="note" id="marketplace_url"></p>']);
        $fieldset->addField('marketplace_id', 'hidden', ['value' => '']);
        $fieldset = $form->addFieldset('magento_fieldset', ['legend' => $this->__('Magento Settings'), 'collapsable' => false]);
        $fieldset->addField('store_switcher', self::STORE_SWITCHER, ['name' => 'store_id', 'label' => $this->__('Magento Store View'), 'value' => $storeId, 'required' => true, 'has_empty_option' => true, 'display_default_store_mode' => StoreSwitcher::DISPLAY_DEFAULT_STORE_MODE_DOWN, 'tooltip' => $this->__('Choose the Magento Store View you want to use for this M2E Pro Listing.')]);
        $form->setUseContainer(true);
        $this->setForm($form);
        $this->jsUrl->addUrls($this->getHelper('Data')->getControllerActions('General', ['component' => \Ess\M2ePro\Helper\Component\Amazon::NICK]));
        $this->jsUrl->addUrls($this->getHelper('Data')->getControllerActions('Amazon\\Account'));
        $this->jsUrl->addUrls($this->getHelper('Data')->getControllerActions('Amazon\\Marketplace'));
        $this->jsUrl->addUrls($this->getHelper('Data')->getControllerActions('Amazon\\Listing\\Create', ['_current' => true]));
        $this->jsUrl->add($this->getUrl('*/amazon_account/newAction', ['close_on_save' => true, 'wizard' => (bool) $this->getRequest()->getParam('wizard', false)]), 'amazon_account/newAction');
        $this->jsTranslator->add('The specified Title is already used for other Listing. Listing Title must be unique.', $this->__('The specified Title is already used for other Listing. Listing Title must be unique.'));
        $this->jsTranslator->add('Account not found, please create it.', $this->__('Account not found, please create it.'));
        $this->jsTranslator->add('Add Another', $this->__('Add Another'));
        $this->jsTranslator->add('Please wait while Synchronization is finished.', $this->__('Please wait while Synchronization is finished.'));
        $this->jsTranslator->add('Preparing to start. Please wait ...', $this->__('Preparing to start. Please wait ...'));
        $this->jsPhp->addConstants($this->getHelper('Data')->getClassConstants('\\Ess\\M2ePro\\Helper\\Component\\Amazon'));
        $this->js->add(<<<JS

    M2ePro.formData.wizard = {$this->getRequest()->getParam('wizard', 0)};

require([
    'M2ePro/Amazon/Listing/Settings',
    'M2ePro/Amazon/Listing/Create/General'
], function(){

    window.AmazonListingSettingsObj = new AmazonListingSettings();
    window.AmazonListingCreateGeneralObj = new AmazonListingCreateGeneral();

});
JS
);
        return parent::_prepareForm();
    }
Exemplo n.º 29
0
    protected function _prepareForm()
    {
        $form = $this->_formFactory->create();
        $this->setForm($form);
        $selectElementType = 'Ess\\M2ePro\\Block\\Adminhtml\\Magento\\Form\\Element\\Select';
        // ---------------------------------------
        $form->addField('amazon_template_description_definition', self::HELP_BLOCK, ['content' => $this->__('On this Tab you can specify Settings for common Product Information. <br/>
                    It is available to choose just those Magento Attributes that are used for all Attribute Sets.
                    <br/><br/>

                    <b>Note:</b> Title value is required for creation of all Description Policies
                    because of technical reasons.<br/><br/>

                    More detailed information about ability to work with this Page you can find
                    <a href="%url%" target="_blank">here</a>.', $this->getHelper('Module\\Support')->getDocumentationUrl(NULL, NULL, 'x/JYMVAQ'))]);
        // ---------------------------------------
        // ---------------------------------------
        // General
        // ---------------------------------------
        $fieldSet = $form->addFieldset('magento_block_amazon_template_description_general', ['legend' => $this->__('General'), 'collapsable' => false]);
        $fieldSet->addField('title_mode', $selectElementType, ['name' => 'definition[title_mode]', 'label' => $this->__('Title'), 'title' => $this->__('Title'), 'values' => [['value' => DefinitionTemplate::TITLE_MODE_PRODUCT, 'label' => $this->__('Product Name')], ['value' => DefinitionTemplate::TITLE_MODE_CUSTOM, 'label' => $this->__('Custom Value')]], 'value' => $this->formData['title_mode'], 'class' => 'select required-entry', 'tooltip' => $this->__('Item\'s Title that buyers will see on Amazon Listing.')]);
        // ---------------------------------------
        $fieldSet->addField('title_template', 'text', ['name' => 'definition[title_template]', 'label' => $this->__('Title Value'), 'title' => $this->__('Title Value'), 'value' => $this->getHelper('Data')->escapeHtml($this->formData['title_template']), 'class' => 'input-text M2ePro-required-when-visible', 'required' => true, 'field_extra_attributes' => 'id="custom_title_tr" style="display: none;"', 'after_element_html' => $this->createBlock('Magento\\Button\\MagentoAttribute')->addData(['label' => $this->__('Insert Attribute'), 'destination_id' => 'title_template', 'magento_attributes' => $this->getClearAttributesByInputTypesOptions(), 'class' => 'select_attributes_for_title_button primary', 'select_custom_attributes' => ['allowed_attribute_types' => 'text,select', 'apply_to_all_attribute_sets' => 0], 'style' => 'display: block; margin-left: 0; margin-top: 5px;'])->toHtml()]);
        // ---------------------------------------
        $fieldSet->addField('general_separator_1', self::SEPARATOR, []);
        // ---------------------------------------
        $fieldSet->addField('brand_custom_attribute', 'hidden', ['name' => 'definition[brand_custom_attribute]', 'value' => $this->formData['brand_custom_attribute']]);
        // ---------------------------------------
        $defaultValue = '';
        if ($this->formData['brand_mode'] == DefinitionTemplate::BRAND_MODE_NONE || $this->formData['brand_mode'] == DefinitionTemplate::BRAND_MODE_CUSTOM_VALUE) {
            $defaultValue = $this->formData['brand_mode'];
        }
        $fieldSet->addField('brand_mode', $selectElementType, ['name' => 'definition[brand_mode]', 'label' => $this->__('Brand'), 'title' => $this->__('Brand'), 'class' => 'select', 'values' => $this->getBrandOptions(), 'value' => $defaultValue, 'required' => true, 'tooltip' => $this->__('Required for creating new ASIN/ISBN.')])->addCustomAttribute('allowed_attribute_types', 'text,select');
        // ---------------------------------------
        $fieldSet->addField('brand_custom_value', 'text', ['name' => 'definition[brand_custom_value]', 'label' => $this->__('Brand Value'), 'title' => $this->__('Brand Value'), 'value' => $this->getHelper('Data')->escapeHtml($this->formData['brand_custom_value']), 'class' => 'input-text M2ePro-required-when-visible', 'required' => true, 'field_extra_attributes' => 'id="brand_custom_value_tr" style="display: none;"']);
        // ---------------------------------------
        $fieldSet->addField('manufacturer_custom_attribute', 'hidden', ['name' => 'definition[manufacturer_custom_attribute]', 'value' => $this->formData['manufacturer_custom_attribute']]);
        // ---------------------------------------
        $defaultValue = '';
        if ($this->formData['manufacturer_mode'] == DefinitionTemplate::MANUFACTURER_MODE_NONE || $this->formData['manufacturer_mode'] == DefinitionTemplate::MANUFACTURER_MODE_CUSTOM_VALUE) {
            $defaultValue = $this->formData['manufacturer_mode'];
        }
        $fieldSet->addField('manufacturer_mode', $selectElementType, ['name' => 'definition[manufacturer_mode]', 'label' => $this->__('Manufacturer'), 'title' => $this->__('Manufacturer'), 'values' => $this->getManufacturerOptions(), 'value' => $defaultValue, 'class' => 'select', 'required' => true, 'tooltip' => $this->__('Required for creating new ASIN/ISBN.')])->addCustomAttribute('allowed_attribute_types', 'text,select');
        // ---------------------------------------
        $fieldSet->addField('manufacturer_custom_value', 'text', ['name' => 'definition[manufacturer_custom_value]', 'label' => $this->__('Manufacturer Value'), 'title' => $this->__('Manufacturer Value'), 'value' => $this->getHelper('Data')->escapeHtml($this->formData['manufacturer_custom_value']), 'class' => 'input-text M2ePro-required-when-visible', 'required' => true, 'field_extra_attributes' => 'id="manufacturer_custom_value_tr" style="display: none;"']);
        // ---------------------------------------
        $fieldSet->addField('manufacturer_part_number_custom_attribute', 'hidden', ['name' => 'definition[manufacturer_part_number_custom_attribute]', 'value' => $this->formData['manufacturer_part_number_custom_attribute']]);
        // ---------------------------------------
        $defaultValue = '';
        if ($this->formData['manufacturer_part_number_mode'] == DefinitionTemplate::MANUFACTURER_PART_NUMBER_MODE_NONE || $this->formData['manufacturer_part_number_mode'] == DefinitionTemplate::MANUFACTURER_PART_NUMBER_MODE_CUSTOM_VALUE) {
            $defaultValue = $this->formData['manufacturer_part_number_mode'];
        }
        $fieldSet->addField('manufacturer_part_number_mode', $selectElementType, ['name' => 'definition[manufacturer_part_number_mode]', 'label' => $this->__('Manufacturer Part Number'), 'title' => $this->__('Manufacturer Part Number'), 'values' => $this->getManufacturerPartNumberOptions(), 'value' => $defaultValue, 'class' => 'select', 'tooltip' => $this->__('Manufacturer Part Number of the Product(s). Max. 40 characters.')])->addCustomAttribute('allowed_attribute_types', 'text');
        // ---------------------------------------
        $fieldSet->addField('manufacturer_part_number_custom_value', 'text', ['name' => 'definition[manufacturer_part_number_custom_value]', 'label' => $this->__('Manufacturer Part Number Value'), 'title' => $this->__('Manufacturer Part Number Value'), 'value' => $this->getHelper('Data')->escapeHtml($this->formData['manufacturer_part_number_custom_value']), 'class' => 'input-text M2ePro-required-when-visible', 'required' => true, 'field_extra_attributes' => 'id="manufacturer_part_number_custom_value_tr" style="display: none;"']);
        // ---------------------------------------
        $fieldSet->addField('general_separator_2', self::SEPARATOR, []);
        // ---------------------------------------
        $fieldSet->addField('item_package_quantity_custom_attribute', 'hidden', ['name' => 'definition[item_package_quantity_custom_attribute]', 'value' => $this->formData['item_package_quantity_custom_attribute']]);
        // ---------------------------------------
        $defaultValue = '';
        if ($this->formData['item_package_quantity_mode'] == DefinitionTemplate::ITEM_PACKAGE_QUANTITY_MODE_NONE || $this->formData['item_package_quantity_mode'] == DefinitionTemplate::ITEM_PACKAGE_QUANTITY_MODE_CUSTOM_VALUE) {
            $defaultValue = $this->formData['item_package_quantity_mode'];
        }
        $fieldSet->addField('item_package_quantity_mode', $selectElementType, ['name' => 'definition[item_package_quantity_mode]', 'label' => $this->__('Package Quantity'), 'title' => $this->__('Package Quantity'), 'values' => $this->getPackageQuantityOptions(), 'value' => $defaultValue, 'tooltip' => $this->__('The number of units included in the Item you are offering for sale,
                <br/>such that each unit is packaged for individual sale.')])->addCustomAttribute('allowed_attribute_types', 'text,select');
        // ---------------------------------------
        $fieldSet->addField('item_package_quantity_custom_value', 'text', ['name' => 'definition[item_package_quantity_custom_value]', 'label' => $this->__('Package Quantity Value'), 'title' => $this->__('Package Quantity Value'), 'value' => $this->getHelper('Data')->escapeHtml($this->formData['item_package_quantity_custom_value']), 'class' => 'input-text M2ePro-required-when-visible M2ePro-validate-greater-than', 'required' => true, 'field_extra_attributes' => 'id="item_package_quantity_custom_value_tr"', 'css_class' => 'entry-edit'])->addCustomAttribute('min_value', 1);
        // ---------------------------------------
        $fieldSet->addField('number_of_items_custom_attribute', 'hidden', ['name' => 'definition[number_of_items_custom_attribute]', 'value' => $this->formData['number_of_items_custom_attribute']]);
        // ---------------------------------------
        $defaultValue = '';
        if ($this->formData['number_of_items_mode'] == DefinitionTemplate::NUMBER_OF_ITEMS_MODE_NONE || $this->formData['number_of_items_mode'] == DefinitionTemplate::NUMBER_OF_ITEMS_MODE_CUSTOM_VALUE) {
            $defaultValue = $this->formData['number_of_items_mode'];
        }
        $fieldSet->addField('number_of_items_mode', $selectElementType, ['name' => 'definition[number_of_items_mode]', 'label' => $this->__('Number of Items'), 'title' => $this->__('Number of Items'), 'values' => $this->getNumberOfItemsOptions(), 'class' => 'M2ePro-required-when-visible', 'value' => $defaultValue, 'tooltip' => $this->__('The number of discrete Items included in the Item you are offering for sale,
                     such that each Item is not packaged for individual sale.<br/><br/>
                     <strong>For ex.</strong>, if you are selling a case of 10 packages of socks,
                     and each package contains
                     <br/>3 pairs of socks, the case would have Package Quantity = 10 and Number of Items = 30.')])->addCustomAttribute('allowed_attribute_types', 'text,select');
        // ---------------------------------------
        $fieldSet->addField('number_of_items_custom_value', 'text', ['name' => 'definition[number_of_items_custom_value]', 'label' => $this->__('Number of Items Value'), 'title' => $this->__('Number of Items Value'), 'value' => $this->getHelper('Data')->escapeHtml($this->formData['number_of_items_custom_value']), 'class' => 'input-text M2ePro-required-when-visible M2ePro-validate-greater-than', 'required' => true, 'field_extra_attributes' => 'id="number_of_items_custom_value_tr"', 'css_class' => 'entry-edit'])->addCustomAttribute('min_value', 1);
        // ---------------------------------------
        // ---------------------------------------
        // Images
        // ---------------------------------------
        $fieldSet = $form->addFieldset('magento_block_amazon_template_description_image', ['legend' => $this->__('Images'), 'collapsable' => true, 'class' => 'entry-edit']);
        // ---------------------------------------
        $fieldSet->addField('image_main_attribute', 'hidden', ['name' => 'definition[image_main_attribute]', 'value' => $this->formData['image_main_attribute']]);
        // ---------------------------------------
        $defaultValue = '';
        if ($this->formData['image_main_mode'] == DefinitionTemplate::IMAGE_MAIN_MODE_NONE || $this->formData['image_main_mode'] == DefinitionTemplate::IMAGE_MAIN_MODE_PRODUCT) {
            $defaultValue = $this->formData['image_main_mode'];
        }
        $fieldSet->addField('image_main_mode', $selectElementType, ['name' => 'definition[image_main_mode]', 'label' => $this->__('Main Image'), 'title' => $this->__('Main Image'), 'values' => $this->getImageMainOptions(), 'value' => $defaultValue, 'required' => true, 'tooltip' => $this->__('Required for creating new ASIN/ISBN.')])->addCustomAttribute('allowed_attribute_types', 'text,textarea,select,multiselect');
        // ---------------------------------------
        $fieldSet->addField('gallery_images_limit', 'hidden', ['name' => 'definition[gallery_images_limit]', 'value' => $this->formData['gallery_images_limit']]);
        // ---------------------------------------
        $fieldSet->addField('gallery_images_attribute', 'hidden', ['name' => 'definition[gallery_images_attribute]', 'value' => $this->formData['gallery_images_attribute']]);
        // ---------------------------------------
        $defaultValue = '';
        if ($this->formData['gallery_images_mode'] == DefinitionTemplate::GALLERY_IMAGES_MODE_NONE) {
            $defaultValue = $this->formData['gallery_images_mode'];
        }
        $fieldSet->addField('gallery_images_mode', $selectElementType, ['name' => 'definition[gallery_images_mode]', 'label' => $this->__('Additional Images'), 'title' => $this->__('Additional Images'), 'values' => $this->getGalleryImageOptions(), 'value' => $defaultValue, 'field_extra_attributes' => 'id="gallery_images_mode_tr"'])->addCustomAttribute('allowed_attribute_types', 'text,textarea,select,multiselect');
        // ---------------------------------------
        $fieldSet->addField('image_variation_difference_attribute', 'hidden', ['name' => 'definition[image_variation_difference_attribute]', 'value' => $this->formData['image_variation_difference_attribute']]);
        // ---------------------------------------
        $defaultValue = '';
        if ($this->formData['image_variation_difference_mode'] == DefinitionTemplate::IMAGE_VARIATION_DIFFERENCE_MODE_NONE || $this->formData['image_variation_difference_mode'] == DefinitionTemplate::IMAGE_VARIATION_DIFFERENCE_MODE_PRODUCT) {
            $defaultValue = $this->formData['image_variation_difference_mode'];
        }
        $fieldSet->addField('image_variation_difference_mode', $selectElementType, ['name' => 'definition[image_variation_difference_mode]', 'label' => $this->__('Swatch Image'), 'title' => $this->__('Swatch Image'), 'values' => $this->getSwatchImageOptions(), 'value' => $defaultValue, 'field_extra_attributes' => 'id="gallery_images_mode_tr"', 'tooltip' => $this->__('Allows to display Variations of Amazon Product by
                the main images of Child Products.')])->addCustomAttribute('allowed_attribute_types', 'text,textarea,select,multiselect');
        // ---------------------------------------
        // ---------------------------------------
        // Description
        // ---------------------------------------
        $fieldSet = $form->addFieldset('magento_block_amazon_template_description_description', ['legend' => $this->__('Description'), 'collapsable' => true, 'class' => 'entry-edit']);
        // ---------------------------------------
        $fieldSet->addField('description_mode', $selectElementType, ['name' => 'definition[description_mode]', 'label' => $this->__('Description'), 'title' => $this->__('Description'), 'values' => [['value' => DefinitionTemplate::DESCRIPTION_MODE_NONE, 'label' => $this->__('None')], ['value' => DefinitionTemplate::DESCRIPTION_MODE_PRODUCT, 'label' => $this->__('Product Description')], ['value' => DefinitionTemplate::DESCRIPTION_MODE_SHORT, 'label' => $this->__('Product Short Description')], ['value' => DefinitionTemplate::DESCRIPTION_MODE_CUSTOM, 'label' => $this->__('Custom Value')]], 'value' => $this->formData['description_mode'], 'class' => 'required-entry', 'tooltip' => $this->__('Description is limited to 2\'000 characters.')]);
        // ---------------------------------------
        $options = [];
        $helper = $this->getHelper('Data');
        foreach ($this->allAttributes as $attribute) {
            $options[] = ['value' => $attribute['code'], 'label' => $helper->escapeHtml($attribute['label'])];
        }
        //TODO enable wysiwyg
        $fieldSet->addField('description_template', 'textarea', ['name' => 'definition[description_template]', 'label' => $this->__('Description Value'), 'title' => $this->__('Description Value'), 'value' => $this->getHelper('Data')->escapeHtml($this->formData['description_template']), 'class' => 'textarea M2ePro-required-when-visible', 'required' => true, 'css_class' => 'c-custom_description_tr', 'field_extra_attributes' => 'style="display: none;"', 'after_element_html' => $this->createBlock('Magento\\Button\\MagentoAttribute')->addData(['label' => $this->__('Insert Attribute'), 'destination_id' => 'description_template', 'magento_attributes' => $options, 'class' => 'primary', 'style' => 'margin-left: 0; margin-top: 5px;'])->toHtml()]);
        // ---------------------------------------
        // ---------------------------------------
        // Product Dimensions
        // ---------------------------------------
        $fieldSet = $form->addFieldset('magento_block_amazon_template_description_product_dimensions', ['legend' => $this->__('Product Dimensions'), 'collapsable' => true, 'class' => 'entry-edit']);
        // ---------------------------------------
        $fieldSet->addField('item_dimensions_volume_mode', $selectElementType, ['name' => 'definition[item_dimensions_volume_mode]', 'label' => $this->__('Volume'), 'title' => $this->__('Volume'), 'values' => [['value' => DefinitionTemplate::DIMENSION_VOLUME_MODE_NONE, 'label' => $this->__('None')], ['value' => DefinitionTemplate::DIMENSION_VOLUME_MODE_CUSTOM_VALUE, 'label' => $this->__('Custom Value')], ['value' => DefinitionTemplate::DIMENSION_VOLUME_MODE_CUSTOM_ATTRIBUTE, 'label' => $this->__('Custom Attribute')]], 'value' => $this->formData['item_dimensions_volume_mode'], 'class' => 'select', 'tooltip' => $this->__('Physical dimensions of Product without package')]);
        // ---------------------------------------
        $lengthBlock = $this->elementFactory->create('text', ['data' => ['name' => 'definition[item_dimensions_volume_length_custom_value]', 'value' => $this->escapeHtml($this->formData['item_dimensions_volume_length_custom_value']), 'class' => 'input-text M2ePro-required-when-visible M2ePro-validation-float M2ePro-validate-greater-than']])->addCustomAttribute('min_value', '0.01');
        $lengthBlock->setForm($form);
        $widthBlock = $this->elementFactory->create('text', ['data' => ['name' => 'definition[item_dimensions_volume_width_custom_value]', 'value' => $this->escapeHtml($this->formData['item_dimensions_volume_width_custom_value']), 'class' => 'input-text M2ePro-required-when-visible M2ePro-validation-float M2ePro-validate-greater-than']])->addCustomAttribute('min_value', '0.01');
        $widthBlock->setForm($form);
        $heightBlock = $this->elementFactory->create('text', ['data' => ['name' => 'definition[item_dimensions_volume_height_custom_value]', 'value' => $this->escapeHtml($this->formData['item_dimensions_volume_height_custom_value']), 'class' => 'input-text M2ePro-required-when-visible M2ePro-validation-float M2ePro-validate-greater-than']])->addCustomAttribute('min_value', '0.01');
        $heightBlock->setForm($form);
        $fieldSet->addField('item_dimensions_volume_custom_value', self::CUSTOM_CONTAINER, ['label' => $this->__('Length x Width x Height'), 'title' => $this->__('Length x Width x Height'), 'style' => 'padding-top: 0;', 'text' => $lengthBlock->toHtml() . ' x ' . $widthBlock->toHtml() . ' x ' . $heightBlock->toHtml(), 'required' => true, 'field_extra_attributes' => 'id="item_dimensions_volume_custom_value_tr" style="display: none;"']);
        // ---------------------------------------
        $lengthBlock = $this->elementFactory->create($selectElementType, ['data' => ['name' => 'definition[item_dimensions_volume_length_custom_attribute]', 'values' => $this->getDimensionsVolumeAttributesOptions('item_dimensions_volume_length_custom_attribute'), 'class' => 'M2ePro-required-when-visible', 'style' => 'width: 30%']])->addCustomAttribute('allowed_attribute_types', 'text');
        $lengthBlock->setId('item_dimensions_volume_length_custom_attribute');
        $lengthBlock->setForm($form);
        $widthBlock = $this->elementFactory->create($selectElementType, ['data' => ['name' => 'definition[item_dimensions_volume_width_custom_attribute]', 'values' => $this->getDimensionsVolumeAttributesOptions('item_dimensions_volume_width_custom_attribute'), 'class' => 'M2ePro-required-when-visible', 'style' => 'width: 30%']])->addCustomAttribute('allowed_attribute_types', 'text');
        $widthBlock->setId('item_dimensions_volume_width_custom_attribute');
        $widthBlock->setForm($form);
        $heightBlock = $this->elementFactory->create($selectElementType, ['data' => ['name' => 'definition[item_dimensions_volume_height_custom_attribute]', 'values' => $this->getDimensionsVolumeAttributesOptions('item_dimensions_volume_height_custom_attribute'), 'class' => 'M2ePro-required-when-visible', 'style' => 'width: 30%']])->addCustomAttribute('allowed_attribute_types', 'text');
        $heightBlock->setId('item_dimensions_volume_height_custom_attribute');
        $heightBlock->setForm($form);
        $fieldSet->addField('item_dimensions_volume_custom_attribute', self::CUSTOM_CONTAINER, ['label' => $this->__('Length x Width x Height'), 'title' => $this->__('Length x Width x Height'), 'style' => 'padding-top: 0;', 'text' => $lengthBlock->toHtml() . ' x ' . $widthBlock->toHtml() . ' x ' . $heightBlock->toHtml(), 'required' => true, 'field_extra_attributes' => 'id="item_dimensions_volume_custom_attribute_tr" style="display: none;"']);
        // ---------------------------------------
        $fieldSet->addField('item_dimensions_volume_unit_of_measure_custom_value', 'hidden', ['name' => 'definition[item_dimensions_volume_unit_of_measure_custom_value]', 'value' => $this->formData['item_dimensions_volume_unit_of_measure_custom_value']]);
        // ---------------------------------------
        $fieldSet->addField('item_dimensions_volume_unit_of_measure_custom_attribute', 'hidden', ['name' => 'definition[item_dimensions_volume_unit_of_measure_custom_attribute]', 'value' => $this->formData['item_dimensions_volume_unit_of_measure_custom_attribute']]);
        // ---------------------------------------
        $fieldSet->addField('item_dimensions_volume_unit_of_measure_mode', $selectElementType, ['name' => 'definition[item_dimensions_volume_unit_of_measure_mode]', 'label' => $this->__('Measure Units'), 'title' => $this->__('Measure Units'), 'values' => $this->getMeasureUnitsOptions(DefinitionTemplate::DIMENSION_VOLUME_UNIT_OF_MEASURE_MODE_CUSTOM_VALUE, DefinitionTemplate::DIMENSION_VOLUME_UNIT_OF_MEASURE_MODE_CUSTOM_ATTRIBUTE, 'item_dimensions_volume_unit_of_measure_custom_value', 'item_dimensions_volume_unit_of_measure_custom_attribute'), 'class' => 'select M2ePro-required-when-visible', 'required' => true, 'field_extra_attributes' => 'id="item_dimensions_volume_unit_of_measure_mode_tr" style="display: none;"'])->addCustomAttribute('allowed_attribute_types', 'text');
        // ---------------------------------------
        $fieldSet->addField('item_dimensions_weight_custom_attribute', 'hidden', ['name' => 'definition[item_dimensions_weight_custom_attribute]', 'value' => $this->formData['item_dimensions_weight_custom_attribute']]);
        // ---------------------------------------
        $defaultValue = '';
        if ($this->formData['item_dimensions_weight_mode'] == DefinitionTemplate::WEIGHT_MODE_NONE || $this->formData['item_dimensions_weight_mode'] == DefinitionTemplate::WEIGHT_MODE_CUSTOM_VALUE) {
            $defaultValue = $this->formData['item_dimensions_weight_mode'];
        }
        $fieldSet->addField('item_dimensions_weight_mode', $selectElementType, ['name' => 'definition[item_dimensions_weight_mode]', 'label' => $this->__('Weight'), 'title' => $this->__('Weight'), 'values' => $this->getItemDimensionsWeightOptions(), 'value' => $defaultValue, 'class' => 'select M2ePro-required-when-visible', 'required' => true, 'tooltip' => $this->__('Physical weight of Products without package')])->addCustomAttribute('allowed_attribute_types', 'text');
        // ---------------------------------------
        $fieldSet->addField('item_dimensions_weight_custom_value', 'text', ['name' => 'definition[item_dimensions_weight_custom_value]', 'label' => $this->__('Weight Value'), 'title' => $this->__('Weight Value'), 'value' => $this->formData['item_dimensions_weight_custom_value'], 'class' => 'input-text M2ePro-required-when-visible M2ePro-validate-greater-than', 'field_extra_attributes' => 'id="item_dimensions_weight_custom_value_tr" style="display: none;"'])->addCustomAttribute('min_value', '0.01');
        // ---------------------------------------
        $fieldSet->addField('item_dimensions_weight_unit_of_measure_custom_value', 'hidden', ['name' => 'definition[item_dimensions_weight_unit_of_measure_custom_value]', 'value' => $this->formData['item_dimensions_weight_unit_of_measure_custom_value']]);
        // ---------------------------------------
        $fieldSet->addField('item_dimensions_weight_unit_of_measure_custom_attribute', 'hidden', ['name' => 'definition[item_dimensions_weight_unit_of_measure_custom_attribute]', 'value' => $this->formData['item_dimensions_weight_unit_of_measure_custom_attribute']]);
        // ---------------------------------------
        $fieldSet->addField('item_dimensions_weight_unit_of_measure_mode', $selectElementType, ['name' => 'definition[item_dimensions_weight_unit_of_measure_mode]', 'label' => $this->__('Weight Units'), 'title' => $this->__('Weight Units'), 'values' => $this->getWeightUnitOfMeasureOptions(DefinitionTemplate::DIMENSION_VOLUME_MODE_CUSTOM_VALUE, DefinitionTemplate::DIMENSION_VOLUME_MODE_CUSTOM_ATTRIBUTE, 'item_dimensions_weight_unit_of_measure_custom_value', 'item_dimensions_weight_unit_of_measure_custom_attribute'), 'required' => true, 'class' => 'select M2ePro-required-when-visible', 'field_extra_attributes' => 'id="item_dimensions_weight_unit_of_measure_mode_tr" style="display: none;"'])->addCustomAttribute('allowed_attribute_types', 'text,select');
        // ---------------------------------------
        // ---------------------------------------
        // Package Dimensions
        // ---------------------------------------
        $fieldSet = $form->addFieldset('magento_block_amazon_template_description_package_dimensions', ['legend' => $this->__('Package Dimensions'), 'collapsable' => true, 'class' => 'entry-edit']);
        // ---------------------------------------
        $fieldSet->addField('package_dimensions_volume_mode', $selectElementType, ['name' => 'definition[package_dimensions_volume_mode]', 'label' => $this->__('Volume'), 'title' => $this->__('Volume'), 'values' => [['value' => DefinitionTemplate::DIMENSION_VOLUME_MODE_NONE, 'label' => $this->__('None')], ['value' => DefinitionTemplate::DIMENSION_VOLUME_MODE_CUSTOM_VALUE, 'label' => $this->__('Custom Value')], ['value' => DefinitionTemplate::DIMENSION_VOLUME_MODE_CUSTOM_ATTRIBUTE, 'label' => $this->__('Custom Attribute')]], 'value' => $this->formData['package_dimensions_volume_mode'], 'class' => 'select', 'tooltip' => $this->__('Physical dimensions of package')]);
        // ---------------------------------------
        $lengthBlock = $this->elementFactory->create('text', ['data' => ['name' => 'definition[package_dimensions_volume_length_custom_value]', 'value' => $this->escapeHtml($this->formData['package_dimensions_volume_length_custom_value']), 'class' => 'input-text M2ePro-required-when-visible M2ePro-validation-float M2ePro-validate-greater-than']])->addCustomAttribute('min_value', '0.01');
        $lengthBlock->setForm($form);
        $widthBlock = $this->elementFactory->create('text', ['data' => ['name' => 'definition[package_dimensions_volume_width_custom_value]', 'value' => $this->escapeHtml($this->formData['package_dimensions_volume_width_custom_value']), 'class' => 'input-text M2ePro-required-when-visible M2ePro-validation-float M2ePro-validate-greater-than']])->addCustomAttribute('min_value', '0.01');
        $widthBlock->setForm($form);
        $heightBlock = $this->elementFactory->create('text', ['data' => ['name' => 'definition[package_dimensions_volume_height_custom_value]', 'value' => $this->escapeHtml($this->formData['package_dimensions_volume_height_custom_value']), 'class' => 'input-text M2ePro-required-when-visible M2ePro-validation-float M2ePro-validate-greater-than']])->addCustomAttribute('min_value', '0.01');
        $heightBlock->setForm($form);
        $fieldSet->addField('package_dimensions_volume_custom_value', self::CUSTOM_CONTAINER, ['label' => $this->__('Length x Width x Height'), 'title' => $this->__('Length x Width x Height'), 'style' => 'padding-top: 0;', 'text' => $lengthBlock->toHtml() . ' x ' . $widthBlock->toHtml() . ' x ' . $heightBlock->toHtml(), 'required' => true, 'field_extra_attributes' => 'id="package_dimensions_volume_custom_value_tr" style="display: none;"']);
        // ---------------------------------------
        $lengthBlock = $this->elementFactory->create($selectElementType, ['data' => ['name' => 'definition[package_dimensions_volume_length_custom_attribute]', 'values' => $this->getDimensionsVolumeAttributesOptions('package_dimensions_volume_length_custom_attribute'), 'class' => 'M2ePro-required-when-visible', 'style' => 'width: 30%']])->addCustomAttribute('allowed_attribute_types', 'text');
        $lengthBlock->setId('package_dimensions_volume_length_custom_attribute');
        $lengthBlock->setForm($form);
        $widthBlock = $this->elementFactory->create($selectElementType, ['data' => ['name' => 'definition[package_dimensions_volume_width_custom_attribute]', 'values' => $this->getDimensionsVolumeAttributesOptions('package_dimensions_volume_width_custom_attribute'), 'class' => 'M2ePro-required-when-visible', 'style' => 'width: 30%']])->addCustomAttribute('allowed_attribute_types', 'text');
        $widthBlock->setId('package_dimensions_volume_width_custom_attribute');
        $widthBlock->setForm($form);
        $heightBlock = $this->elementFactory->create($selectElementType, ['data' => ['name' => 'definition[package_dimensions_volume_height_custom_attribute]', 'values' => $this->getDimensionsVolumeAttributesOptions('package_dimensions_volume_height_custom_attribute'), 'class' => 'M2ePro-required-when-visible', 'style' => 'width: 30%']])->addCustomAttribute('allowed_attribute_types', 'text');
        $heightBlock->setId('package_dimensions_volume_height_custom_attribute');
        $heightBlock->setForm($form);
        $fieldSet->addField('package_dimensions_volume_custom_attribute', self::CUSTOM_CONTAINER, ['label' => $this->__('Length x Width x Height'), 'title' => $this->__('Length x Width x Height'), 'style' => 'padding-top: 0;', 'text' => $lengthBlock->toHtml() . ' x ' . $widthBlock->toHtml() . ' x ' . $heightBlock->toHtml(), 'required' => true, 'field_extra_attributes' => 'id="package_dimensions_volume_custom_attribute_tr" style="display: none;"']);
        // ---------------------------------------
        $fieldSet->addField('package_dimensions_volume_unit_of_measure_custom_value', 'hidden', ['name' => 'definition[package_dimensions_volume_unit_of_measure_custom_value]', 'value' => $this->formData['package_dimensions_volume_unit_of_measure_custom_value']]);
        // ---------------------------------------
        $fieldSet->addField('package_dimensions_volume_unit_of_measure_custom_attribute', 'hidden', ['name' => 'definition[package_dimensions_volume_unit_of_measure_custom_attribute]', 'value' => $this->formData['package_dimensions_volume_unit_of_measure_custom_attribute']]);
        // ---------------------------------------
        $fieldSet->addField('package_dimensions_volume_unit_of_measure_mode', $selectElementType, ['name' => 'definition[package_dimensions_volume_unit_of_measure_mode]', 'label' => $this->__('Measure Units'), 'title' => $this->__('Measure Units'), 'values' => $this->getMeasureUnitsOptions(DefinitionTemplate::DIMENSION_VOLUME_MODE_CUSTOM_VALUE, DefinitionTemplate::DIMENSION_VOLUME_MODE_CUSTOM_ATTRIBUTE, 'package_dimensions_volume_unit_of_measure_custom_value', 'package_dimensions_volume_unit_of_measure_custom_attribute'), 'class' => 'select M2ePro-required-when-visible', 'required' => true, 'field_extra_attributes' => 'id="package_dimensions_volume_unit_of_measure_mode_tr"
                                             style="display: none;"'])->addCustomAttribute('allowed_attribute_types', 'text,select');
        // ---------------------------------------
        // ---------------------------------------
        // Shipping Details
        // ---------------------------------------
        $fieldSet = $form->addFieldset('magento_block_amazon_template_description_shipping_details', ['legend' => $this->__('Shipping Details'), 'collapsable' => true, 'class' => 'entry-edit']);
        // ---------------------------------------
        $fieldSet->addField('package_weight_custom_attribute', 'hidden', ['name' => 'definition[package_weight_custom_attribute]', 'value' => $this->formData['package_weight_custom_attribute']]);
        // ---------------------------------------
        $defaultValue = '';
        if ($this->formData['package_weight_mode'] == DefinitionTemplate::WEIGHT_MODE_NONE || $this->formData['package_weight_mode'] == DefinitionTemplate::WEIGHT_MODE_CUSTOM_VALUE) {
            $defaultValue = $this->formData['package_weight_mode'];
        }
        $fieldSet->addField('package_weight_mode', $selectElementType, ['name' => 'definition[package_weight_mode]', 'label' => $this->__('Package Weight'), 'title' => $this->__('Package Weight'), 'values' => $this->getPackageWeightModeOptions(), 'value' => $defaultValue, 'class' => 'select M2ePro-required-when-visible', 'tooltip' => $this->__('Package Weight of the Product(s).')])->addCustomAttribute('allowed_attribute_types', 'text');
        // ---------------------------------------
        $fieldSet->addField('package_weight_custom_value', 'text', ['name' => 'definition[package_weight_custom_value]', 'label' => $this->__('Package Weight Value'), 'title' => $this->__('Package Weight Value'), 'value' => $this->getHelper('Data')->escapeHtml($this->formData['package_weight_custom_value']), 'class' => 'input-text M2ePro-required-when-visible M2ePro-validate-greater-than', 'required' => true, 'field_extra_attributes' => 'id="package_weight_custom_value_tr" style="display: none;"'])->addCustomAttribute('min_value', '0.01');
        // ---------------------------------------
        $fieldSet->addField('package_weight_unit_of_measure_custom_value', 'hidden', ['name' => 'definition[package_weight_unit_of_measure_custom_value]', 'value' => $this->formData['package_weight_unit_of_measure_custom_value']]);
        // ---------------------------------------
        $fieldSet->addField('package_weight_unit_of_measure_custom_attribute', 'hidden', ['name' => 'definition[package_weight_unit_of_measure_custom_attribute]', 'value' => $this->formData['package_weight_unit_of_measure_custom_attribute']]);
        // ---------------------------------------
        $fieldSet->addField('package_weight_unit_of_measure_mode', $selectElementType, ['name' => 'definition[package_weight_unit_of_measure_mode]', 'label' => $this->__('Package Weight Units'), 'title' => $this->__('Package Weight Units'), 'values' => $this->getWeightUnitOfMeasureOptions(DefinitionTemplate::WEIGHT_UNIT_OF_MEASURE_MODE_CUSTOM_VALUE, DefinitionTemplate::WEIGHT_UNIT_OF_MEASURE_MODE_CUSTOM_ATTRIBUTE, 'package_weight_unit_of_measure_custom_value', 'package_weight_unit_of_measure_custom_attribute'), 'required' => true, 'class' => 'select M2ePro-required-when-visible', 'field_extra_attributes' => 'id="package_weight_unit_of_measure_mode_tr" style="display: none;"'])->addCustomAttribute('allowed_attribute_types', 'text,select');
        // ---------------------------------------
        $fieldSet->addField('shipping_weight_custom_attribute', 'hidden', ['name' => 'definition[shipping_weight_custom_attribute]', 'value' => $this->formData['shipping_weight_custom_attribute']]);
        // ---------------------------------------
        $defaultValue = '';
        if ($this->formData['shipping_weight_mode'] == DefinitionTemplate::WEIGHT_MODE_NONE || $this->formData['shipping_weight_mode'] == DefinitionTemplate::WEIGHT_MODE_CUSTOM_VALUE) {
            $defaultValue = $this->formData['shipping_weight_mode'];
        }
        $fieldSet->addField('shipping_weight_mode', $selectElementType, ['name' => 'definition[shipping_weight_mode]', 'label' => $this->__('Shipping Weight'), 'title' => $this->__('Shipping Weight'), 'values' => $this->getShippingWeightModeOptions(), 'value' => $defaultValue, 'class' => 'select M2ePro-required-when-visible', 'tooltip' => $this->__('Shipping Weight of the Product(s).')])->addCustomAttribute('allowed_attribute_types', 'text');
        // ---------------------------------------
        $fieldSet->addField('shipping_weight_custom_value', 'text', ['name' => 'definition[shipping_weight_custom_value]', 'label' => $this->__('Shipping Weight Value'), 'title' => $this->__('Shipping Weight Value'), 'value' => $this->getHelper('Data')->escapeHtml($this->formData['shipping_weight_custom_value']), 'class' => 'input-text M2ePro-required-when-visible M2ePro-validate-greater-than', 'required' => true, 'field_extra_attributes' => 'id="shipping_weight_custom_value_tr" style="display: none;"'])->addCustomAttribute('min_value', '0.01');
        // ---------------------------------------
        $fieldSet->addField('shipping_weight_unit_of_measure_custom_value', 'hidden', ['name' => 'definition[shipping_weight_unit_of_measure_custom_value]', 'value' => $this->formData['shipping_weight_unit_of_measure_custom_value']]);
        // ---------------------------------------
        $fieldSet->addField('shipping_weight_unit_of_measure_custom_attribute', 'hidden', ['name' => 'definition[shipping_weight_unit_of_measure_custom_attribute]', 'value' => $this->formData['shipping_weight_unit_of_measure_custom_attribute']]);
        // ---------------------------------------
        $fieldSet->addField('shipping_weight_unit_of_measure_mode', $selectElementType, ['name' => 'definition[shipping_weight_unit_of_measure_mode]', 'label' => $this->__('Shipping Weight Units'), 'title' => $this->__('Shipping Weight Units'), 'values' => $this->getWeightUnitOfMeasureOptions(DefinitionTemplate::WEIGHT_UNIT_OF_MEASURE_MODE_CUSTOM_VALUE, DefinitionTemplate::WEIGHT_UNIT_OF_MEASURE_MODE_CUSTOM_ATTRIBUTE, 'shipping_weight_unit_of_measure_custom_value', 'shipping_weight_unit_of_measure_custom_attribute'), 'required' => true, 'class' => 'select M2ePro-required-when-visible', 'field_extra_attributes' => 'id="shipping_weight_unit_of_measure_mode_tr" style="display: none;"'])->addCustomAttribute('allowed_attribute_types', 'text,select');
        // ---------------------------------------
        // ---------------------------------------
        // Keywords
        // ---------------------------------------
        $fieldSet = $form->addFieldset('magento_block_amazon_template_description_keywords', ['legend' => $this->__('Keywords'), 'collapsable' => true, 'class' => 'entry-edit']);
        // ---------------------------------------
        $fieldSet->addField('target_audience_mode', $selectElementType, ['name' => 'definition[target_audience_mode]', 'label' => $this->__('Target Audience Mode'), 'title' => $this->__('Target Audience Mode'), 'values' => [['value' => DefinitionTemplate::TARGET_AUDIENCE_MODE_NONE, 'label' => $this->__('None')], ['value' => DefinitionTemplate::TARGET_AUDIENCE_MODE_CUSTOM, 'label' => $this->__('Custom Value')]], 'value' => $this->formData['target_audience_mode'], 'tooltip' => $this->__('For whom the Product is intended.')]);
        // ---------------------------------------
        $this->appendKeywordsFields($fieldSet, 4, 'target_audience');
        $fieldSet->addField('target_audience_mode_separator', self::SEPARATOR, []);
        // ---------------------------------------
        $fieldSet->addField('search_terms_mode', $selectElementType, ['name' => 'definition[search_terms_mode]', 'label' => $this->__('Search Terms Mode'), 'title' => $this->__('Search Terms Mode'), 'values' => [['value' => DefinitionTemplate::SEARCH_TERMS_MODE_NONE, 'label' => $this->__('None')], ['value' => DefinitionTemplate::SEARCH_TERMS_MODE_CUSTOM, 'label' => $this->__('Custom Value')]], 'value' => $this->formData['search_terms_mode'], 'tooltip' => $this->__('Provide specific Search Terms to help customers find your Product(s) on Amazon.')]);
        // ---------------------------------------
        $this->appendKeywordsFields($fieldSet, 5, 'search_terms');
        $fieldSet->addField('search_terms_mode_separator', self::SEPARATOR, []);
        // ---------------------------------------
        $fieldSet->addField('bullet_points_mode', $selectElementType, ['name' => 'definition[bullet_points_mode]', 'label' => $this->__('Bullet Points Mode'), 'title' => $this->__('Bullet Points Mode'), 'values' => [['value' => DefinitionTemplate::BULLET_POINTS_MODE_NONE, 'label' => $this->__('None')], ['value' => DefinitionTemplate::BULLET_POINTS_MODE_CUSTOM, 'label' => $this->__('Custom Value')]], 'value' => $this->formData['bullet_points_mode'], 'tooltip' => $this->__('Allows highlighting some of the Product\'s most important qualities.')]);
        // ---------------------------------------
        $this->appendKeywordsFields($fieldSet, 5, 'bullet_points');
        // ---------------------------------------
        return parent::_prepareForm();
    }
Exemplo n.º 30
0
    protected function _prepareForm()
    {
        $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'method' => 'post', 'action' => 'javascript:void(0)', 'enctype' => 'multipart/form-data', 'class' => 'admin__scope-old']]);
        /** @var \Ess\M2ePro\Helper\Magento\Attribute $magentoAttributeHelper */
        $magentoAttributeHelper = $this->getHelper('Magento\\Attribute');
        $attributesByTypes = array('text' => $magentoAttributeHelper->filterByInputTypes($this->getData('general_attributes'), array('text')));
        $formData = $this->getListingData();
        // Identifiers Settings
        $fieldset = $form->addFieldset('identifiers_settings_fieldset', ['legend' => $this->__('Identifiers Settings'), 'collapsable' => false]);
        $fieldset->addField('general_id_custom_attribute', 'hidden', ['name' => 'general_id_custom_attribute', 'value' => $formData['general_id_custom_attribute']]);
        $preparedAttributes = [];
        $showWarning = false;
        if ($formData['general_id_mode'] == \Ess\M2ePro\Model\Amazon\Listing::GENERAL_ID_MODE_CUSTOM_ATTRIBUTE && !$magentoAttributeHelper->isExistInAttributesArray($formData['general_id_custom_attribute'], $attributesByTypes['text']) && $formData['general_id_custom_attribute'] != '') {
            $attrs = ['attribute_code' => $formData['general_id_custom_attribute'], 'selected' => 'selected'];
            $preparedAttributes[] = ['attrs' => $attrs, 'value' => \Ess\M2ePro\Model\Amazon\Listing::GENERAL_ID_MODE_CUSTOM_ATTRIBUTE, 'label' => $magentoAttributeHelper->getAttributeLabel($formData['general_id_custom_attribute'])];
        }
        foreach ($attributesByTypes['text'] as $attribute) {
            $attrs = ['attribute_code' => $attribute['code']];
            if ($formData['general_id_mode'] == \Ess\M2ePro\Model\Amazon\Listing::GENERAL_ID_MODE_CUSTOM_ATTRIBUTE && $attribute['code'] == $formData['general_id_custom_attribute']) {
                $attrs['selected'] = 'selected';
            }
            $preparedAttributes[] = ['attrs' => $attrs, 'value' => \Ess\M2ePro\Model\Amazon\Listing::GENERAL_ID_MODE_CUSTOM_ATTRIBUTE, 'label' => $attribute['label']];
        }
        $fieldset->addField('general_id_mode', self::SELECT, ['name' => 'general_id_mode', 'label' => $this->__('ASIN / ISBN'), 'class' => 'M2ePro-custom-attribute-can-be-created', 'values' => [\Ess\M2ePro\Model\Amazon\Listing::GENERAL_ID_MODE_NOT_SET => $this->__('Not Set'), ['label' => $this->__('Magento Attributes'), 'value' => $preparedAttributes, 'attrs' => ['class' => 'M2ePro-custom-attribute-optgroup']]], 'value' => $formData['general_id_mode'] != Listing::GENERAL_ID_MODE_CUSTOM_ATTRIBUTE ? $formData['general_id_mode'] : '', 'tooltip' => $this->__('This Setting is the source of value for ASIN/ISBN will be used at the time of
                    Automatic Search of Amazon Products.'), 'after_element_html' => !$showWarning ? '' : <<<HTML
<div class="warning-tooltip">
    <div class="m2epro-field-tooltip m2epro-field-tooltip-warning admin__field-tooltip">
        <a class="admin__field-tooltip-action" href="javascript://"></a>
        <div class="admin__field-tooltip-content">
            Magento Attribute you have chosen earlier is using not for all
            Attribute Sets or has type different from acceptable to use for this Option. <br/><br/>
            Please, select another valid Magento Attribute from the list or add selected
            Attribute to all Attributes Sets of Magento.
        </div>
    </div>
</div>
HTML
]);
        $fieldset->addField('worldwide_id_custom_attribute', 'hidden', ['name' => 'worldwide_id_custom_attribute', 'value' => $formData['worldwide_id_custom_attribute']]);
        $preparedAttributes = [];
        $showWarning = false;
        if ($formData['worldwide_id_mode'] == \Ess\M2ePro\Model\Amazon\Listing::WORLDWIDE_ID_MODE_CUSTOM_ATTRIBUTE && !$magentoAttributeHelper->isExistInAttributesArray($formData['worldwide_id_custom_attribute'], $attributesByTypes['text']) && $formData['worldwide_id_custom_attribute'] != '') {
            $attrs = ['attribute_code' => $formData['worldwide_id_custom_attribute'], 'selected' => 'selected'];
            $preparedAttributes[] = ['attrs' => $attrs, 'value' => \Ess\M2ePro\Model\Amazon\Listing::WORLDWIDE_ID_MODE_CUSTOM_ATTRIBUTE, 'label' => $magentoAttributeHelper->getAttributeLabel($formData['worldwide_id_custom_attribute'])];
        }
        foreach ($attributesByTypes['text'] as $attribute) {
            $attrs = ['attribute_code' => $attribute['code']];
            if ($formData['worldwide_id_mode'] == \Ess\M2ePro\Model\Amazon\Listing::WORLDWIDE_ID_MODE_CUSTOM_ATTRIBUTE && $attribute['code'] == $formData['worldwide_id_custom_attribute']) {
                $attrs['selected'] = 'selected';
            }
            $preparedAttributes[] = ['attrs' => $attrs, 'value' => \Ess\M2ePro\Model\Amazon\Listing::WORLDWIDE_ID_MODE_CUSTOM_ATTRIBUTE, 'label' => $attribute['label']];
        }
        $fieldset->addField('worldwide_id_mode', self::SELECT, ['name' => 'worldwide_id_mode', 'label' => $this->__('UPC / EAN'), 'class' => 'M2ePro-custom-attribute-can-be-created', 'values' => [\Ess\M2ePro\Model\Amazon\Listing::WORLDWIDE_ID_MODE_NOT_SET => $this->__('Not Set'), ['label' => $this->__('Magento Attributes'), 'value' => $preparedAttributes, 'attrs' => ['class' => 'M2ePro-custom-attribute-optgroup']]], 'value' => $formData['worldwide_id_mode'] != Listing::WORLDWIDE_ID_MODE_CUSTOM_ATTRIBUTE ? $formData['worldwide_id_mode'] : '', 'tooltip' => $this->__('This Setting is the source of value for UPC/EAN will be used at the time of
                    Automatic Search of Amazon Products.'), 'after_element_html' => !$showWarning ? '' : <<<HTML
<div class="warning-tooltip">
    <div class="m2epro-field-tooltip m2epro-field-tooltip-warning admin__field-tooltip">
        <a class="admin__field-tooltip-action" href="javascript://"></a>
        <div class="admin__field-tooltip-content">
            Magento Attribute you have chosen earlier is used not for all Attribute Sets or has type
            different from acceptable to use for this Option. <br/><br/>
            Please, select another valid Magento Attribute from the list or add selected Attribute to
            all Attributes Sets of Magento.
        </div>
    </div>
</div>
HTML
]);
        // Additional Settings
        $fieldset = $form->addFieldset('additional_settings_fieldset', ['legend' => $this->__('Additional Settings'), 'collapsable' => false]);
        $fieldset->addField('search_by_magento_title_mode', 'select', ['name' => 'search_by_magento_title_mode', 'label' => $this->__('Search by Product Name'), 'class' => 'M2ePro-custom-attribute-can-be-created', 'values' => [\Ess\M2ePro\Model\Amazon\Listing::SEARCH_BY_MAGENTO_TITLE_MODE_NONE => $this->__('Disable'), \Ess\M2ePro\Model\Amazon\Listing::SEARCH_BY_MAGENTO_TITLE_MODE_YES => $this->__('Enable')], 'value' => $formData['search_by_magento_title_mode'], 'tooltip' => $this->__('<p>Enable this additional Setting if you want M2E Pro to perform the search for Amazon 
                    Products based on Magento Product Name.</p><br>
                    <p><strong>Please note</strong> that this setting is not applied to search for the available 
                    Amazon Products during the List action.</p>')]);
        $form->setUseContainer($this->useFormContainer);
        $this->setForm($form);
        return parent::_prepareForm();
    }