function act_isExistBySpu() { $spu = $_POST['spu'] ? post_check(trim($_POST['spu'])) : ''; if (empty($spu)) { self::$errCode = '101'; self::$errMsg = 'SPU为空'; return false; } $spuFlag = isSpuExist($spu); if (!$spuFlag) { $tName = 'pc_goods_combine'; $where = "WHERE is_delete=0 and combineSpu='{$spu}'"; $combineSpuCount = OmAvailableModel::getTNameCount($tName, $where); if ($combineSpuCount) { $spuFlag = true; } } if ($spuFlag) { self::$errCode = '200'; self::$errMsg = '成功'; return true; } else { self::$errCode = '404'; self::$errMsg = '不存在该SPU'; return false; } }
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"); } }