有时候上传的产品与多级分类比较多,在后台添加文本属性如Name,Number等需要顾客自定义的内容就比较费神了。现在只需将以下代码保存为insert_attributes.php,变量$options_id_array,$current_category_id修改为实际的值,上传到网站根目录运行即可一步到位。

<?php
//header("content-Type: text/html; charset=utf-8");
@set_time_limit(1800);
@ini_set('memory_limit','100M');
require('includes/application_top.php');
$options_id_array = array(2,3); //文本属性对应的ID数组
$current_category_id = 99; //要批量设置文本属性的产品分类ID $categories_products_list = zen_get_categories_products_list($current_category_id);
$plist_array = array();
foreach($categories_products_list as $key => $value){
$plist_array[] = $key;
}
//print_r($plist_array); foreach($plist_array as $pid){
foreach($options_id_array as $optid){
$db->Execute("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " (products_id, options_id, options_values_id, options_values_price, price_prefix, product_attribute_is_free, products_attributes_weight_prefix, attributes_display_only, attributes_default, attributes_discounted) values('" . (int)$pid . "', '" . (int)$optid . "', 0, '0.0000', '+', '1', '+', 0, 0, '1')");
}
} echo '<center style="color:#009900; font-size:14px;padding-top:50px;">Insert Attributes Success!</center>'; require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

打完收工!

zencart批量插入TEXT文本属性attributes的更多相关文章

  1. 给iOS开发新手送点福利,简述文本属性Attributes的用法

    给iOS开发新手送点福利,简述文本属性Attributes的用法   文本属性Attributes 1.NSKernAttributeName: @10 调整字句 kerning 字句调整 2.NSF ...

  2. IOS开发UI基础文本属性Attributes

    文本属性Attributes 1.NSKernAttributeName: @10 调整字句 kerning 字句调整 2.NSFontAttributeName : [UIFont systemFo ...

  3. iOS- 详解文本属性Attributes(转)

    iOS- 详解文本属性Attributes 1.NSKernAttributeName: @10 调整字句 kerning 字句调整 2.NSFontAttributeName : [UIFont s ...

  4. 关于html与css的标签及属性(text文本属性、背景background属性、表格标签table、列表、)

    text文本属性1.颜色 colorcolor:red: 2.文本缩进text-indant属性值 num+px text-indant:10px:3.文本修饰 text-decoration属性值: ...

  5. HTML+css基础 Text文本属性

    Text文本属性: 1.颜色  color color:red 2.文本缩进 text-indent 属性值 数字+px: text-indent:10px: 3.文本修饰 text-decorati ...

  6. text——文本属性大全

    一.文字颜色(color:red;) <style> body {color:red} h1 {color:greenyellow} p.color {color:blue} </s ...

  7. 文本属性Attributes

    1.NSKernAttributeName: @10 调整字句 kerning 字句调整 2.NSFontAttributeName : [UIFont systemFontOfSize:_fontS ...

  8. iOS- 详解文本属性Attributes

    1.NSKernAttributeName: @10 调整字句 kerning 字句调整 2.NSFontAttributeName : [UIFont systemFontOfSize:_fontS ...

  9. iOS之文本属性Attributes的使用

    1.NSKernAttributeName: @10 调整字句 kerning 字句调整 2.NSFontAttributeName : [UIFont systemFontOfSize:_fontS ...

随机推荐

  1. python3速查参考- python基础 2 -> if语句应用 + while循环应用

    if语句应用之——求最大值 """ 求三个数字中的最大值,并打印出来 """ a = int(input("a:")) ...

  2. matlab作业之m文件的建立与使用运行

    画曲线y=xsin(ex-x),要求编写m文件,qx1.m,要求有标注 实现方法: 打开matlab,点击左上角新建 然后打开编辑器 在编辑器里输入函数语句 ctrl+s保存,这里的名字要命名成××× ...

  3. USACO 1.1 Your Ride Is Here

    直接模拟 #include<cstdio> #include<cstring> using namespace std; #define MAXN 10 #define MOD ...

  4. elasticsearch 常用查询 + 删除索引 + 集群状态诊断

    1.多条件查询 curl -X POST \ http://10.0.0.42:9200/addressbook_user/_search \ -H 'cache-control: no-cache' ...

  5. 手写Indexof

    String.prototype.indexO = function(st){ // console.log(this.length); let str = this; var j = 0; let ...

  6. Redis迁移键

    迁移键: move key db 用于在Redis内部进行数据迁移 dump key + restore key ttl value 可以实现在不同的Redis实例之间进行数据迁移 127.0.0.1 ...

  7. 一篇文章理解JS继承——原型链/构造函数/组合/原型式/寄生式/寄生组合/Class extends

    说实在话,以前我只需要知道"寄生组合继承"是最好的,有个祖传代码模版用就行.最近因为一些事情,几个星期以来一直心心念念想整理出来.本文以<JavaScript高级程序设计&g ...

  8. WPF——Application

    Application类处于WPF应用程序的最顶端,main函数就在这个类中. Application类的作用: 截图连接 https://docs.microsoft.com/zh-cn/dotne ...

  9. 怎样在 Vue 中使用 事件修饰符 ?

    Vue 中可以通过 v-on 来绑定事件监听函数, 不过事件会有许多额外情况, 比如 是否阻止冒泡 / 是否阻止重载 / 是否限制点击次数 / 是否可以通过按键触发 等等. 这时就需要使用到 事件修饰 ...

  10. django 支持跨域请求配置

    参考:https://www.jianshu.com/p/63fb55bee142 核心注意点: