zoukankan      html  css  js  c++  java
  • opencart中文版checkout设置city和county为非必选

      opencart中文版在opencart原版进行了一些修改,添加了适合国内使用的设置,但是并不适合国外用户,比如订单页面的收货地址添加了国内的城市和区县,而国外的city和county被删减了,这两项又是必选项,如何设置为非必填项呢?随ytkah一起来看看。本文中opencart版本为3.0.2.0中文版。

    opencart设置city为非必选项

      1、首先打开文件/catalog/controller/checkout/checkout.php,大概896行,找到shipping_city_id和shipping_county_id,注释掉error提示

    if (!isset($this->request->post['shipping_city_id']) || (int)$this->request->post['shipping_city_id'] <= 0) {
    //			$error['city'] = $this->language->get('error_city');
    		}
    
    		if (!isset($this->request->post['shipping_county_id']) || (int)$this->request->post['shipping_county_id'] <= 0) {
    //			$error['county'] = $this->language->get('error_county');
    		}
    

      2、打开/catalog/view/theme/wist/template/checkout/checkout/_shipping_address.twig,大概69行,把required的class去掉,即

    <div class="form-group required">
    改为
    <div class="form-group">
    完整代码如下
     
          <div class="form-group ">
            <label class="col-sm-2 control-label" for="input-shipping-city">{{ entry_city }}</label>
            <div class="col-sm-10">
              <select name="shipping_city_id" id="input-shipping-city" class="form-control">
                <option value="">{{ text_select }}</option>
              </select>
            </div>
          </div>
          <div class="form-group ">
            <label class="col-sm-2 control-label" for="input-shipping-county">{{ entry_county }}</label>
            <div class="col-sm-10">
              <select name="shipping_county_id" id="input-shipping-county" class="form-control">
                <option value="">{{ text_select }}</option>
              </select>
            </div>
          </div>
    

      保存上传,刷新缓存,再测试一下city和county是不是可以不用选了。

  • 相关阅读:
    STM32-使用软件模拟I2C读写外部EEPROM(AT24C02)
    STM32-软件模拟I2C
    STM32_使用DAC输出三角波
    VS常用快捷键
    C语言volatile关键字在单片机中的作用
    如何使用数据库引擎优化顾问优化数据库(转)
    SQLServer数据库慢查询追踪
    怎么获取基金净值数据?(科普)
    解决了一个ssh登录缓慢的问题
    oracle存储过程转达梦8存储过程时踩过的坑2(完结篇)
  • 原文地址:https://www.cnblogs.com/ytkah/p/11128140.html
Copyright © 2011-2022 走看看