Php Opencart-我想在结帐页面中创建一组单选按钮
我想在我的交付方法-sellegance主题的结帐页面中创建一组单选按钮 我的代码出现在交付方法部分。但问题是我不知道如何从单选按钮接收值。我希望该值与结帐页面中的其他信息一起发送到我的电子邮件中 我将代码放在/public_html/catalog/view/theme/sellegance/template/checkout/shipping_method.tpl中Php Opencart-我想在结帐页面中创建一组单选按钮,php,radio-button,smarty,opencart,Php,Radio Button,Smarty,Opencart,我想在我的交付方法-sellegance主题的结帐页面中创建一组单选按钮 我的代码出现在交付方法部分。但问题是我不知道如何从单选按钮接收值。我希望该值与结帐页面中的其他信息一起发送到我的电子邮件中 我将代码放在/public_html/catalog/view/theme/sellegance/template/checkout/shipping_method.tpl中 <label class="inline-radio"><input type="radio" name="
<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方法的表单的一部分,您需要参考$\u POST['delivery\u method']
的值
您必须修改处理POST数据的相应控制器。它位于catalog/controller/checkout/shipping\u method.php
。您正在查找的方法可能是第88行附近的validate()
看看Stefan Koenen对另一个问题的回答:
希望这有帮助 这里有类似的链接,您可以简单地跟随它们 对于电子邮件,您需要在以下位置修改值:
catalog>model>checkout>order::confirm()
这里是完整的解决方案。。。。
打开文件。。
/***时隙OPENCART编码***/
C:\wamp\www\OC\catalog\controller\checkout\shipping\u method.php
1)
发现:-
$this->session->data['comment']=strip_标签($this->request->post['comment']);
复制和粘贴之后:-
$this->session->data['shipping\u timeslot']=$this->request->post['shipping\u timeslot'];
-------------------------------------------------------------------------------------------------------------
2)
发现:-
$this->data['text\u shipping\u method']=$this->language->get('text\u shipping\u method');
复制和粘贴之后:-
$this->data['text\u shipping\u timeslot']=$this->language->get('text\u shipping\u 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\u slot\u three']=$this->language->get('ship\u slot\u three');
$this->data['ship\u slot\u four']=$this->language->get('ship\u slot\u four');
-------------------------------------------------------------------------------------------------------------
3)
发现:-
如果(isset($this->session->data['comment'])){
$this->data['comment']=$this->session->data['comment'];
}否则{
$this->data['comment']='';
}
复制和粘贴之后:-
如果(isset($this->session->data['shipping\u timeslot'])){
$this->data['shipping\u timeslot']=$this->session->data['shipping\u timeslot'];
}否则{
$this->data['shipping\u timeslot']='';
}
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
C:\wamp\www\OC\catalog\model\checkout\order.php
1)
查找:-
佣金=”(浮动)$data[“佣金”]。“'
复制和粘贴之后:-
shipping_time_slot='“$this->db->escape($data['shipping_timeslot'])。”,
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
C:\wamp\www\OC\catalog\language\english\checkout\checkout.php
1)
查找:-
$\u['text\u length']
复制和粘贴之后:-
$\u['text\u shipping\u timeslot']=“请选择首选的装运时段。”;
$u['ship_slot_one']='Morning';
美元['ship_slot_two']=“午后”;
$u['ship_slot_three']='night';
$\u['ship\u slot\u four']='Night';
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
C:\wamp\www\OC\catalog\view\theme\vitalia\template\checkout\shipping\u method.tpl
1)
查找:-
在该复制和粘贴上方:-
我不明白链接。这是第三方物流的吗?您想让我在catalog>model>checkout>order::confirm()中修改值,我应该在哪里添加值?实际上,这只是一个参考链接,显示了如何在checkout页面上进行修改,上面的链接显示了如何添加radio on delivery address。当您要求向电子邮件发送其他信息时,catalog>model>checkout>order::confirm()包含一个邮件函数,可帮助您在订单签出确认后发送电子邮件
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
-------------------------------------------------------------------------------------------------------------