Magento 2 Create Shipping Method with Delivery Options

I created a new shipping method for home delivery and I want to be able to present options such as a building/unit/room number. My thought was when the user selected this method the options would appear with a text field for the user to enter information before moving to the payment page. Any guidance on the best way to make this happen?

This is in Model/Carrier

/**      * @param \Magento\Framework\App\Config\ScopeConfigInterface $  scopeConfig      * @param \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $  rateErrorFactory      * @param \Psr\Log\LoggerInterface $  logger      * @param \Magento\Shipping\Model\Rate\ResultFactory $  rateResultFactory      * @param \Magento\Quote\Model\Quote\Address\RateResult\MethodFactory $  rateMethodFactory      * @param array $  data      */     public function __construct(         \Magento\Framework\App\Config\ScopeConfigInterface $  scopeConfig,         \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $  rateErrorFactory,         \Psr\Log\LoggerInterface $  logger,         \Magento\Shipping\Model\Rate\ResultFactory $  rateResultFactory,         \Magento\Quote\Model\Quote\Address\RateResult\MethodFactory $  rateMethodFactory,         array $  data = []     ) {         $  this->_rateResultFactory = $  rateResultFactory;         $  this->_rateMethodFactory = $  rateMethodFactory;         $  this->_logger = $  logger;         parent::__construct($  scopeConfig, $  rateErrorFactory, $  logger, $  data);     }      /**      * @param RateRequest $  request      * @return \Magento\Shipping\Model\Rate\Result|bool      */     public function collectRates(RateRequest $  request)     {         if (!$  this->getConfigFlag('active')) {             return false;         }          /** @var \Magento\Shipping\Model\Rate\Result $  result */         $  result = $  this->_rateResultFactory->create();          $  shippingPrice = $  this->getConfigData('price');         $  method = $  this->_rateMethodFactory->create();         $  method->setCarrier($  this->_code);         $  method->setCarrierTitle($  this->getConfigData('title'));         $  method->setMethod($  this->_code);         $  method->setMethodTitle($  this->getConfigData('name'));         $  method->setPrice($  shippingPrice);         $  method->setCost($  shippingPrice);         $  result->append($  method);           return $  result;     }      /**      * @return array      */     public function getAllowedMethods()     {          return [$  this->_code=> $  this->getConfigData('name')];     } 

I tried to create checkout_index_index.xml and add a custom phtml page to it with

<script type="text/javascript">     require([         'jquery',         'Magento_Checkout/js/model/quote',     ], function (jQuery, quote) {         jQuery(document).ready(function () {             quote.shippingMethod.subscribe(function (value) {                 if (quote.shippingMethod() && quote.shippingMethod().carrier_code == 'your_custom_shipping_method_code') {                     var customBlock = "<div class ='custom-information'><input type="text" id="your_custom_id"></div>";                     if((!$  ('.custom-information').length > 0)) {                         $  ('#checkout-shipping-method-load').append(customBlock);                     }                 });             });         });     }); </script> 

And then I added in Model

namespace Magento\Checkout\Model;  class GuestShippingInformationManagement implements \Magento\Checkout\Api\GuestShippingInformationManagementInterface {     /**      * @var \Magento\Quote\Model\QuoteIdMaskFactory      */     protected $  quoteIdMaskFactory;      /**      * @var \Magento\Checkout\Api\ShippingInformationManagementInterface      */     protected $  shippingInformationManagement;      /**      * @param \Magento\Quote\Model\QuoteIdMaskFactory $  quoteIdMaskFactory      * @param \Magento\Checkout\Api\ShippingInformationManagementInterface $  shippingInformationManagement      * @codeCoverageIgnore      */     public function __construct(         \Magento\Quote\Model\QuoteIdMaskFactory $  quoteIdMaskFactory,         \Magento\Checkout\Api\ShippingInformationManagementInterface $  shippingInformationManagement     ) {         $  this->quoteIdMaskFactory = $  quoteIdMaskFactory;         $  this->shippingInformationManagement = $  shippingInformationManagement;     }      /**      * {@inheritDoc}      */     public function saveAddressInformation(         $  cartId,         \Magento\Checkout\Api\Data\ShippingInformationInterface $  addressInformation     ) {         /** @var $  quoteIdMask \Magento\Quote\Model\QuoteIdMask */         $  quoteIdMask = $  this->quoteIdMaskFactory->create()->load($  cartId, 'masked_id');         return $  this->shippingInformationManagement->saveAddressInformation(             $  quoteIdMask->getQuoteId(),             $  addressInformation         );     } } 

and started to modify it but I think I may be headed in the wrong direction,

Thoughts on the best way to accomplish this?

Thanks!

Create Hummingbird safe 4 Tier Link Pyramid using PR9 Web2 blogs- Skyrocket your Google Rankings for $5

Create Hummingbird safe 4 Tier Link Pyramid using PR9 Web2 blogs Delivery: Express Delivery (Within 24 Hours) WE are dealing with Low cost high authority manual white hat link building services with diversify URL and keyword. Each account and submission will be done using Unique Ips Tier 1 – 2 Web2.0 Buffer Blogs post Tier 2 – 20 pr9 Do Follow Backlinks DA 70+ Tier 3 – 15 Edu and Gov pr7 Backlinks DA 60+ Tier 4- 15 PR6 and above Social Bookmarking Key feature : 2PR9 Do Follow Web2.0 Blogs ( WordPress ,Tumblr and ARTICLE )[/*]pr9 Do Follow Backlinks DA 70+ (wordpress org, Microsoft.com, Ted.com, About.me, Pinterest.com, Quora.com,Soundcloud.com etc)[/*]PR6 and above Social Bookmarking (Reddit, stumbleupon, Delicious, Connotea, Folkd, Diigo etc)[/*]Manually created with Different IPs with Zero foot prints[/*]Most Diversified services( Tiny URL, full and naked URL, anchored keyword and its synonyms)[/*]Google safe means It will easily overcome Penguin, Panda & Hummingbird[/*]Detailed report with login details[/*]Express Delivery ( Within 24 hours of purchase)[/*]100% safe and guaranteed.

by: Seoexperts24x7
Created: —
Category: Link Pyramids
Viewed: 225


YUMI/Universal USB Installer/UNetbootin can’t progress while trying to create live Ubuntu USB with persistent storage?

Windows 10 so I can’t use any methods that require Linux.

First attempt with YUMI, formatted USB to Fat32 with 4096MB allocated for persistent storage. Process was quick, but it’s not enough space, so I’ve tried with to format to NTFS with 20480MB allocated for storage. All YUMI/Universal hang while “creating a persistent file.” It’s been an hour. I’m trying to use an Ubuntu 18.04 desktop ISO.

create an array for unanswered survey question items

I have a SharePoint survey and I need to create an array of survey questions that have been left unanswered using JS.

Then I need to create an unanswered array index tracker where the unansweredQuestionItem = {"url":"<<question url>>", "questionId":"", "frequency":"<<number of times displayed>>", "isQuestionAnswered":"<<default false>>"}

Can anyone help point me in the right direction with this??

How to create a Twitch chatbot for Android in Java

I recently got into Android Dev with Android Studio and Java.

Since most of my projects are chat bots, i thought it would be cool to implement a Twitch chat bot that could run on my Android mobile phone. I’ve used Python requests and twitchio api to build my bot. I don’t know much about web dev and i have no front-end experience.

The main problem i think is…how do I create a high-performance bot that does not consume too much battery?

Another problem could be, should i make it more server-side? Or should i find a way to accomplish the battery problem, without a server to rely on?

What do you think?

What SDK version should i use for implementation?

I’m also looking for docs to build this project. I will appreciate any resource related to the twitchio api, and in general, to the sdk and android studio. Which i can use to make the transition from Python.

If needed…i can provide the actual code of my python twitch bot on github.

Manually Create 10 High PR Anchor Text Web 2.0 Backlinks for $20

Manually create 10 high page rank dofollow anchor text powerful Web 2.0 Backlinks to your website or blogsite. Increase Your Website Traffic and Boost your Page RANK. Service details: 100% Satisfaction Guarantee. 100% quality work. 100% white hat backlinks. 100% Unique Manually Created, Researched & Readable Content Service based on the latest Google update More authority and rankings for your website Natural mix of no and dofollow, anchored and brand llinks FREE unique content used. Detailed report.

by: mripon
Created: —
Category: Web 2.0
Viewed: 165


Create Manually 50 USA Powerful PR9 Profile SEO Backlinks,Linkbuilding for $5

Hi,Profile Backlinks are very helpful and workable for your URL and rank search first keyword. I will Manually Create 50 High PR Profile Dofollow Backlink For your site (High Authority) I Guarantee you will love my service , Order now! For just $ 5, there’s nothing to lose I will create High PR, High DA PA and Quality Dofollow links to your website for Rank Higher in Search Engine. This is the best Search Engine technique to rank your website Top on SERP. Why My SERVICE : 100% Extremely Friendly with Panda, Penguin, and Hummingbird. Full report in Excel sheet Satisfaction guaranteed 100 % Money back guaranteed ( Case of unsatisfied) White Hat 100% Manual Backlink 100% UNIQUE IPs 24/7 Customer Support Extremely High DA 50 – 100 links Please Inbox me if you have any query….. ★★ Order now !! and get your website ranked Top ! ★★ Thank you so much for viewing my service…

by: seoaraf24
Created: —
Category: Link Building
Viewed: 161


Create a row based on a condition (column value)

I have a table that contains the following data;

EmpNo | GivenName | PreferredName  --------------------------------- 1     | Paris     | Paris 2     | Ashley    | Ash 

I am trying to get an output where, if the GivenName and PreferredName values are same, then the row should be returned as it is, but if they are different then the row should be returned twice (if possible, the row returned twice should have a NULL in PreferredName in the first occurence and GivenName a NULL in the second). Something like this:

EmpNo | GivenName | PreferredName  --------------------------------- 1     | Paris     | Paris 2     | Ashley    | NULL 2     | NULL      | Ash 

I have no idea where to begin. I tried using CASE statement and FULL OUTER JOIN to no avail. I have as well tried using the code below, and it is giving me the answer for the first part of my question:

SELECT [EmpNo]       ,[GivenName]       ,[PreferredName] FROM [Emp] E WHERE [GivenName]= [PreferredName] UNION ALL SELECT [EmpNo]       ,[GivenName]       ,[PreferredName] FROM [Emp]