zoukankan      html  css  js  c++  java
  • zencart批量插入TEXT文本属性attributes

    有时候上传的产品与多级分类比较多,在后台添加文本属性如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');
    ?>

    打完收工!

  • 相关阅读:
    史上最简单易懂的Android Pad手机屏幕适配方案
    Android平板开发
    Android TV 开发 (1)
    三大开源java区块链库
    将博客园数据导出到wordpress
    MQTT结构分析
    netty+mqtt
    安卓原生 VideoView实现rtsp流媒体的播放
    【矩阵专题】——矩阵加速
    征战蓝桥 —— 2016年第七届 —— C/C++A组第4题——快速排序
  • 原文地址:https://www.cnblogs.com/afish/p/4122543.html
Copyright © 2011-2022 走看看