コード例 #1
0
 /**
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
  *
  * @return string
  */
 public function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     //passcode to append for url
     $passcode = $this->dataHelper->getPasscode();
     //last order id witch information will be generated
     $lastOrderid = $this->dataHelper->getLastOrderId();
     if (empty($passcode)) {
         $passcode = '[PLEASE SET UP A PASSCODE]';
     }
     if (!$lastOrderid) {
         $lastOrderid = '[PLEASE MAP THE LAST ORDER ID]';
     }
     //generate the base url and display for default store id
     $baseUrl = $this->dataHelper->generateDynamicUrl();
     $text = sprintf('%sconnector/product/upsell/code/%s/order_id/@%s@', $baseUrl, $passcode, $lastOrderid);
     $element->setData('value', $text);
     return parent::_getElementHtml($element);
 }
コード例 #2
0
 /**
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
  *
  * @return string
  */
 public function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     //base url
     $baseUrl = $this->dataHelper->generateDynamicUrl();
     //config passcode
     $passcode = $this->dataHelper->getPasscode();
     //last order id for dynamic page
     $lastOrderId = $this->dataHelper->getLastOrderId();
     if (empty($passcode)) {
         $passcode = '[PLEASE SET UP A PASSCODE]';
     }
     //alert message for last order id is not mapped
     if (!$lastOrderId) {
         $lastOrderId = '[PLEASE MAP THE LAST ORDER ID]';
     }
     //full url for dynamic content
     $text = sprintf('%sconnector/product/crosssell/code/%s/order_id/@%s@', $baseUrl, $passcode, $lastOrderId);
     $element->setData('value', $text);
     return parent::_getElementHtml($element);
 }