Exemplo n.º 1
0
 protected function _toHtml()
 {
     if ($this->getRequest()->getParam('step')) {
         $breadcrumb = $this->createBlock('Ebay\\Listing\\Create\\Breadcrumb');
         $breadcrumb->setSelectedStep((int) $this->getRequest()->getParam('step', 2));
         return $breadcrumb->_toHtml() . parent::_toHtml();
     }
     return parent::_toHtml();
 }
Exemplo n.º 2
0
 protected function _toHtml()
 {
     $helpBlock = $this->createBlock('HelpBlock')->setData(['content' => $this->__('
         In order to prove that this is your Product, you need to provide SKU of the respective Product
         in your Amazon Inventory. Please follow the Rules below to avoid issues:
         <ul class="list">
             <li>The SKU has to be related to Parent Product in your Amazon Inventory;</li>
             <li>ASIN(s)/ISBN(s) in M2E Pro and in Amazon Inventory have to be the same;</li>
             <li>The Product in the Amazon Inventory has to be visible via Amazon API.</li>
         </ul>')]);
     return '<div id="manage_variation_sku_popup">' . $helpBlock->toHtml() . parent::_toHtml() . '</div>';
 }
Exemplo n.º 3
0
    protected function _toHtml()
    {
        $productsIds = implode(',', $this->getProductsIds());
        $this->js->add(<<<JS
    require([
        'Magento_Ui/js/modal/modal'
    ],function(modal) {

        \$('mode1same').observe('change', function (e) {
            \$('edit_description_template').show();
        });
    
        \$('edit_form').observe('change', function(e) {
            if (e.target.tagName != 'INPUT') {
                return;
            }
    
            if (e.target.value != 'same') {
                \$('edit_description_template').hide();
            } else {
                \$('edit_description_template').show();
            }
        });
    
        createTemplateDescriptionInNewTab = function(stepWindowUrl) {
            var win = window.open(stepWindowUrl);
    
            var intervalId = setInterval(function(){
                if (!win.closed) {
                    return;
                }
    
                clearInterval(intervalId);
    
                loadTemplateDescriptionGrid();
            }, 1000);
        };
    
        loadTemplateDescriptionGrid = function() {
    
            new Ajax.Request(
                '{$this->getUrl('*/amazon_listing_product_template_description/viewTemplateDescriptionsGrid')}', {
                method: 'post',
                parameters: {
                    products_ids : filteredProductsIds,
                    check_is_new_asin_accepted : 1,
                    map_to_template_js_fn : 'selectTemplateDescription'
                },
                onSuccess: function (transport) {
                    \$('template_description_grid').update(transport.responseText);
                    \$('template_description_grid').show();
    
                    var newLink = \$('template_description_addNew_link'),
                        refreshBtn = \$('description_template_refresh_btn');
    
                    if (newLink) {
                        \$('template_description_addNew_link').onclick = function () {
                            createTemplateDescriptionInNewTab(M2ePro.url.get('newTemplateDescriptionUrl'))
                       };
                    }
                    
                    if (refreshBtn) {
                        \$('description_template_refresh_btn').onclick = function () {
                            loadTemplateDescriptionGrid();
                        };
                    }
                }
            })
        };
    
        descriptionTemplateModeFormSubmit = function()
        {
            if (\$('mode1same').checked && \$('description_template_id').value == '') {
                \$('same_description_template_error').show();
                return;
            }
            \$('edit_form').submit();
        };
    
        selectTemplateDescription = function(el, templateId)
        {
            \$('description_template_id').value = templateId;
            \$('products_ids').value = filteredProductsIds;
            \$('description_template_title').innerHTML = el.up('tr').down('td').down('a').innerHTML;
            \$('same_description_template_error').hide();
            popup.modal('closeModal');
        };
    
        var modeElement = \$\$('input[value="{$this->getDescriptionTemplateMode()}"]').shift();
    
        modeElement.checked = true;
        if (modeElement.value != 'same') {
            \$('edit_description_template').hide();
        } else {
            \$('edit_description_template').show();
        }
    
        \$('edit_description_template').observe('click', function(event) {
    
            var popupContent = '';
            new Ajax.Request('{$this->getUrl('*/amazon_listing_product/mapToNewAsin')}', {
                method: 'post',
                parameters: {
                    products_ids : '{$productsIds}'
                },
                onSuccess: function (transport) {
                    if (!transport.responseText.isJSON()) {
                        return;
                    }
    
                    var response = transport.responseText.evalJSON();
    
                    filteredProductsIds = response.products_ids;
                    
                    if (!\$('template_description_pop_up_content')) {
                        \$('html-body').insert({bottom: response.html});
                    }
        
                    popup = jQuery('#template_description_pop_up_content');
        
                    modal({
                        title: '{$this->__('Please select the Description Policy for the process of New ASIN/ISBN creation')}',
                        type: 'slide',
                        buttons: [{
                            text: '{$this->__('Add New Description Policy')}',
                            class: 'action primary ',
                            click: function () {
                                createTemplateDescriptionInNewTab(M2ePro.url.get('newTemplateDescriptionUrl'))
                            }
                        }]
                    }, popup);
        
                    popup.modal('openModal');
            
                    loadTemplateDescriptionGrid();
                }
            });                 
    
        });
    });
JS
);
        return parent::_toHtml();
    }
Exemplo n.º 4
0
    protected function _toHtml()
    {
        $this->jsUrl->addUrls(['formSubmit' => $this->getUrl('m2epro/ebay_marketplace/save'), 'logViewUrl' => $this->getUrl('*/ebay_synchronization_log/index', array('back' => $this->getHelper('Data')->makeBackUrlParam('*/ebay_synchronization/index'))), 'runSynchNow' => $this->getUrl('*/ebay_marketplace/runSynchNow'), 'synchCheckProcessingNow' => $this->getUrl('*/ebay_synchronization/synchCheckProcessingNow')]);
        $this->jsUrl->addUrls($this->getHelper('Data')->getControllerActions('Ebay\\Marketplace'));
        $this->jsUrl->addUrls($this->getHelper('Data')->getControllerActions('Ebay\\Category'));
        $this->jsTranslator->addTranslations(['Settings have been saved.' => $this->__('Settings have been saved.'), 'You must select at least one Site you will work with.' => $this->__('You must select at least one Site you will work with.'), 'Another Synchronization Is Already Running.' => $this->__('Another Synchronization Is Already Running.'), 'Getting information. Please wait ...' => $this->__('Getting information. Please wait ...'), 'Preparing to start. Please wait ...' => $this->__('Preparing to start. Please wait ...'), 'Synchronization has successfully ended.' => $this->__('Synchronization has successfully ended.'), 'Synchronization ended with warnings. <a target="_blank" href="%url%">View Log</a> for details.' => $this->__('Synchronization ended with warnings. <a target="_blank" href="%url%">View Log</a> for details.'), 'Synchronization ended with errors. <a target="_blank" href="%url%">View Log</a> for details.' => $this->__('Synchronization ended with errors. <a target="_blank" href="%url%">View Log</a> for details.'), 'Some eBay Categories were deleted from eBay. Click <a target="_blank" href="%url%">here</a> to check.' => $this->__('Some eBay Categories were deleted from eBay.
                    Click <a target="_blank" href="%url%">here</a> to check.')]);
        $storedStatuses = json_encode($this->storedStatuses);
        $this->js->addOnReadyJs(<<<JS
            require([
                'M2ePro/Marketplace',
                'M2ePro/Ebay/MarketplaceSynchProgress',
                'M2ePro/Plugin/ProgressBar',
                'M2ePro/Plugin/AreaWrapper'
            ], function() {
                window.MarketplaceProgressBarObj = new ProgressBar('marketplaces_progress_bar');
                window.MarketplaceWrapperObj = new AreaWrapper('marketplaces_content_container');

                window.MarketplaceProgressObj =
                    new EbayMarketplaceSynchProgress(MarketplaceProgressBarObj, MarketplaceWrapperObj );
                window.MarketplaceObj = new Marketplace(MarketplaceProgressObj, {$storedStatuses});
                window.MarketplaceProgressObj.initPageCheckState();
            });
JS
);
        return parent::_toHtml();
    }
Exemplo n.º 5
0
    protected function _toHtml()
    {
        $this->css->add(<<<CSS
.warning-tooltip {
    display: inline-block;
    width: 40px;
} 
        
.warning-tooltip .admin__field-tooltip .admin__field-tooltip-action:before {
    content: '\\e623';
    display: inline-block;
}      
CSS
);
        $this->jsPhp->addConstants($this->getHelper('Data')->getClassConstants('\\Ess\\M2ePro\\Model\\Amazon\\Listing'));
        $this->js->add(<<<JS
require([
    'M2ePro/Amazon/Listing/Create/Search'
], function(){

    window.AmazonListingCreateSearchObj = new AmazonListingCreateSearch();

    \$('general_id_mode').observe('change', AmazonListingCreateSearchObj.general_id_mode_change);
    \$('worldwide_id_mode').observe('change', AmazonListingCreateSearchObj.worldwide_id_mode_change);

});
JS
);
        return parent::_toHtml();
    }
Exemplo n.º 6
0
    protected function _toHtml()
    {
        $this->css->add(<<<CSS
    #variation_manager_product_options_form select {
        min-width: 200px;
    }
CSS
);
        //        TODO
        //        $vocabularyAttributesBlock = $this->getLayout()->createBlock(
        //            'M2ePro/adminhtml_common_amazon_listing_variation_product_vocabularyAttributesPopup'
        //        );
        //
        //        $vocabularyOptionsBlock = $this->getLayout()->createBlock(
        //            'M2ePro/adminhtml_common_amazon_listing_variation_product_vocabularyOptionsPopup'
        //        );
        return $this->getWarnings() . parent::_toHtml();
    }
Exemplo n.º 7
0
 protected function _toHtml()
 {
     return $this->getGlobalNotice() . parent::_toHtml();
 }
Exemplo n.º 8
0
    protected function _toHtml()
    {
        $attributeSets = $this->getHelper('Magento\\AttributeSet')->getAll(\Ess\M2ePro\Helper\Magento\AbstractHelper::RETURN_TYPE_IDS);
        $templateData = $this->getTemplateData();
        $nick = $this->getTemplateNick();
        $this->jsUrl->addUrls(['ebay_template/getTemplateHtml' => $this->getUrl('*/ebay_template/getTemplateHtml', ['account_id' => NULL, 'attribute_sets' => implode(',', $attributeSets), 'id' => $this->getTemplateId(), 'nick' => $nick, 'mode' => \Ess\M2ePro\Model\Ebay\Template\Manager::MODE_TEMPLATE, 'data_force' => true]), 'ebay_template/isTitleUnique' => $this->getUrl('*/ebay_template/isTitleUnique', ['id' => $this->getTemplateId(), 'nick' => $nick]), 'deleteAction' => $this->getUrl('*/ebay_template/delete', ['id' => $this->getTemplateId(), 'nick' => $nick])]);
        $this->jsTranslator->addTranslations(['Policy Title is not unique.' => $this->__('Policy Title is not unique.'), 'Do not show any more' => $this->__('Do not show this message anymore'), 'Save Policy' => $this->__('Save Policy')]);
        $this->js->addRequireJs(['form' => 'M2ePro/Ebay/Template/Edit/Form', 'jquery' => 'jquery'], <<<JS

        window.EbayTemplateEditObj = new EbayTemplateEdit();
        EbayTemplateEditObj.templateNick = '{$this->getTemplateNick()}';
        EbayTemplateEditObj.initObservers();
JS
);
        return parent::_toHtml();
    }
Exemplo n.º 9
0
    protected function _toHtml()
    {
        $helpBlock = $this->createBlock('HelpBlock')->setData(['content' => $this->__('To sell Amazon Child Products it is necessary to set correspondence between Magento Variations
                and Amazon Variations. <br/><br/>

                For that you should select available unused Options of Attributes of Magento Product and available
                unused Options of Amazon Parent Product. After clicking of <i class="underline">"Confirm"</i> Button,
                Child Product will be added to the Grid and ready for List Action. <br/><br/>

                In case you are the Creator of Amazon Parent Product, you will be able to create New Child ASIN/ISBN
                for this Parent Product. To do this it is just enough to select available Options of Magento
                Product Attributes, New Child ASIN/ISBN will be created for. <br/><br/>

                <b>Note:</b> You can set matching of Magento Product Attributes and Amazon Parent Product Attributes
                in Settings Tab\'s Block Variation Attributes.')]);
        return '<div id="variation_manager_product_options_form_container">' . $helpBlock->toHtml() . parent::_toHtml() . '</div>';
    }
Exemplo n.º 10
0
 protected function _toHtml()
 {
     return '<div id="additional_autoaction_title_text" style="display: none">' . $this->getBlockTitle() . '</div>' . '<div id="block-content-wrapper"><div id="data_container">' . parent::_toHtml() . '</div></div>';
 }
Exemplo n.º 11
0
    protected function _toHtml()
    {
        $this->js->addRequireJs(['form' => 'M2ePro/Ebay/Template/ReturnPolicy'], <<<JS

        window.ebayTemplateReturnPolicyObj = new EbayTemplateReturnPolicy();
        ebayTemplateReturnPolicyObj.initObservers();
JS
);
        return parent::_toHtml();
    }
Exemplo n.º 12
0
    protected function _toHtml()
    {
        $selectedCategories = array();
        if ($this->getRequest()->getParam('group_id')) {
            $selectedCategories = $this->activeRecordFactory->getObject('Listing\\Auto\\Category')->getCollection()->addFieldToFilter('group_id', $this->getRequest()->getParam('group_id'))->addFieldToFilter('category_id', array('neq' => 0))->getColumnValues('category_id');
        }
        /** @var \Ess\M2ePro\Block\Adminhtml\Listing\Category\Tree $block */
        $block = $this->createBlock('Listing\\Category\\Tree');
        $block->setCallback('ListingAutoActionObj.magentoCategorySelectCallback');
        $block->setSelectedCategories($selectedCategories);
        $confirmMessage = <<<HTML
        <div id="dialog_confirm_content" style="display: none;">
            <div>
                {$this->__('This Category is already used in the Rule %s.
                    If you press "Confirm" Button, Category will be removed from that Rule.')}
            </div>
        </div>
HTML;
        $this->css->add('label.mage-error[for="validate_category_selection"] { width: 230px !important; left: 13px !important; }');
        return '<div id="category_child_data_container">
                    <div id="category_tree_container">' . $block->toHtml() . '</div>
                    <div id="category_form_container">' . parent::_toHtml() . '</div>
                </div><div style="clear: both;"></div>
                <div><form id="validate_category_selection_form"><input type="hidden"
                            name="validate_category_selection"
                            id="validate_category_selection"
                            style="width: 255px;"
                            class="M2ePro-validate-category-selection" /></form>
                </div>' . $confirmMessage;
    }
Exemplo n.º 13
0
    protected function _toHtml()
    {
        $this->jsTranslator->addTranslations(['Payment method should be specified.' => $this->__('Payment method should be specified.')]);
        $this->js->addRequireJs(['form' => 'M2ePro/Ebay/Template/Payment'], <<<JS

        window.EbayTemplatePaymentObj = new EbayTemplatePayment();
        EbayTemplatePaymentObj.initObservers();
JS
);
        return parent::_toHtml();
    }
Exemplo n.º 14
0
    protected function _toHtml()
    {
        $this->jsTranslator->addTranslations(['condition_note_length_error' => $this->__('Must be not more than 2000 characters long.'), 'sku_modification_custom_value_error' => $this->__('%value% placeholder should be specified'), 'sku_modification_custom_value_max_length_error' => $this->__('The SKU length must be less than %value%.', \Ess\M2ePro\Model\Amazon\Listing\Product\Action\Type\ListAction\Validator\Sku\General::SKU_MAX_LENGTH)]);
        $this->jsUrl->add($this->getUrl('*/amazon_template_sellingFormat/new', ['wizard' => $this->getRequest()->getParam('wizard')]), 'addNewSellingFormatTemplate');
        $this->jsUrl->add($this->getUrl('*/amazon_template_synchronization/new', ['wizard' => $this->getRequest()->getParam('wizard')]), 'addNewSynchronizationTemplate');
        $this->jsUrl->add($this->getUrl('*/amazon_template_sellingFormat/edit', ['wizard' => $this->getRequest()->getParam('wizard')]), 'editSellingFormatTemplate');
        $this->jsUrl->add($this->getUrl('*/amazon_template_synchronization/edit', ['wizard' => $this->getRequest()->getParam('wizard')]), 'editSynchronizationTemplate');
        $this->jsUrl->add($this->getUrl('*/general/modelGetAll', ['model' => 'Template_SellingFormat', 'id_field' => 'id', 'data_field' => 'title', 'sort_field' => 'title', 'sort_dir' => 'ASC', 'component_mode' => \Ess\M2ePro\Helper\Component\Amazon::NICK]), 'getSellingFormatTemplates');
        $this->jsUrl->add($this->getUrl('*/general/modelGetAll', ['model' => 'Template_Synchronization', 'id_field' => 'id', 'data_field' => 'title', 'sort_field' => 'title', 'sort_dir' => 'ASC', 'component_mode' => \Ess\M2ePro\Helper\Component\Amazon::NICK]), 'getSynchronizationTemplates');
        $this->jsPhp->addConstants($this->getHelper('Data')->getClassConstants('\\Ess\\M2ePro\\Helper\\Component\\Amazon'));
        $this->jsPhp->addConstants($this->getHelper('Data')->getClassConstants('\\Ess\\M2ePro\\Model\\Listing'));
        $this->jsPhp->addConstants($this->getHelper('Data')->getClassConstants('\\Ess\\M2ePro\\Model\\Amazon\\Listing'));
        $this->jsPhp->addConstants($this->getHelper('Data')->getClassConstants('\\Ess\\M2ePro\\Model\\Amazon\\Listing\\Product\\Action\\Type\\ListAction\\Validator\\Sku\\General'));
        $this->js->add(<<<JS
require([
    'M2ePro/Amazon/Listing/Settings',
    'M2ePro/Amazon/Listing/Create/Selling',
    'M2ePro/Plugin/Magento/Attribute/Button',
], function(){   
    window.AmazonListingSettingsObj = new AmazonListingSettings();
    window.AmazonListingCreateSellingObj = new AmazonListingCreateSelling();
    window.MagentoAttributeButtonObj = new MagentoAttributeButton();

    \$('template_selling_format_id').observe('change', function() {
        if (\$('template_selling_format_id').value) {
            \$('edit_selling_format_template_link').show();
        } else {
            \$('edit_selling_format_template_link').hide();
        }
    });
    \$('template_selling_format_id').simulate('change');

    \$('template_synchronization_id').observe('change', function() {
        if (\$('template_synchronization_id').value) {
            \$('edit_synchronization_template_link').show();
        } else {
            \$('edit_synchronization_template_link').hide();
        }
    });
    \$('template_synchronization_id').simulate('change');

    \$('template_selling_format_id').observe('change', AmazonListingSettingsObj.selling_format_template_id_change)
    if (\$('template_selling_format_id').value) {
        \$('template_selling_format_id').simulate('change');
    }

    \$('template_synchronization_id').observe('change', AmazonListingSettingsObj.synchronization_template_id_change)
    if (\$('template_synchronization_id').value) {
        \$('template_synchronization_id').simulate('change');
    }

    \$('sku_mode').observe('change', AmazonListingCreateSellingObj.sku_mode_change);

    \$('sku_modification_mode')
        .observe('change', AmazonListingCreateSellingObj.sku_modification_mode_change);

    \$('condition_mode').observe('change', AmazonListingCreateSellingObj.condition_mode_change)
        .simulate('change');

    \$('condition_note_mode').observe('change', AmazonListingCreateSellingObj.condition_note_mode_change)
        .simulate('change');

    \$('image_main_mode')
        .observe('change', AmazonListingCreateSellingObj.image_main_mode_change)
        .simulate('change');

    \$('gallery_images_mode')
        .observe('change', AmazonListingCreateSellingObj.gallery_images_mode_change)
        .simulate('change');

    \$('gift_wrap_mode')
        .observe('change', AmazonListingCreateSellingObj.gift_wrap_mode_change)
        .simulate('change');

    \$('gift_message_mode')
        .observe('change', AmazonListingCreateSellingObj.gift_message_mode_change)
        .simulate('change');

    \$('handling_time_mode')
        .observe('change', AmazonListingCreateSellingObj.handling_time_mode_change)
        .simulate('change');

    \$('restock_date_mode')
        .observe('change', AmazonListingCreateSellingObj.restock_date_mode_change)
        .simulate('change');
});
JS
);
        return parent::_toHtml();
    }
Exemplo n.º 15
0
    protected function _toHtml()
    {
        $this->jsTranslator->addTranslations(['Location or Zip/Postal Code should be specified.' => $this->__('Location or Zip/Postal Code should be specified.'), 'Select one or more international ship-to Locations.' => $this->__('Select one or more international ship-to Locations.'), 'PayPal payment method should be specified for Cross Border trade.' => $this->__('PayPal payment method should be specified for Cross Border trade.'), 'You should specify at least one Shipping Method.' => $this->__('You should specify at least one Shipping Method.'), 'None' => $this->__('None'), 'Select Shipping Service' => $this->__('Select Shipping Service'), 'Excluded Shipping Locations' => $this->__('Excluded Shipping Locations'), 'No Locations are currently excluded.' => $this->__('No Locations are currently excluded.'), 'selected' => $this->__('selected')]);
        $this->jsUrl->addUrls(['ebay_template_shipping/updateDiscountProfiles' => $this->getUrl('*/ebay_template_shipping/updateDiscountProfiles', ['marketplace_id' => $this->marketplaceData['id'], 'account_id' => $this->getAccountId()])]);
        $this->jsPhp->addConstants($this->getHelper('Data')->getClassConstants('\\Ess\\M2ePro\\Model\\Ebay\\Template\\Shipping'));
        $this->jsPhp->addConstants($this->getHelper('Data')->getClassConstants('\\Ess\\M2ePro\\Model\\Ebay\\Template\\Shipping\\Service'));
        $this->jsPhp->addConstants($this->getHelper('Data')->getClassConstants('\\Ess\\M2ePro\\Model\\Ebay\\Template\\Shipping\\Calculated'));
        $missingAttributes = json_encode($this->missingAttributes);
        $services = json_encode($this->marketplaceData['services']);
        $locations = json_encode($this->marketplaceData['locations']);
        $discountProfiles = json_encode($this->getDiscountProfiles());
        $originCountry = json_encode($this->marketplaceData['origin_country']);
        $formDataServices = json_encode($this->formData['services']);
        $this->js->addRequireJs(['form' => 'M2ePro/Ebay/Template/Shipping', 'attr' => 'M2ePro/Attribute'], <<<JS

        window.AttributeObj = new Attribute();
        AttributeObj.attrData = '{$this->getAttributesJsHtml()}';

        window.EbayTemplateShippingObj = new EbayTemplateShipping();

        var shippingMethods = {$formDataServices};
        _.forEach(shippingMethods, function(shipping, i) {
            shippingMethods[i].locations = shipping.locations.evalJSON();
        });

        EbayTemplateShippingObj.shippingMethods = shippingMethods;

        EbayTemplateShippingObj.counter = {
            local: 0,
            international: 0,
            total: 0
        };

        EbayTemplateShippingObj.initExcludeListPopup();

        EbayTemplateShippingObj.missingAttributes = {$missingAttributes};
        EbayTemplateShippingObj.shippingServices = {$services};
        EbayTemplateShippingObj.shippingLocations = {$locations};
        EbayTemplateShippingObj.discountProfiles = {$discountProfiles};
        EbayTemplateShippingObj.originCountry = {$originCountry};

        EbayTemplateShippingObj.initObservers();
JS
);
        return parent::_toHtml();
    }