Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to change/update shipping price after shipping method choose
    primarykey
    data
    text
    <p>I am trying to create a custom (pickship) shipping method for magento 1.7.x.x following the instructions in this this <a href="http://www.excellencemagentoblog.com/magento-advanced-shipping-method-development" rel="nofollow">blog</a> after creating the shipping module. I would like to be able to change shipping cost based on the user's choice of shipping option.<br /></p> <p><strong>Preparation:</strong></p> <p>1.) Created a form block for custom (pickship) shipping method <br /> 2.) Create a store name (can be any text) dropdown/select element with three values: store1, store2, store3. <br /> 3.) The default shipping price is set via the shipping configuration at $1.00 (just for testing purposes).</p> <p><strong>Current Status:</strong></p> <p>1.) After the required process, when I reach the selection of shipping method in the single-page checkout, I see a select element with three options and the shipping price set to the default price.</p> <p><strong>Target:</strong></p> <p>I would like the shipping cost to be updated to $10.00 if the user selects the first option, $20.00 if the user selects the second option.</p> <p><strong>My attempt:</strong></p> <p>After a few hours of googling, I made some changes in the observer model:</p> <pre><code>NameSpace_ModuleName_Model_Observer extends Varien_Object { public function saveShippingMethod($observer) { $request = $evt-&gt;getRequest(); $quote = $evt-&gt;getQuote(); $pickship = $request-&gt;getParam('shipping_pickship', false); $rates = $quote-&gt;getShippingAddress()-&gt;getShippingRatesCollection(); $rate = $rates-&gt;getFirstItem(); if($pickship['select_element'] == 1) { $rate-&gt;setPrice(10); } elseif($pickship['select_element'] == 2) { $rate-&gt;setPrice(20); } //Mage::log($rate-&gt;getPrice()); } </code></pre> <p><strong>Question:</strong></p> <p>Am I using the right observer/method for this task? It only works for one step – once I click 'Continue' to place the order, it resets to the default price. My way of setting the delivery price may be wrong. Can you put me on the right track or suggest a solution?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload