public function view_addInputOn() { $inputName = $_GET['inputName'] ? post_check(trim($_GET['inputName'])) : ''; $pid = $_GET['pid'] ? post_check(trim($_GET['pid'])) : ''; if (empty($inputName)) { $status = "属性名不能为空"; header("Location:index.php?mod=property&act=addInput&status={$status}"); exit; } if (empty($pid)) { $status = "类别不能为空"; header("Location:index.php?mod=property&act=addInput&status={$status}"); exit; } $categoryName = getAllCateNameByPath($pid); $pathImplodeStr = getAllPathBypid($pid); $tName = 'pc_archive_input'; $where = "WHERE inputName='{$inputName}' and categoryPath IN ({$pathImplodeStr})"; $count = OmAvailableModel::getTNameCount($tName, $where); if ($count) { $status = "{$categoryName} 或其父类下已经存在 {$inputName} 属性"; header("Location:index.php?mod=property&act=addInput&status={$status}"); exit; } $set = "SET inputName='{$inputName}',categoryPath='{$pid}'"; $insertId = OmAvailableModel::addTNameRow($tName, $set); if (!$insertId) { $status = "系统插入数据错误"; header("Location:index.php?mod=property&act=addInput&status={$status}"); exit; } $status = "{$categoryName} 中添加 {$inputName} 文本属性成功"; header("Location:index.php?mod=property&act=addInput&status={$status}"); }
public function view_updateSkuSing() { $id = $_GET['id'] ? post_check(trim($_GET['id'])) : ''; //检查spu是否非法 $tName = 'pc_goods'; $select = '*'; $where = "WHERE id={$id} and is_delete=0"; $skuList = OmAvailableModel::getTNameList($tName, $select, $where); if (empty($skuList)) { $status = "SKU不存在"; header("Location:index.php?mod=goods&act=getGoodsList&status={$status}"); exit; } $spu = $skuList[0]['spu']; $tName = 'pc_archive_spu_property_value_relation'; $select = '*'; $where = "WHERE spu='{$spu}'"; $PPV = OmAvailableModel::getTNameList($tName, $select, $where); $tName = 'pc_archive_spu_input_value_relation'; $INV = OmAvailableModel::getTNameList($tName, $select, $where); $tName = 'pc_archive_spu_link'; $Link = OmAvailableModel::getTNameList($tName, $select, $where); $navlist = array(array('url' => 'index.php?mod=goods&act=getGoodsList', 'title' => '产品信息'), array('url' => 'index.php?mod=goods&act=getGoodsList', 'title' => '产品信息列表'), array('url' => "index.php?mod=goods&act=updateSkuSing&id={$id}", 'title' => "修改产品信息_{$skuList[0]['sku']}")); $this->smarty->assign('navlist', $navlist); $this->smarty->assign('onevar', 1); $this->smarty->assign('twovar', 11); $this->smarty->assign('title', 'SKU修改'); $this->smarty->assign('id', $skuList[0]['id']); $this->smarty->assign('spu', $skuList[0]['spu']); $this->smarty->assign('sku', $skuList[0]['sku']); $this->smarty->assign('pid', $skuList[0]['goodsCategory']); $this->smarty->assign('goodsName', $skuList[0]['goodsName']); $this->smarty->assign('goodsCost', $skuList[0]['goodsCost']); $this->smarty->assign('goodsWeight', $skuList[0]['goodsWeight']); $this->smarty->assign('goodsNote', $skuList[0]['goodsNote']); $this->smarty->assign('goodsLength', $skuList[0]['goodsLength']); $this->smarty->assign('goodsWidth', $skuList[0]['goodsWidth']); $this->smarty->assign('goodsHeight', $skuList[0]['goodsHeight']); $this->smarty->assign('goodsColor', $skuList[0]['goodsColor']); $this->smarty->assign('goodsStatus', $skuList[0]['goodsStatus']); $this->smarty->assign('purchaseId', $skuList[0]['purchaseId']); $this->smarty->assign('pmId', $skuList[0]['pmId']); $this->smarty->assign('isPacking', $skuList[0]['isPacking']); $this->smarty->assign('goodsSize', $skuList[0]['goodsSize']); $this->smarty->assign('pmCapacity', $skuList[0]['pmCapacity']); $this->smarty->assign('isNew', $skuList[0]['isNew']); $pathImplodeStr = getAllPathBypid($skuList[0]['goodsCategory']); $this->smarty->assign('pathImplodeStr', $pathImplodeStr); $this->smarty->assign('PPV', $PPV); $this->smarty->assign('INV', $INV); $this->smarty->assign('Link', $Link); if ($skuList[0]['isNew'] == 1) { //是新品的话,不用加载图片 $spuPicList = array(); } else { $spuPicList = getAllArtPicFromOpenSysSpu($skuList[0]['spu']); } $this->smarty->assign('spuPicList', $spuPicList); $this->smarty->display("updateSkuSing.htm"); }
public function view_addSku() { $spu = $_GET['spu'] ? post_check(trim($_GET['spu'])) : ''; //检查spu,pid是否非法 if (empty($spu)) { $status = "非法spu"; header("Location:index.php?mod=autoCreateSpu&act=getAutoCreateSpuList&status={$status}&spu={$spu}"); exit; } $tName = 'pc_auto_create_spu'; $select = 'sort,purchaseId,isSingSpu'; $where = "WHERE spu='{$spu}' and is_delete=0"; $autoSpuList = OmAvailableModel::getTNameList($tName, $select, $where); if (empty($autoSpuList)) { $status = "自动生成SPU列表中不存在 {$spu}"; header("Location:index.php?mod=autoCreateSpu&act=getAutoCreateSpuList&status={$status}"); exit; } $isSingSpu = $autoSpuList[0]['isSingSpu']; //单/虚拟料号 if ($isSingSpu == 1) { //单料号 $tName = 'pc_spu_archive'; $select = '*'; $where = "WHERE spu='{$spu}' and is_delete=0"; $spuArchiveList = OmAvailableModel::getTNameList($tName, $select, $where); if (empty($spuArchiveList)) { $status = "未找到 {$spu} 的产品档案信息"; header("Location:index.php?mod=autoCreateSpu&act=getAutoCreateSpuList&status={$status}"); exit; } $tName = 'pc_archive_spu_property_value_relation'; $select = '*'; $where = "WHERE spu='{$spu}'"; $PPV = OmAvailableModel::getTNameList($tName, $select, $where); $tName = 'pc_archive_spu_input_value_relation'; $INV = OmAvailableModel::getTNameList($tName, $select, $where); $tName = 'pc_archive_spu_link'; $Link = OmAvailableModel::getTNameList($tName, $select, $where); $navlist = array(array('url' => 'index.php?mod=autoCreateSpu&act=getAutoCreatePrefixList', 'title' => 'SPU管理'), array('url' => 'index.php?mod=autoCreateSpu&act=getAutoCreateSpuList', 'title' => '生成SPU列表管理'), array('url' => "index.php?mod=autoCreateSpu&act=addSku&spu={$spu}", 'title' => "添加单料号_{$spu}")); $this->smarty->assign('navlist', $navlist); $this->smarty->assign('onevar', 2); $this->smarty->assign('twovar', 22); $this->smarty->assign('title', '添加单料号'); $this->smarty->assign('spu', $spuArchiveList[0]['spu']); $this->smarty->assign('pid', $spuArchiveList[0]['categoryPath']); $this->smarty->assign('spuName', $spuArchiveList[0]['spuName']); $this->smarty->assign('spuPurchasePrice', $spuArchiveList[0]['spuPurchasePrice']); $this->smarty->assign('purchaseId', $spuArchiveList[0]['purchaseId']); $this->smarty->assign('spuLowestPrice', $spuArchiveList[0]['spuLowestPrice']); $this->smarty->assign('referMonthSales', $spuArchiveList[0]['referMonthSales']); $this->smarty->assign('lowestUrl', $spuArchiveList[0]['lowestUrl']); $this->smarty->assign('bidUrl', $spuArchiveList[0]['bidUrl']); $this->smarty->assign('spuLength', $spuArchiveList[0]['spuLength']); $this->smarty->assign('spuWidth', $spuArchiveList[0]['spuWidth']); $this->smarty->assign('spuCalWeight', $spuArchiveList[0]['spuCalWeight']); $this->smarty->assign('spuHeight', $spuArchiveList[0]['spuHeight']); $this->smarty->assign('isPacking', $spuArchiveList[0]['isPacking']); $this->smarty->assign('pmId', $spuArchiveList[0]['pmId']); $this->smarty->assign('spuNote', $spuArchiveList[0]['spuNote']); $this->smarty->assign('spuStatus', $spuArchiveList[0]['spuStatus']); $this->smarty->assign('auditStatus', $spuArchiveList[0]['auditStatus']); $pathImplodeStr = getAllPathBypid($spuArchiveList[0]['categoryPath']); $this->smarty->assign('pathImplodeStr', $pathImplodeStr); $isColor = isExistForSpuPPV($spu, '颜色'); //检测该spu是否关联了颜色属性值 $isSize = isExistForSpuPPV($spu, '尺码'); $isSpuExist = isSpuExist($spu); $this->smarty->assign('isColor', $isColor); $this->smarty->assign('isSize', $isSize); $this->smarty->assign('isSpuExist', $isSpuExist); $isRelatedColor = isRelatedWithPidAndPP($spuArchiveList[0]['categoryPath'], '颜色'); //检测该类是否关联了颜色属性 $isRelatedSize = isRelatedWithPidAndPP($spuArchiveList[0]['categoryPath'], '尺码'); $this->smarty->assign('isRelatedColor', $isRelatedColor); $this->smarty->assign('isRelatedSize', $isRelatedSize); $this->smarty->assign('PPV', $PPV); $this->smarty->assign('INV', $INV); $this->smarty->assign('Link', $Link); $this->smarty->assign('onevar', 2); $this->smarty->assign('twovar', 22); $this->smarty->display("addSkuSing.htm"); } else { //虚拟料号 $amount = $_GET['amount'] ? post_check(trim($_GET['amount'])) : 0; $amount = intval($amount); if ($amount <= 0 || $amount > 100) { $status = "数量必须在1-100之间"; header("Location:index.php?mod=autoCreateSpu&act=getAutoCreateSpuList&status={$status}"); exit; } $navlist = array(array('url' => 'index.php?mod=autoCreateSpu&act=getAutoCreatePrefixList', 'title' => 'SPU管理'), array('url' => 'index.php?mod=autoCreateSpu&act=getAutoCreateSpuList', 'title' => '生成SPU列表管理'), array('url' => "index.php?mod=autoCreateSpu&act=addSku&spu={$spu}", 'title' => "添加虚拟料号_{$spu}")); $this->smarty->assign('navlist', $navlist); $this->smarty->assign('onevar', 2); $this->smarty->assign('twovar', 22); $this->smarty->assign('title', '添加虚拟料号'); $this->smarty->assign('combineSpu', $spu); $this->smarty->assign('amount', $amount); $this->smarty->display("addCombine.htm"); } }