企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
### 根据sku_id/item_id获取商品尺寸信息 **位置:** Common\Lib\GoodsLib.class.php **参数:** * @param array $good_id sku_id 或者item_id * @param array $good_type ID类型:1、SKU,2、唯一码 * @return array $dim_list 尺寸信息的数组 **调用:** * $GoodsLib = new GoodsLib; * $GoodsLib->getDim($good_id, $good_type) ; **完整代码:** ~~~ /** * * 根据sku_id/item_id获取商品尺寸信息 * whz 2018-07-25 * @param array $good_id sku_id 或者item_id * @param array $good_type ID类型:1、SKU,2、唯一码 * @return array $dim_list 尺寸信息的数组 */ public function getDim($good_id, $good_type) { //根据唯一码查找所属SKU的ID if ($good_type == 2) { $sku_id = M('goods_item') ->where(array('id' => $good_id)) ->getField('sku_id'); }elseif ($good_type == 1) { $sku_id = $good_id; } $dim_list = M('goods_attr_relation as a') ->field('a.id,a.attr_value,b.attr_name') ->join('coscia_goods_attribute as b on a.attr_id = b.id','left') ->where(array('a.goods_id'=>$sku_id, 'a.goods_type'=>3, 'a.is_delete'=>0, 'b.is_delete'=>0, 'b.attr_type'=>3)) ->select(); return $dim_list; } ~~~