0

I know my question is not clearly correct, but i want to ask.

I am using Magento 1.9.0.1.

I am working on a custom shipping method module and i've created it without any problems.

When i go to the checkout page i can select it and when the order is submitted i can see that this shipping method is chosen. Everything works just fine.

However i've decided to add an select menu with the account addresses.

I've succeed to display the select menu with actual account addresses with this line of code:

echo $this->getAddressesHtmlSelect('shipping'); 

Yes it is very simple to display it. But the problem comes that in the admin panel i can not see the selected result.

I know i miss a lot of things to make it happen, but at this time i have no idea how can i save this choice.

Everything that i am asking for is:

How can i make the selection for this shipping method to be shown in the order view page in admin panel?

Right now i can only see that this shipping method is chosen, but i can not see the selection choice.

P.S.

Right now my getAllowedMethods() function has the following code:

public function getAllowedMethods()
{
    return array('bestway' => $this->getConfigData('name'));
}

Thanks in advance!

1 Answer 1

0

You would have to override the getAllowMethods() on your shipping method, to return an array of options based on the account Addresses, something like:

public function getAllowedMethods(){

                $method_options = Mage::getModel('shipping/rate_result');

                $addresses = "//However you are retrieving addresses
                foreach($addresses as $rate){
                        $method = Mage::getModel('shipping/rate_result_method');
                        $method->setCarrier("// carrier code");
                        $method->setCarrierTitle("// shipping company");
                        $method->setMethod("whatever dynamic or static method code);
                        $method->setMethodTitle("// whatever dynamic or static title");
                        $method->setPrice("//shipping price");
                        $method->setCost("//shipping cost");
                        $method_options->append($method);
                    }
                }
                return $method_options;
            }

This way you would be able to identify and easily match the selection with its corresponding address on the admin or programmatically

3
  • Please check out my updated question to see what my getAllowedMethods() function holds right now. Commented Sep 9, 2015 at 17:56
  • You need to return an Array of method rates, to make a good distinction between the choices, how are you pulling the addresses?
    – Goku
    Commented Sep 9, 2015 at 18:14
  • I display the addresses in the template file with this code echo $this->getAddressesHtmlSelect('shipping'); which is displaying a select menu with actual account addresses. Commented Sep 9, 2015 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.