问题描述:

Edit

It looks like the called to get the rate code is returning the same thing for all of those shipping options. It looks like I need to find a way to define the reate code for each shipping option.

End Edit

I created a custom shipping module in Magento for UPS Freight shipping. I needed options for Freight + Lift Gate, Freight + Residential, and Freight + Lift Gate & Residential. Per a response on another board, instead of having a checkbox for each of these options I just create separate methods.

As you can see from the image, Magento is calculating the prices correctly. The issue I have is that when I select one of the options and hit "update total", it reverts back to the first option with the lowest price. After inspecting the inputs on the radio buttons, I found that they all have the same value.

<ul>

<li>

<input name="estimate_method[2]" type="radio" value="excellence_excellence" id="s_method_excellence_excellence_2" class="radio">

<label for="s_method_excellence_excellence_2">Freight<span class="price">$678.88</span></label>

</li>

<li>

<input name="estimate_method[2]" type="radio" value="excellence_excellence" id="s_method_excellence_excellence_2" class="radio">

<label for="s_method_excellence_excellence_2">Freight (Residential)<span class="price">$744.66</span></label>

</li>

.

. and so on.

.

</ul>

Since all of the inputs have the same value "excellence_excellence", it makes sense that the price would just default back to the first one. Unfortunately, I have no idea how to fix this.

Below are links to my Model class, config.xml, and system.xml files. Any help, thoughts, or resources provided would be greatly appreciated.

Model

Config

System

网友答案:

I looked at your model file, and it has this:

$method->setCarrier($this->_code);
$method->setMethod($this->_code);

and $this->_code is "excellence" so you might consider change method by adding name of the allowed method like :

$method->setMethod($this->_code.$allowedmethod_code); //where allowedmethod_code have to be set based on your custom method names
网友答案:

try this

"<input name="estimate_method[]"

This will generate a unique array index for this specific input.

相关阅读:
Top