Skip to content
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

Closed
toonvd opened this issue Jul 28, 2015 · 21 comments
Closed

Ability to add additional phtml to each shipping method #1577

toonvd opened this issue Jul 28, 2015 · 21 comments
Assignees
Labels
improvement Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@toonvd
Copy link

toonvd commented Jul 28, 2015

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)

@jeroenvermeulen
Copy link

+1

@birchestx
Copy link

shipping method or shipping carrier? They are different things. Shipping Carriers, yes totally.

@alankent
Copy link

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.

@toonvd
Copy link
Author

toonvd commented Jul 28, 2015

@alankent good idea, will have to dive in Mage2 again then ^^

@pronto2000
Copy link

+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.

@sandermangel
Copy link
Contributor

+1 from me too!

@janssensjelle
Copy link

+1

3 similar comments
@janbuelens
Copy link

+1

@jokeputs
Copy link
Contributor

+1

@jensvandorpe
Copy link

+1

@vpelipenko
Copy link
Contributor

Guys, let's summarize. @toonvd, are you going to provide some examples?

@septembrium
Copy link

+1

@toonvd
Copy link
Author

toonvd commented Jul 29, 2015

@vpelipenko ok, I will do it in Mage 1 code (how I would do it):
Shipping method phtml (changes marked by start custom changes):

<?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);
    }

@toonvd
Copy link
Author

toonvd commented Jul 29, 2015

Image of Stackoverflow

Payment method equivalent

@toonvd
Copy link
Author

toonvd commented Jul 29, 2015

@vpelipenko clear enough? or do you need more examples? (not used to doing this stuff :) )

@pronto2000
Copy link

Actually this is an improvement I'd LOVE to see backported to Magento 1 as well.

@ilol
Copy link

ilol commented Aug 5, 2015

I put the improvement into our backlog. Will keep you inform with this task.
Tracking id is MAGETWO-41144

@ilol ilol added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Aug 5, 2015
@toonvd
Copy link
Author

toonvd commented Aug 5, 2015

awesome, thank you @ilol !

@toonvd
Copy link
Author

toonvd commented Jan 8, 2016

@ilol any news on this? Cliënts will want to start porting shipping extension to Mage 2 soon.

@asemenenko asemenenko self-assigned this Mar 10, 2016
@toonvd
Copy link
Author

toonvd commented May 20, 2016

@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.

@vkorotun vkorotun removed the CS label Aug 4, 2016
@piotrekkaminski
Copy link
Contributor

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.

magento-team pushed a commit that referenced this issue Oct 11, 2017
Fixed issue:
MAGETWO-77777 [2.2.x] - [Magento Cloud] Using search synonyms from the same group gives different results
manuelson pushed a commit to manuelson/magento2 that referenced this issue Oct 13, 2017
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests