Example #1
0
     $sql = "DELETE FROM " . $ecs->table('goods_attr') . " WHERE goods_id = 0";
     $db->query($sql);
     /* 图片列表 */
     $img_list = array();
 } else {
     /* 商品信息 */
     $sql = "SELECT * FROM " . $ecs->table('goods') . " WHERE goods_id = '{$_REQUEST['goods_id']}'";
     $goods = $db->getRow($sql);
     //dump($goods);
     /* 虚拟卡商品复制时, 将其库存置为0*/
     if ($is_copy && $code != '') {
         $goods['goods_number'] = 0;
     }
     if (empty($goods) === true) {
         /* 默认值 */
         $goods = array('goods_id' => 0, 'goods_desc' => '', 'goods_shipai' => '', 'cat_id' => 0, 'is_on_sale' => '1', 'is_alone_sale' => '1', 'is_shipping' => '0', 'other_cat' => array(), 'goods_type' => 0, 'shop_price' => 0, 'promote_price' => 0, 'market_price' => 0, 'integral' => 0, 'goods_number' => 1, 'warn_number' => 1, 'promote_start_date' => local_date('Y-m-d'), 'promote_end_date' => local_date('Y-m-d', gmstr2tome('+1 month')), 'goods_weight' => 0, 'give_integral' => -1, 'rank_integral' => -1);
     }
     /* 获取商品类型存在规格的类型 */
     $specifications = get_goods_type_specifications();
     $goods['specifications_id'] = $specifications[$goods['goods_type']];
     $_attribute = get_goods_specifications_list($goods['goods_id']);
     $goods['_attribute'] = empty($_attribute) ? '' : 1;
     /* 根据商品重量的单位重新计算 */
     if ($goods['goods_weight'] > 0) {
         $goods['goods_weight_by_unit'] = $goods['goods_weight'] >= 1 ? $goods['goods_weight'] : $goods['goods_weight'] / 0.001;
     }
     if (!empty($goods['goods_brief'])) {
         //$goods['goods_brief'] = trim_right($goods['goods_brief']);
         $goods['goods_brief'] = $goods['goods_brief'];
     }
     if (!empty($goods['keywords'])) {
Example #2
0
				'packing_list'  => '',
				'customer_service'  => '',
                'cat_id'        => 0,
                'is_on_sale'    => '1',
                'is_alone_sale' => '1',
                'is_shipping' => '0',
                'other_cat'     => array(), // 扩展分类
                'goods_type'    => 0,       // 商品类型
                'shop_price'    => 0,
                'promote_price' => 0,
                'market_price'  => 0,
                'integral'      => 0,
                'goods_number'  => 1,
                'warn_number'   => 1,
                'promote_start_date' => local_date('Y-m-d'),
                'promote_end_date'   => local_date('Y-m-d', gmstr2tome('+1 month')),
                'goods_weight'  => 0,
                'give_integral' => -1,
                'rank_integral' => -1
            );
        }

        /* 获取商品类型存在规格的类型 */
        $specifications = get_goods_type_specifications();
        $goods['specifications_id'] = $specifications[$goods['goods_type']];
        $_attribute = get_goods_specifications_list($goods['goods_id']);
        $goods['_attribute'] = empty($_attribute) ? '' : 1;

        /* 根据商品重量的单位重新计算 */
        if ($goods['goods_weight'] > 0)
        {