小编Kun*_*ngh的帖子

如何使用默认选择下拉列表关闭自定义jquery下拉列表

我试图关闭一个自定义jquery下拉单击外部下拉列表,就像HTML选择下拉列表的默认行为,我试图使用窗口单击,但这在创建自己的下拉列表时遇到麻烦.

$(".selected").click(function() {
  $(".custom-dropdown-list").toggleClass("open");
});

$(".custom-dropdown-list li").click(function() {
  var dataVal = $(this).attr("data-val");
  var dpText1 = $(this).children('.dp-val1').text();
  var dpText2 = $(this).children('.dp-val2').text();
  $(".selected").attr("data-val", dataVal);
  $(".selected .dp-val1").text(dpText1);
  $(".selected .dp-val2").text(dpText2);
  $(".custom-dropdown-list").removeClass("open");
});
Run Code Online (Sandbox Code Playgroud)
.custom-dropdown {
  width: 300px;
}

.selected {
  padding: 5px;
  cursor: pointer;
  min-height: 37px;
  background-color: #ccc;
}

.custom-dropdown-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: none;
}

.custom-dropdown-list.open {
  display: block;
}

.custom-dropdown-list li {
  padding: 5px;
  cursor: pointer;
}

.custom-dropdown-list li:hover {
  background: #f2f2f2;
}
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="custom-dropdown">
  <div class="selected" …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery

3
推荐指数
1
解决办法
159
查看次数

如何在wordpress中通过页面标题获取页面id

在这些情况下,当单词之间有空格时,我无法通过页面标题获取页面 ID

  1. 想一想
  2. 你好吗

但是当它是像“user”这样的单字标题时我能够获得id

我的代码放在这里

function get_ID_by_page_name($page_name)
{
    global $wpdb;
    $page_name_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '".$page_name."'");
    return $page_name_id;
}



$thinkid = ks_get_option('ks_thinkid'); //getting page title from theme option
echo $thinkid; // works successfull till this 

$the_page_id = get_ID_by_page_name($thinkid);
echo $the_page_id;
Run Code Online (Sandbox Code Playgroud)

wordpress

2
推荐指数
1
解决办法
1万
查看次数

PHP数组到字符串转换错误

我试图从我的数据库表中输出一些内容,我成功地进行了查询并返回控制器代码但是当我在我的视图中尝试输出它时,我尝试了什么

 <tr>
            <?php foreach ($products as $product) { ?>
            <td>
     <pre>
            <?php
            var_dump($products[$product['product_id']]['manufacturers']);

                   foreach ($products[$product['product_id']]['manufacturers'] as $manufacturer) { 
                    echo $manufacturer;
                   } ?>
            </pre>
            </td>
            <?php } ?>
          </tr>
Run Code Online (Sandbox Code Playgroud)

错误

注意:第72行的C:\ xampp\htdocs\usa\catalog\view\theme\usadevims\template\product\compare.tpl中的数组到字符串转换ArrayNotice:C:\ xampp\htdocs\usa\catalog中的数组到字符串转换第72行的\ view\theme\usadevims\template\product\compare.tplArrayNotice:第72行的C:\ xampp\htdocs\usa\catalog\view\theme\usadevims\template\product\compare.tpl中的数组到字符串转换

这里是我的变量的var_dump

array(3) {
      [0]=>
      array(2) {
        ["name"]=>
        string(5) "Apple"
        ["manufacturer_id"]=>
        string(1) "8"
      }
      [1]=>
      array(2) {
        ["name"]=>
        string(3) "HTC"
        ["manufacturer_id"]=>
        string(1) "5"
      }
      [2]=>
      array(2) {
        ["name"]=>
        string(4) "Sony"
        ["manufacturer_id"]=>
        string(2) "10"
      }
    }
Run Code Online (Sandbox Code Playgroud)

php

1
推荐指数
1
解决办法
2万
查看次数

Opencart最低订单价格

我试图在catalog/view/theme/default/template/checkout/confirm.tpl中实现以下代码

<?php if ($this->cart->getSubtotal() >= 1000) { ?>
<div id="payment"><?php echo $payment; ?></div>
<?php } else { ?>
<div class="warning">Minimum 10 Euro to checkout</div>
<?php }  ?> 
Run Code Online (Sandbox Code Playgroud)

但我收到一个错误

Notice: Undefined property: Loader::$cart in C:\xampp\htdocs\optest\catalog\view\theme\default\template\checkout\confirm.tpl on line 51
Fatal error: Call to a member function getSubtotal() on null in C:\xampp\htdocs\optest\catalog\view\theme\default\template\checkout\confirm.tpl on line 51
Run Code Online (Sandbox Code Playgroud)

参考:

Opencart最低订单价格不包括一个类别

http://forum.opencart.com/viewtopic.php?t=53810

php opencart opencart2.x

1
推荐指数
1
解决办法
2049
查看次数

OpenCart Blog模块错误

我已经安装了这个模块([ http://www.opencart.com/index.php?route=extension/extension/info&extension_id=11671][1]在我的车),但是当我尝试编辑博客的模块其输出我这些错误可以帮助我摆脱这个错误.谢谢

Notice: Indirect modification of overloaded property ControllerModuleBlog::$data has no effect in C:\xampp\htdocs\chip\admin\controller\module\blog.php on line 146Notice: Indirect modification of overloaded property ControllerModuleBlog::$data has no effect in C:\xampp\htdocs\chip\admin\controller\module\blog.php on line 148Notice: Indirect modification of overloaded property ControllerModuleBlog::$data has no effect in C:\xampp\htdocs\chip\admin\controller\module\blog.php on line 154Notice: Indirect modification of overloaded property ControllerModuleBlog::$data has no effect in C:\xampp\htdocs\chip\admin\controller\module\blog.php on line 160Notice: Indirect modification of overloaded property ControllerModuleBlog::$data has no effect in C:\xampp\htdocs\chip\admin\controller\module\blog.php on line 166Notice: Indirect modification of overloaded property ControllerModuleBlog::$data …
Run Code Online (Sandbox Code Playgroud)

php opencart vqmod

0
推荐指数
1
解决办法
7196
查看次数

标签 统计

php ×3

opencart ×2

css ×1

html ×1

javascript ×1

jquery ×1

opencart2.x ×1

vqmod ×1

wordpress ×1