So you need to pass value through js, in this case you need to overwrite following js Magento/Checkout/view/frontend/web/js/model/shipping-save-processor/default.js
So you go with following way:
Create Learning/ABlock/view/frontend/requirejs-config.js
var config = {
"map": {
"*": {
'Magento_Checkout/js/model/shipping-save-processor/default': 'Learning_ABlock/js/model/shipping-save-processor/default'
}
}
};
Create Learning/ABlock/view/frontend/web/js/model/shipping-save-processor/default.js
/*global define,alert*/
define(
[
'jquery',
'ko',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/resource-url-manager',
'mage/storage',
'Magento_Checkout/js/model/payment-service',
'Magento_Checkout/js/model/payment/method-converter',
'Magento_Checkout/js/model/error-processor',
'Magento_Checkout/js/model/full-screen-loader',
'Magento_Checkout/js/action/select-billing-address'
],
function (
$,
ko,
quote,
resourceUrlManager,
storage,
paymentService,
methodConverter,
errorProcessor,
fullScreenLoader,
selectBillingAddressAction
) {
'use strict';
return {
saveShippingInformation: function () {
var payload;
if (!quote.billingAddress()) {
selectBillingAddressAction(quote.shippingAddress());
}
payload = {
addressInformation: {
shipping_address: quote.shippingAddress(),
billing_address: quote.billingAddress(),
shipping_method_code: quote.shippingMethod().method_code,
shipping_carrier_code: quote.shippingMethod().carrier_code,
extension_attributes:{
account_no: $('[name="account_no"]').val()
}
}
};
fullScreenLoader.startLoader();
return storage.post(
resourceUrlManager.getUrlForSetShippingInformation(quote),
JSON.stringify(payload)
).done(
function (response) {
quote.setTotals(response.totals);
paymentService.setPaymentMethods(methodConverter(response.payment_methods));
fullScreenLoader.stopLoader();
}
).fail(
function (response) {
errorProcessor.process(response);
fullScreenLoader.stopLoader();
}
);
}
};
}
);
Actually you need to pass input value by extension_attributes
extension_attributes:{
account_no: $('[name="account_no"]').val()
}
One more things, modify your Learning/ABlock/view/web/template/checkout/shipping/additional-block.html
<div xmlns="http://www.w3.org/1999/html">
<div class="field">
<label class="label" for="account_no">
</span>
</label>
<div class="control">
<input class="input-text" id="account_no" name="account_no" type="text" />
</div>
</div>
</div>
You can see here as an example.
Best Answer
Most probably the model that should handle the shipping method is not found.
Either it does not exist, or it is wrongly configured.
Make sure you have in your
config.xml
the model for the shipping method.In the example you used it's
This means that the model used will be
Mage_Shipping_Model_Carrier_Inchoocustom
. Make sure that exists also.You can easily test with this code...
Put that in any page of your code.
If that renders nothing it means the class
Mage_Shipping_Model_Carrier_Inchoocustom
is not found. Either it does not exist or it is placed in the wrong file/folder.if it outputs
Mage_Shipping_Model_Carrier_Inchoocustom
it means you are missing the<model>
declaration inconfig.xml
.And on a side note, with all respect for Inchoo and the great work they are doing in their example something is wrong. Even if it works, the
Mage
folder should not be used for custom extensions.You can also check this for an other tutorial on how to create a shipping method: www.magentocommerce.com/wiki/5_-_modules_and_development/shipping/create-shipping-method-module