[英]Opencart - I want to create a set of radio button in checkout page
我想在交货方式下的结帐页面中创建一组单选按钮-sellegance主题。
我的代码出现在传递方法部分。 但是问题是我不知道如何从单选按钮接收值。 我希望将该值与结帐页面中的其他信息一起发送到我的电子邮件中。
我将代码放在/public_html/catalog/view/theme/sellegance/template/checkout/shipping_method.tpl中
<label class="inline-radio"><input type="radio" name="delivery_method" value="delivery" id="delivery" checked/> Ship only </label> <label class="inline-radio"> <input type="radio" name="delivery_method" value="delivery2" id="delivery2"/> Ship ready</label> <label class="inline-radio"> <input type="radio" name="delivery_method" value="delivery3" id="delivery3" /> Consult </label>
假设您的代码是使用POST方法的表单的一部分,则需要引用$_POST['delivery_method']
。
您必须修改适当的控制器来处理POST数据。 它位于catalog/controller/checkout/shipping_method.php
。 您正在寻找的方法可能是在第88行附近的validate()
。
看看Stefan Koenen对另一个问题的答案: php-测试是否选择了单选按钮并获取值
希望这可以帮助!
Here is full solution....
Open file..
/*** TIME SLOT OPENCART CODING ***/
C:\wamp\www\OC\catalog\controller\checkout\shipping_method.php
1)
Find :-
$this->session->data['comment'] = strip_tags($this->request->post['comment']);
After that copy and paste :-
$this->session->data['shipping_timeslot'] = $this->request->post['shipping_timeslot'];
-------------------------------------------------------------------------------------------------------------
2)
Find :-
$this->data['text_shipping_method'] = $this->language->get('text_shipping_method');
After that copy and paste :-
$this->data['text_shipping_timeslot'] = $this->language->get('text_shipping_timeslot');
$this->data['ship_slot_one'] = $this->language->get('ship_slot_one');
$this->data['ship_slot_two'] = $this->language->get('ship_slot_two');
$this->data['ship_slot_three'] = $this->language->get('ship_slot_three');
$this->data['ship_slot_four'] = $this->language->get('ship_slot_four');
-------------------------------------------------------------------------------------------------------------
3)
Find :-
if (isset($this->session->data['comment'])) {
$this->data['comment'] = $this->session->data['comment'];
} else {
$this->data['comment'] = '';
}
After that copy and paste :-
if (isset($this->session->data['shipping_timeslot'])) {
$this->data['shipping_timeslot'] = $this->session->data['shipping_timeslot'];
} else {
$this->data['shipping_timeslot'] = '';
}
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
C:\wamp\www\OC\catalog\model\checkout\order.php
1)
Find :-
commission = '" . (float)$data['commission'] . "'
After that copy and paste :-
shipping_time_slot = '" . $this->db->escape($data['shipping_timeslot']) . "',
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
C:\wamp\www\OC\catalog\language\english\checkout\checkout.php
1)
Find :-
$_['text_length']
After that copy and paste :-
$_['text_shipping_timeslot'] = 'Please select the preferred shipping time slot.';
$_['ship_slot_one'] = 'Morning';
$_['ship_slot_two'] = 'Afternoon';
$_['ship_slot_three'] = 'Evening';
$_['ship_slot_four'] = 'Night';
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
C:\wamp\www\OC\catalog\view\theme\vitalia\template\checkout\shipping_method.tpl
1)
Find :-
<p><?php echo $text_shipping_method; ?></p>
Above that copy and paste :-
<p><?php echo $text_shipping_timeslot; ?></p>
<table class="radio">
<tr>
<td colspan="3"><b><?php echo "Delivery time slot"; ?></b></td>
</tr>
<tr class="highlight">
<td>
<input type="radio" name="shipping_timeslot" value="<?php echo $ship_slot_one; ?>" id="morning" checked="checked"/><?php echo $ship_slot_one; ?></br>
<input type="radio" name="shipping_timeslot" value="<?php echo $ship_slot_two; ?>" id="afternoon"/><?php echo $ship_slot_two; ?></br>
<input type="radio" name="shipping_timeslot" value="<?php echo $ship_slot_three; ?>" id="evening"/><?php echo $ship_slot_three; ?></br>
<input type="radio" name="shipping_timeslot" value="<?php echo $ship_slot_four; ?>" id="night"/><?php echo $ship_slot_four; ?></br>
</td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
</table>
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
C:\wamp\www\OC\admin\controller\sale\order.php
1)
Find :-
$this->data['store_url'] = $order_info['store_url'];
Above that copy and paste :-
$this->data['shipping_time_slot'] = $order_info['shipping_time_slot'];
-------------------------------------------------------------------------------------------------------------
2)
Find :- May be line no. 1580
$this->data['comment'] = nl2br($order_info['comment']);
Below that copy and paste :-
$this->data['shipping_time_slot'] = $order_info['shipping_time_slot'];
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
C:\wamp\www\OC\catalog\controller\checkout\confirm.php
1)
Find :-
$data['comment'] = $this->session->data['comment'];
Below that copy and paste :-
$data['shipping_timeslot'] = $this->session->data['shipping_timeslot'];
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
C:\wamp\www\OC\admin\language\english\sale\order.php
1)
Find :-
$_['text_store_name'] = 'Store Name:';
Below that copy and paste :-
$_['text_time_slot'] = 'Time Slot:';
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
C:\wamp\www\OC\admin\view\template\sale\order_info.tpl
1)
Find :-
<tr>
<td><?php echo $text_store_name; ?></td>
<td><?php echo $store_name; ?></td>
</tr>
Below that copy and paste :-
<tr>
<td><?php echo $text_time_slot; ?></td>
<td><?php echo $shipping_time_slot ?></td>
</tr>
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
C:\wamp\www\OC\admin\model\sale\order.php
1)
Find :-
'date_modified' => $order_query->row['date_modified']
Below that copy and paste :-
,
'shipping_time_slot' => $order_query->row['shipping_time_slot']
-------------------------------------------------------------------------------------------------------------
THATS IT
-------------------------------------------------------------------------------------------------------------
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.