Exemplo n.º 1
0
 protected function _beforeToHtml()
 {
     // ---------------------------------------
     $countries = $this->getHelper('Magento')->getCountries();
     unset($countries[0]);
     $this->setData('available_countries', $countries);
     // ---------------------------------------
     // ---------------------------------------
     $userInfo = $this->authSession->getUser()->getData();
     $defaultStore = $this->getHelper('Magento\\Store')->getDefaultStore();
     $userInfo['city'] = $defaultStore->getConfig(\Magento\Shipping\Model\Config::XML_PATH_ORIGIN_CITY);
     $userInfo['postal_code'] = $defaultStore->getConfig(\Magento\Shipping\Model\Config::XML_PATH_ORIGIN_POSTCODE);
     $userInfo['country'] = $defaultStore->getConfig(\Magento\Config\Model\Config\Backend\Admin\Custom::XML_PATH_GENERAL_COUNTRY_DEFAULT);
     // ---------------------------------------
     // ---------------------------------------
     $earlierFormData = $this->getHelper('Data\\GlobalData')->getValue('license_form_data');
     if ($earlierFormData) {
         $earlierFormData = $earlierFormData->getValue();
         $earlierFormData = (array) json_decode($earlierFormData, true);
         $userInfo = array_merge($userInfo, $earlierFormData);
     }
     $this->setData('user_info', $userInfo);
     $this->setData('isLicenseStepFinished', $earlierFormData && $this->getHelper('Module\\License')->getKey());
     // ---------------------------------------
     $this->jsTranslator->addTranslations(['An error during of license creation occurred.' => $this->__('The eBay token obtaining is currently unavailable. Please try again later.')]);
     return parent::_beforeToHtml();
 }
    protected function _beforeToHtml()
    {
        $this->jsUrl->add($this->getUrl('*/developers/save'), 'developers/save');
        $this->jsTranslator->add('Settings successfully saved', $this->__('Settings successfully saved'));
        $this->js->addRequireJs(['d' => 'M2ePro/Developers'], <<<JS

        window.DevelopersObj = new Developers();
JS
);
        return parent::_beforeToHtml();
    }
Exemplo n.º 3
0
    protected function _beforeToHtml()
    {
        $helpBlock = $this->createBlock('HelpBlock')->setData(['content' => $this->__('On this Tab you can specify Product Specifics for more detailed Description of its properties.
                List of available Specifics determines for the Category that you have chosen on General Tab. <br/><br/>
                To add new Specifics you can use “Add Specifics” Button at the top of a Tab or click “Plus”
                icon at the top right corner of a group to add Specifics to one particular group. Use search
                and filters to find Specifics you need. Specifics have nested structure so the same
                Specific can be used in different groups. <br/><br/>

                There is a list of required Specifics that should be specified. Recommended Specifics
                by Amazon are marked with a “Desired” label. Such Specifics are not mandatory,
                though they are recommended to be specified. <br/><br/>

                You can delete added Specifics by clicking a cross icon on the right.
                Some Specifics have a duplication Option (there is a copy icon on the right),
                i.e. you can specify several values for one Specific at the same time. <br/><br/>

                You can choose between 3 modes to specify the Specifics values:

                <ul class="list">
                    <li>Custom Value – you should set value manually;</li>
                    <li>Custom Attribute - selecting of Magento Attribute,
                    that will be a source for a Specific value;</li>
                    <li>Recommended Value (optional) - selecting of value from the list of predefined values.</li>
                </ul>
                <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/J4MVAQ'))]);
        $this->setChild('help_block', $helpBlock);
        $this->css->add(<<<CSS
        a.specific-clone-button {
            display: inline-block;
            width: 20px;
            height: 16px;
            background: no-repeat center;
            background-image: url("{$this->getViewFileUrl('Ess_M2ePro::images/duplicate.png')}");
        }

CSS
);
        $this->jsTranslator->addTranslations(['Add Specifics' => $this->__('Add Specifics'), 'Remove this specific' => $this->__('Remove this specific'), 'Total digits (not more):' => $this->__('Total digits (not more):'), 'Type: Numeric.' => $this->__('Type: Numeric.'), 'Min:' => $this->__('Min:'), 'Max:' => $this->__('Max:'), 'Can take any value.' => $this->__('Can take any value.'), 'Two uppercase letters or "unknown".' => $this->__('Two uppercase letters or "unknown".'), 'The value is incorrect.' => $this->__('The value is incorrect.'), 'Type: String.' => $this->__('Type: String.'), 'Min length:' => $this->__('Min length:'), 'Max length:' => $this->__('Max length:'), 'Type: Date time. Format: YYYY-MM-DD hh:mm:ss' => $this->__('Type: Date time. Format: YYYY-MM-DD hh:mm:ss'), 'Type: Numeric floating point.' => $this->__('Type: Numeric floating point.'), 'Decimal places (not more):' => $this->__('Decimal places (not more):'), 'Recommended Values' => $this->__('Recommended Values'), 'Allowed Values' => $this->__('Allowed Values'), 'Custom Attribute' => $this->__('Custom Attribute'), 'Custom Value' => $this->__('Custom Value'), 'None' => $this->__('None'), 'Definition:' => $this->__('Definition:'), 'Tips:' => $this->__('Tips:'), 'Examples:' => $this->__('Examples:'), 'Desired' => $this->__('Desired'), 'Duplicate specific' => $this->__('Duplicate specific'), 'Delete specific' => $this->__('Delete specific'), 'Add Specific into current container' => $this->__('Add Specific into current container'), 'Value of this Specific can be automatically overwritten by M2E Pro.' => $this->__('In case this Description Policy will be used to create New Amazon Child Products,
                value of this Specific can be automatically overwritten by M2E Pro.
                Below there is a list of Variation Themes for which the value of this
                Specific will be overwritten if you are using one of them in your Listing.'), 'Amazon Parentage Specific will be overridden notice.' => 'The Value of this Specific can be necessary due to technical reasons,
                so there is no ability to Edit the Attribute parentage and also it has no semantic load.
                In case this Description Policy uses for creation of new Amazon Parent-Child Product,
                this Value will be overwritten and the Value you selected will not be/cannot be used.']);
        $formData = json_encode($this->formData);
        $this->js->add("\r\n            wait(\r\n                function() { return typeof AmazonTemplateDescriptionCategorySpecificObj != 'undefined'; },\r\n                function() { AmazonTemplateDescriptionCategorySpecificObj.setFormDataSpecifics({$formData}); },\r\n                50\r\n            );\r\n\r\n        ");
        return parent::_beforeToHtml();
    }
Exemplo n.º 4
0
    protected function _beforeToHtml()
    {
        parent::_beforeToHtml();
        $this->jsPhp->addConstants($this->getHelper('Data')->getClassConstants('\\Ess\\M2ePro\\Model\\Listing'));
        $hasFormData = $this->hasFormData() ? 'true' : 'false';
        $this->js->add(<<<JS
        \$('auto_global_adding_mode')
            .observe('change', ListingAutoActionObj.addingModeChange)
            .simulate('change');

        if ({$hasFormData}) {
            \$('global_reset_button').show();
            \$('global_close_button').hide();
        }
JS
);
    }
Exemplo n.º 5
0
    protected function _beforeToHtml()
    {
        parent::_beforeToHtml();
        $this->jsPhp->addConstants($this->getHelper('Data')->getClassConstants('\\Ess\\M2ePro\\Model\\Listing'));
        // ---------------------------------------
        $groupGrid = $this->getChildBlock('group_grid');
        // ---------------------------------------
        $skipConfirmation = json_encode($groupGrid->getCollection()->getSize() == 0);
        $this->js->add(<<<JS
        var skipConfirmation = {$skipConfirmation};

        if (!skipConfirmation) {
            \$('category_cancel_button').hide();
            \$('category_close_button').hide();
            \$('category_reset_button').show();
        }
JS
);
    }
Exemplo n.º 6
0
 protected function _beforeToHtml()
 {
     // ---------------------------------------
     /** @var \Ess\M2ePro\Model\Marketplace $tempMarketplaces */
     $tempMarketplaces = $this->parentFactory->getObject(\Ess\M2ePro\Helper\Component\Ebay::NICK, 'Marketplace')->getCollection()->setOrder('group_title', 'ASC')->setOrder('sorder', 'ASC')->setOrder('title', 'ASC')->getItems();
     $storedStatuses = array();
     $groups = array();
     $idGroup = 1;
     $groupOrder = array('america' => 'America', 'europe' => 'Europe', 'asia_pacific' => 'Asia / Pacific', 'other' => 'Other');
     foreach ($groupOrder as $key => $groupOrderTitle) {
         $groups[$key] = array('id' => $idGroup++, 'title' => $groupOrderTitle, 'marketplaces' => array());
         foreach ($tempMarketplaces as $tempMarketplace) {
             if ($groupOrderTitle != $tempMarketplace->getGroupTitle()) {
                 continue;
             }
             $isLocked = (bool) $this->activeRecordFactory->getObject('Listing')->getCollection()->addFieldToFilter('marketplace_id', $tempMarketplace->getId())->getSize();
             //                $isLockedByPickupStore = false;
             //                todo NOT SUPPORTED FEATURES
             //                if (Mage::helper('M2ePro/Component_Ebay_PickupStore')->isFeatureEnabled()) {
             //                    $isLockedByPickupStore = (bool)Mage::getModel('M2ePro/Ebay_Account_PickupStore')->getCollection()
             //                        ->addFieldToFilter('marketplace_id', $tempMarketplace->getId())
             //                        ->getSize();
             //                }
             $storedStatuses[] = array('marketplace_id' => $tempMarketplace->getId(), 'status' => $tempMarketplace->getStatus());
             /* @var $tempMarketplace \Ess\M2ePro\Model\Marketplace */
             $marketplace = array('instance' => $tempMarketplace, 'params' => array('locked' => $isLocked));
             $groups[$key]['marketplaces'][] = $marketplace;
         }
     }
     $this->groups = $groups;
     $this->storedStatuses = $storedStatuses;
     // ---------------------------------------
     return parent::_beforeToHtml();
 }
Exemplo n.º 7
0
 protected function _beforeToHtml()
 {
     $this->jsTranslator->add('Please select Marketplace first.', $this->__('Please select Marketplace first.'));
     return parent::_beforeToHtml();
 }
Exemplo n.º 8
0
 protected function _beforeToHtml()
 {
     // ---------------------------------------
     $data = $this->getListingData();
     $this->setData('general_attributes', $this->getHelper('Magento\\Attribute')->getGeneralFromAllAttributeSets());
     foreach ($data as $key => $value) {
         $this->setData($key, $value);
     }
     // ---------------------------------------
     return parent::_beforeToHtml();
 }
Exemplo n.º 9
0
 protected function _beforeToHtml()
 {
     $this->jsPhp->addConstants($this->getHelper('Data')->getClassConstants('\\Ess\\M2ePro\\Model\\Amazon\\Template\\Description\\Definition'));
     return parent::_beforeToHtml();
 }
Exemplo n.º 10
0
 protected function _beforeToHtml()
 {
     $this->calculateWarnings();
     return parent::_beforeToHtml();
 }
Exemplo n.º 11
0
    protected function _beforeToHtml()
    {
        $this->jsTranslator->addTranslations(['Add Description Policy' => $this->__('Add Description Policy'), 'Change Category' => $this->__('Edit Category'), 'Not Selected' => $this->__('Not Selected'), 'Select' => $this->__('Select'), 'The specified Title is already used for another Policy. Policy Title must be unique.' => $this->__('The specified Title is already used for another Policy. Policy Title must be unique.'), 'Please enter a valid number value in a specified range.' => $this->__('Please enter a valid number value in a specified range.'), 'You should select Marketplace first.' => $this->__('You should select Marketplace first.'), 'You should select Category and Product Type first' => $this->__('You should select Category and Product Type first'), 'Recommended' => $this->__('Recommended'), 'Recent' => $this->__('Recent')]);
        $formData = json_encode($this->formData);
        $isEdit = $this->templateModel->getId() ? 'true' : 'false';
        $isCategoryLocked = $this->isCategoryLocked() ? 'true' : 'false';
        $isMarketplaceLocked = $this->isMarketplaceLocked() ? 'true' : 'false';
        $marketplaceForceSet = json_encode((bool) (int) $this->getRequest()->getParam('marketplace_id'));
        $isLockedNewAsin = $this->isNewAsinSwitcherLocked() ? 'true' : 'false';
        $newAsinSwitcherForceSet = json_encode((bool) (int) $this->getRequest()->getParam('is_new_asin_accepted'));
        $allAttributes = json_encode($this->getHelper('Magento\\Attribute')->getAll());
        $this->js->addRequireJs(['jQuery' => 'jquery', 'attr' => 'M2ePro/Attribute', 'description' => 'M2ePro/Amazon/Template/Description/Description', 'definition' => 'M2ePro/Amazon/Template/Description/Definition', 'chooser' => 'M2ePro/Amazon/Template/Description/Category/Chooser', 'specific' => 'M2ePro/Amazon/Template/Description/Category/Specific', 'attribute_button' => 'M2ePro/Plugin/Magento/Attribute/Button', 'blockRenderer' => 'M2ePro/Amazon/Template/Description/Category/Specific/BlockRenderer', 'dictionary' => 'M2ePro/Amazon/Template/Description/Category/Specific/Dictionary', 'renderer' => 'M2ePro/Amazon/Template/Description/Category/Specific/Renderer', 'rowattributerenderer' => 'M2ePro/Amazon/Template/Description/Category/Specific/Grid/RowAttributeRenderer', 'rowrenderer' => 'M2ePro/Amazon/Template/Description/Category/Specific/Grid/RowRenderer', 'addspecificrenderer' => 'M2ePro/Amazon/Template/Description/Category/Specific/Block/AddSpecificRenderer', 'gridrenderer' => 'M2ePro/Amazon/Template/Description/Category/Specific/Block/GridRenderer'], <<<JS

        M2ePro.formData = {$formData};

        M2ePro.customData.is_edit = {$isEdit};

        M2ePro.customData.category_locked             = {$isCategoryLocked};
        M2ePro.customData.marketplace_locked          = {$isMarketplaceLocked};
        M2ePro.customData.marketplace_force_set       = {$marketplaceForceSet};
        M2ePro.customData.new_asin_switcher_locked    = {$isLockedNewAsin};
        M2ePro.customData.new_asin_switcher_force_set = {$newAsinSwitcherForceSet};

        window.AttributeObj = new Attribute();
        AttributeObj.setAvailableAttributes({$allAttributes});

        window.AmazonTemplateDescriptionObj                 = new AmazonTemplateDescription();
        window.AmazonTemplateDescriptionCategoryChooserObj  = new AmazonTemplateDescriptionCategoryChooser();
        window.AmazonTemplateDescriptionCategorySpecificObj = new AmazonTemplateDescriptionCategorySpecific();

        window.MagentoAttributeButtonObj = new MagentoAttributeButton();

        window.AmazonTemplateDescriptionDefinitionObj = new AmazonTemplateDescriptionDefinition();

        AmazonTemplateDescriptionObj.setSpecificHandler(AmazonTemplateDescriptionCategorySpecificObj);
        AmazonTemplateDescriptionCategoryChooserObj.setSpecificHandler(AmazonTemplateDescriptionCategorySpecificObj);

        jQuery(function() {
            AmazonTemplateDescriptionObj.initObservers();

            if ({$isEdit}) {
                AmazonTemplateDescriptionObj.prepareEditMode();
            }

            AmazonTemplateDescriptionDefinitionObj.initObservers();
        });
JS
);
        return parent::_beforeToHtml();
    }
Exemplo n.º 12
0
    protected function _beforeToHtml()
    {
        parent::_beforeToHtml();
        $this->jsPhp->addConstants($this->getHelper('Data')->getClassConstants('\\Ess\\M2ePro\\Model\\Listing'));
        $magentoCategoryIdsFromOtherGroups = json_encode($this->getCategoriesFromOtherGroups());
        $this->js->add(<<<JS
            ListingAutoActionObj.magentoCategoryIdsFromOtherGroups = {$magentoCategoryIdsFromOtherGroups};

            jQuery('#'+ListingAutoActionObj.getPopupMode()+'continue_button')
                .off('click').on('click', ListingAutoActionObj.categoryStepTwo);
JS
);
    }
Exemplo n.º 13
0
 protected function _beforeToHtml()
 {
     // ---------------------------------------
     $buttonBlock = $this->createBlock('Magento\\Button')->setData(array('label' => $this->__('Remove'), 'onclick' => 'EbayTemplateShippingObj.removeRow.call(this, \'%type%\');', 'class' => 'delete icon-btn remove_shipping_method_button'));
     $this->setChild('remove_shipping_method_button', $buttonBlock);
     // ---------------------------------------
     return parent::_beforeToHtml();
 }