我使用了paypal自动生成的下拉列表,下面的代码就是它生成的内容。它工作得很好,但是当您选择一个选项并进入付费用户评论页面时,它不会显示所选选项的说明。我似乎无法弄清楚如何让它发挥作用。我希望有人能够帮助我。
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="emailaddress@yahoo.com">
<table>
<tbody>
<tr>
<td>PURCHASE A RATE OPTION</td>
</tr>
<tr>
<td><select name="os0">
<option value="HOURLY">HOURLY $50.00 USD</option>
<option value="1/2 HOURLY">1/2 HOURLY $30.00 USD</option>
<option value="MONTH CONTRACT HOURLY">MONTH CONTRACT HOURLY $160.00 USD</option>
<option value="MONTH CONTRACT 1/2 HOURLY">MONTH CONTRACT 1/2 HOURLY $80.00 USD</option>
<option value="SKYPE MONTH HOURLY">SKYPE MONTH HOURLY $30.00 USD</option>
<option value="SKYPE 1/2 HOURLY">SKYPE 1/2 HOURLY $20.00 USD</option>
<option value="SKYPE MONTH CONTRACT HOURLY">SKYPE MONTH CONTRACT HOURLY $80.00 USD</option>
<option value="SKYPE MONTH CONTRACT 1/2 HOURLY">SKYPE MONTH CONTRACT 1/2 HOURLY $60.00 USD</option>
</select></td>
</tr>
</tbody>
</table>
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="item_name" value="HOURLY" />
<input type="hidden" name="option_select0" value="HOURLY" />
<input type="hidden" name="option_amount0" value="50.00" />
<input type="hidden" name="option_select1" value="1/2 HOURLY" />
<input type="hidden" name="option_amount1" value="30.00" />
<input type="hidden" name="option_select2" value="MONTH CONTRACT HOURLY" />
<input type="hidden" name="option_amount2" value="160.00" />
<input type="hidden" name="option_select3" value="MONTH CONTRACT 1/2 HOURLY" />
<input type="hidden" name="option_amount3" value="80.00" />
<input type="hidden" name="option_select4" value="SKYPE MONTH HOURLY" />
<input type="hidden" name="option_amount4" value="30.00" />
<input type="hidden" name="option_select5" value="SKYPE 1/2 HOURLY" />
<input type="hidden" name="option_amount5" value="20.00" />
<input type="hidden" name="option_select6" value="SKYPE MONTH CONTRACT HOURLY" />
<input type="hidden" name="option_amount6" value="80.00" />
<input type="hidden" name="option_select7" value="SKYPE MONTH CONTRACT 1/2 HOURLY" />
<input type="hidden" name="option_amount7" value="60.00" />
<input type="hidden" name="option_index" value="0" />
<input type="image" style="height:47px; width:171px;" alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" />
<img alt="" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" border="0" />
答案 0 :(得分:0)
似乎不允许改变价格。
选项字段不能用于会改变商品价格的选项
但是,您可以尝试重新构建表单流。以下是如何使用选项字段(来自同一链接)的示例:
<table>
<tr>
<td>
<input type="hidden" name="on0" value="Size">Size</td>
<td>
<select name="os0">
<option value="Select a Size">Select a Size
<option value="Small">Small
<option value="Medium">Medium
<option value="Large">Large
</select></td>
</tr>
<tr>
<td>
<input type="hidden" name="on1" value="Color" maxlength="200">Color</td>
<td>
<input type="text" name="os1"></td>
</tr>
</table>
此示例定义了两个自定义输入:一个用于大小,一个用于Color。请记住,无论您使用选择还是文本输入,用户都可以通过console / inspect元素修改这些值(可能是为什么它们不允许更改价格)。
每个变量基本上有三个部分,它们共享一个索引。每对由onX和osX字段名称组成(X是示例中的索引,如0和1)。
注意:我不确定是否需要首先定义onX变量,因为它们在他们的网站上就是这样的例子,但不应该重要。
希望这会有所帮助:)
答案 1 :(得分:0)
是的,你可以有一个修改价格的下拉菜单 - 但只有一个。实际上,您发布的示例几乎就在那里 - 您只是缺少一个字段:买方选择的选项名称(on0
)。这是一个“固定”的例子:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="emailaddress@yahoo.com">
<table>
<tbody>
<tr>
<td>PURCHASE A RATE OPTION</td>
</tr>
<tr>
<td><select name="os0">
<option value="HOURLY">HOURLY $50.00 USD</option>
<option value="1/2 HOURLY">1/2 HOURLY $30.00 USD</option>
<option value="MONTH CONTRACT HOURLY">MONTH CONTRACT HOURLY $160.00 USD</option>
<option value="MONTH CONTRACT 1/2 HOURLY">MONTH CONTRACT 1/2 HOURLY $80.00 USD</option>
<option value="SKYPE MONTH HOURLY">SKYPE MONTH HOURLY $30.00 USD</option>
<option value="SKYPE 1/2 HOURLY">SKYPE 1/2 HOURLY $20.00 USD</option>
<option value="SKYPE MONTH CONTRACT HOURLY">SKYPE MONTH CONTRACT HOURLY $80.00 USD</option>
<option value="SKYPE MONTH CONTRACT 1/2 HOURLY">SKYPE MONTH CONTRACT 1/2 HOURLY $60.00 USD</option>
</select></td>
</tr>
</tbody>
</table>
<input type="hidden" name="on0" value="Selected service option" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="item_name" value="Service Payment" />
<input type="hidden" name="option_select0" value="HOURLY" />
<input type="hidden" name="option_amount0" value="50.00" />
<input type="hidden" name="option_select1" value="1/2 HOURLY" />
<input type="hidden" name="option_amount1" value="30.00" />
<input type="hidden" name="option_select2" value="MONTH CONTRACT HOURLY" />
<input type="hidden" name="option_amount2" value="160.00" />
<input type="hidden" name="option_select3" value="MONTH CONTRACT 1/2 HOURLY" />
<input type="hidden" name="option_amount3" value="80.00" />
<input type="hidden" name="option_select4" value="SKYPE MONTH HOURLY" />
<input type="hidden" name="option_amount4" value="30.00" />
<input type="hidden" name="option_select5" value="SKYPE 1/2 HOURLY" />
<input type="hidden" name="option_amount5" value="20.00" />
<input type="hidden" name="option_select6" value="SKYPE MONTH CONTRACT HOURLY" />
<input type="hidden" name="option_amount6" value="80.00" />
<input type="hidden" name="option_select7" value="SKYPE MONTH CONTRACT 1/2 HOURLY" />
<input type="hidden" name="option_amount7" value="60.00" />
<input type="hidden" name="option_index" value="0" />
<input type="image" style="height:47px; width:171px;" alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" />
<img alt="" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" border="0" />