-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to add additional phtml to each shipping method #1577
Comments
+1 |
shipping method or shipping carrier? They are different things. Shipping Carriers, yes totally. |
A really useful technique is to propose example code of exactly how you would like it. It makes it concrete, more likely to be what you need, others can review publicly as well, etc. Don't spend too much time, optional, but it does help keep things moving along. We of course will review and make sure it fits in with the overall story. |
@alankent good idea, will have to dive in Mage2 again then ^^ |
+1 here as well -- thing is that around here most popular delivery method is parcel point delivery; while choosing delivery method one chooses a parcel point and picks it up from there (I think Amazon recently launched something like that as well). Traditional carriers may offer it as an additional shipping method. To achieve it I added dropdown to the payment method list phtml file fully knowing that whoever does something like that in another extension there's going to be a conflict. Having an extra phtml block similar to saved CC would make this problem go away. |
+1 from me too! |
+1 |
3 similar comments
+1 |
+1 |
+1 |
Guys, let's summarize. @toonvd, are you going to provide some examples? |
+1 |
@vpelipenko ok, I will do it in Mage 1 code (how I would do it): <?php $_sole = count($_shippingRateGroups) == 1;
foreach ($_shippingRateGroups as $code => $_rates): ?>
<dt><?php echo $this->escapeHtml($this->getCarrierName($code)) ?></dt>
<dd>
<ul>
<?php $_sole = $_sole && count($_rates) == 1;
foreach ($_rates as $_rate): ?>
<?php $shippingCodePrice[] = "'" . $_rate->getCode() . "':" . (float)$_rate->getPrice(); ?>
<li>
<?php if ($_rate->getErrorMessage()): ?>
<ul class="messages">
<li class="error-msg">
<ul>
<li><?php echo $this->escapeHtml($_rate->getErrorMessage()) ?></li>
</ul>
</li>
</ul>
<?php else: ?>
<?php if ($_sole) : ?>
<span class="no-display"><input name="shipping_method" type="radio"
value="<?php echo $_rate->getCode() ?>"
id="s_method_<?php echo $_rate->getCode() ?>"
checked="checked"/></span>
<?php else: ?>
<input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>"
id="s_method_<?php echo $_rate->getCode() ?>"<?php if ($_rate->getCode() === $this->getAddressShippingMethod()) echo ' checked="checked"' ?>
class="radio"/>
<?php if ($_rate->getCode() === $this->getAddressShippingMethod()): ?>
<script type="text/javascript">
//<![CDATA[
lastPrice = <?php echo (float)$_rate->getPrice(); ?>;
//]]>
</script>
<?php endif; ?>
<?php endif; ?>
<label
for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $this->escapeHtml($_rate->getMethodTitle()) ?>
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
<?php echo $_excl; ?>
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
<?php endif; ?>
</label>
<?php endif ?>
// start custom changes
<?php if ($html = $this->getShippingMethodFormHtml($_rate->getCode())): ?>
<span>
<?php echo $html; ?>
</span>
<?php endif; ?>
// end custom changes
</li>
<?php endforeach; ?>
</ul>
</dd>
<?php endforeach; ?> Block: public function getShippingMethodFormHtml($rateCode)
{
return $this->getChildHtml('shipping.method.' . rateCode);
} |
@vpelipenko clear enough? or do you need more examples? (not used to doing this stuff :) ) |
Actually this is an improvement I'd LOVE to see backported to Magento 1 as well. |
I put the improvement into our backlog. Will keep you inform with this task. |
awesome, thank you @ilol ! |
@ilol any news on this? Cliënts will want to start porting shipping extension to Mage 2 soon. |
@asemenenko What is the status on this one? If I were to create a pullrequest myself, would it make the next release? This is very important for companies that build shipping methods to ensure higher quality. |
Thank you for your submission. We recently made some changes to the way we process GitHub submissions to more quickly identify and respond to core code issues. Feature Requests and Improvements should now be submitted to the new Magento 2 Feature Requests and Improvements forum (see details here). We are closing this GitHub ticket and have moved your request to the new forum. |
Fixed issue: MAGETWO-77777 [2.2.x] - [Magento Cloud] Using search synonyms from the same group gives different results
Fixed issue: MAGETWO-77777 [2.2.x] - [Magento Cloud] Using search synonyms from the same group gives different results array bug fix Category_ids display no Refactoring continue condition Condition rewrite
This was not possible in Magento 1 for shipping methods but was for payment methods. This makes shipping extension creators override phtmls every time. Could it be usefull to make sure we can do this in Magento 2?
To be clear, I want shipping method - custom template file, shipping method - custom template file (not required to add one tough)
The text was updated successfully, but these errors were encountered: