magento根据产品模型号及尺码,进行上下架操作。

SELECT option_id    FROM `catalog_product_option`  where  product_id=(SELECT entity_id   FROM `catalog_product_entity`  where sku=’test’ )

option_type_id=SELECT  F.option_type_id   FROM  catalog_product_option_type_value as F left join catalog_product_option_type_title as S     on  F.option_type_id=S.option_type_id where F.option_id=55 and S.title=’M’

delete FROM `catalog_product_option_type_value` where  option_type_id=310

delete   FROM `catalog_product_option_type_price`  where option_type_id=310 ——-下架SQL

整体下架:

update cataloginventory_stock_item set qty=’0′ where item_id=(select entity_id as item_id from catalog_product_entity where sku=’sku值’);
———————————–上架SQL

SELECT option_id    FROM `catalog_product_option`  where  product_id=(SELECT entity_id   FROM `catalog_product_entity`  where sku=’test’ )

$arrInfo=SELECT option_type_id   FROM `catalog_product_option_type_value` where option_id=’55’ —-查询主表的信息
//备注:$arrInfo数组

循环删除下面属性表
foreach($arrInfo as  ){

delete FROM `catalog_product_option_type_value` where  option_type_id=310

delete   FROM `catalog_product_option_type_title` where  option_type_id=310
}

delete FROM `catalog_product_option_type_value` where option_id=’55

插入数据
insert into catalog_product_option_type_value set option_id=’55’,sku=1,sort_order=1
foreach(){

获取option_type_id插入属性表
insert into catalog_product_option_type_price set set option_type_id=314,store_id=0

insert into catalog_product_option_type_title  set option_type_id=314,store_id=0,title=’M’

}


关注公众号,了解更多it技术(it问答网

发表评论

电子邮件地址不会被公开。