function m_createStateList() { $this->ObTpl = new template(); $this->ObTpl->set_file("TPL_STATE_FILE", $this->countryTemplate); $this->ObTpl->set_var("GRAPHICSMAINPATH", GRAPHICS_PATH); $this->ObTpl->set_var("TPL_VAR_SITEURL", SITE_URL); //DEFINING BLOCKS $this->ObTpl->set_block("TPL_STATE_FILE", "TPL_MAINSTATE_BLK", "mainstate_blk"); $this->ObTpl->set_block("TPL_MAINSTATE_BLK", "TPL_STATE_BLK", "state_blk"); $this->ObTpl->set_block("TPL_STATE_FILE", "TPL_MSG_BLK", "msg_blk"); $this->ObTpl->set_block("TPL_STATE_FILE", "TPL_ERROR_BLK", "err_blk"); $this->ObTpl->set_block("TPL_MAINSTATE_BLK", "TPL_PAGING2_BLK", "paging2_blk"); $this->ObTpl->set_var("msg_blk", ""); $this->ObTpl->set_var("err_blk", ""); #INTIALIZING DEFAULT VALUES $this->ObTpl->set_var("paging1_blk", ""); $this->ObTpl->set_var("paging2_blk", ""); $this->ObTpl->set_var("state_blk", ""); $this->ObTpl->set_var("mainstate_blk", ""); $this->ObTpl->set_var("TPL_VAR_NAME", ""); $this->ObTpl->set_var("TPL_VAR_SHORTNAME", ""); $this->ObTpl->set_var("TPL_VAR_TAX", ""); $this->ObTpl->set_var("TPL_VAR_SHIP", ""); $this->ObTpl->set_var("TPL_VAR_SELECTED", ""); $this->ObTpl->set_var("TPL_VAR_ERROR", ""); $this->ObTpl->set_var("TPL_VAR_MESSAGE", ""); $this->ObTpl->set_var("TPL_VAR_VIEWALL", ""); $this->ObTpl->set_var("PagerBlock1", ""); $this->ObTpl->set_var("PagerBlock2", ""); $this->ObTpl->set_var("TPL_VAR_MODE", "add"); $this->request['msg'] = $this->libFunc->ifSet($this->request, "msg"); $this->request['page'] = $this->libFunc->ifSet($this->request, "page"); $this->request['cid'] = $this->libFunc->ifSet($this->request, "cid"); $this->request['stateid'] = $this->libFunc->ifSet($this->request, "stateid"); $this->ObTpl->set_var("TPL_VAR_CID", $this->request['cid']); $this->ObTpl->set_var("TPL_VAR_STATEID", $this->request['stateid']); if ($this->err == 1) { $this->ObTpl->set_var("TPL_VAR_ERROR", $this->errMsg); $this->ObTpl->parse("err_blk", "TPL_ERROR_BLK"); } if ($this->request['msg'] == 1) { $this->ObTpl->set_var("TPL_VAR_ERROR", MSG_STATE_INSERTED); $this->ObTpl->parse("err_blk", "TPL_ERROR_BLK"); } elseif ($this->request['msg'] == 2) { $this->ObTpl->set_var("TPL_VAR_ERROR", MSG_STATE_UPDATED); $this->ObTpl->parse("err_blk", "TPL_ERROR_BLK"); } elseif ($this->request['msg'] == 3) { $this->ObTpl->set_var("TPL_VAR_ERROR", MSG_STATE_DELETED); $this->ObTpl->parse("err_blk", "TPL_ERROR_BLK"); } elseif ($this->request['msg'] == 4) { $this->ObTpl->set_var("TPL_VAR_ERROR", MSG_NOSTATE_DELETED); $this->ObTpl->parse("err_blk", "TPL_ERROR_BLK"); } $this->request['page'] = $this->libFunc->ifSet($this->request, "page"); $this->ObTpl->set_var("EXTRASTRING", "&page=" . $this->request['page']); $query = "SELECT * FROM " . STATES . " WHERE iCountryID_FK='" . $this->request['cid'] . "'"; if ($_POST) { $this->ObTpl->set_var("TPL_VAR_NAME", $this->libFunc->m_displayContent($this->request['name'])); $this->ObTpl->set_var("TPL_VAR_SHORTNAME", $this->libFunc->m_displayContent($this->request['short_name'])); $this->ObTpl->set_var("TPL_VAR_TAX", $this->request['tax']); $this->ObTpl->set_var("TPL_VAR_SHIP", $this->request['shipCharge']); } elseif (isset($this->request['stateid']) && !empty($this->request['stateid'])) { $this->ObTpl->set_var("TPL_VAR_MODE", "edit"); $this->ObTpl->set_var("TPL_VAR_VIEWALL", "Remove filter"); $this->request['cid'] = intval($this->request['cid']); $query .= " AND iStateId_PK='" . $this->request['stateid'] . "'"; $this->obDb->query = $query; $res1 = $this->obDb->fetchQuery(); $this->ObTpl->set_var("TPL_VAR_NAME", $this->libFunc->m_displayContent($res1[0]->vStateName)); $this->ObTpl->set_var("TPL_VAR_SHORTNAME", $this->libFunc->m_displayContent($res1[0]->vShortName)); $this->ObTpl->set_var("TPL_VAR_TAX", $res1[0]->fTax); $this->ObTpl->set_var("TPL_VAR_SHIP", $res1[0]->fShipCharge); } $query .= " ORDER BY vStateName"; $pn = new PrevNext($this->pageTplPath, $this->pageTplFile, $this->obDb); $extraStr = "action=state.home&cid=" . $this->request['cid']; $pn->formno = 3; $navArr = $pn->create($query, $this->pageSize, $extraStr, "top"); $pn2 = new PrevNext($this->pageTplPath, $this->pageTplFile, $this->obDb); $pn2->formno = 4; $navArr2 = $pn2->create($query, $this->pageSize, $extraStr, "top"); $res = $navArr['qryRes']; $totalCount = $navArr['totalRecs']; $rCount = $navArr['selRecs']; if ($rCount > 0) { for ($i = 0; $i < $rCount; $i++) { $this->ObTpl->set_var("TPL_VAR_COUNT", $i + 1); $this->ObTpl->set_var("TPL_VAR_SID", $res[$i]->iStateId_PK); $this->ObTpl->set_var("TPL_VAR_SNAME", $res[$i]->vStateName); $this->ObTpl->set_var("TPL_VAR_SSHORTNAME", $res[$i]->vShortName); $this->ObTpl->set_var("TPL_VAR_STAX", $res[$i]->fTax); $this->ObTpl->set_var("TPL_VAR_SHIPCHARGE", $res[$i]->fShipCharge); $this->ObTpl->parse("state_blk", "TPL_STATE_BLK", true); } if ($this->pageSize < $totalCount) { $this->ObTpl->set_var("PagerBlock2", $navArr2['pnContents']); $this->ObTpl->parse("paging2_blk", "TPL_PAGING2_BLK"); } $this->ObTpl->parse("mainstate_blk", "TPL_MAINSTATE_BLK"); } else { $this->ObTpl->set_var("TPL_VAR_MESSAGE", "There are no states for this county."); $this->ObTpl->parse("msg_blk", "TPL_MSG_BLK"); } return $this->ObTpl->parse("return", "TPL_STATE_FILE"); }
function m_searchResults() { if ($this->request['adv'] != "") { $_SESSION['adv'] = $this->request['adv']; } if ($_SESSION['adv'] == "") { $_SESSION['adv'] = "SearchAll"; } if (empty($this->request['mode'])) { $this->request['mode'] = ""; } else { $tempmode = explode(" ", $this->request['mode']); $productSearch = ""; foreach ($tempmode as $k => $v) { if ($k == 0) { $productSearch = $productSearch . "(SELECT iProdid_PK as id,vTitle,vSeoTitle,tShortDescription,vImage1, 'product' FROM " . PRODUCTS . " INNER JOIN " . FUSIONS . " ON iProdid_PK=iSubId_FK WHERE (vTitle LIKE '%" . $v . "%' OR "; $productSearch .= "tShortDescription LIKE '%" . $v . "%' OR "; $productSearch .= "vSku LIKE '%" . $v . "%' OR "; $productSearch .= "tContent LIKE '%" . $v . "%')"; } else { $productSearch = $productSearch . " AND (vTitle LIKE '%" . $v . "%' OR "; $productSearch .= "tShortDescription LIKE '%" . $v . "%' OR "; $productSearch .= "vSku LIKE '%" . $v . "%' OR "; $productSearch .= "tContent LIKE '%" . $v . "%')"; } } $productSearch .= " AND vType='product' AND iState='1')"; if ($_SESSION['adv'] == "SearchAll") { $productSearch .= " UNION"; } $this->request['mode'] = addslashes($this->request['mode']); } $this->ObTpl = new template(); $this->ObTpl->set_file("TPL_SEARCH_FILE", $this->searchTemplate); $this->ObTpl->set_var("TPL_VAR_SITEURL", SITE_URL); $this->ObTpl->set_var("TPL_VAR_GRAPHICSURL", GRAPHICS_PATH); $this->ObTpl->set_var("TPL_VAR_CURRENCY", CONST_CURRENCY); #SETTING TEMPLATE BLOCKS $this->ObTpl->set_block("TPL_SEARCH_FILE", "TPL_DEPARTMENT_BLK", "dept_blk"); $this->ObTpl->set_block("TPL_SEARCH_FILE", "TPL_PRODUCT_BLK", "product_blk"); $this->ObTpl->set_block("TPL_SEARCH_FILE", "TPL_CONTENT_BLK", "content_blk"); #INTIALIZING $this->ObTpl->set_var("dept_blk", ""); $this->ObTpl->set_var("product_blk", ""); $this->ObTpl->set_var("content_blk", ""); ##START OF ADVANCED SEARCH if ($_SESSION['adv'] == "SearchAll") { #TO QUERY DEPARTMENT TABLE $extraStr = "ecom/index.php?action=ecom.search&mode=" . $this->request['mode']; $query = "(SELECT iDeptid_PK as id,vTitle,vSeoTitle,tShortDescription,'' as vImage1, 'department' as flag FROM " . DEPARTMENTS . " INNER JOIN " . FUSIONS . " ON iDeptid_PK=iSubId_FK WHERE "; $query .= "(vTitle LIKE '%" . $this->request['mode'] . "%' OR "; $query .= "tShortDescription LIKE '%" . $this->request['mode'] . "%' OR "; $query .= "tContent LIKE '%" . $this->request['mode'] . "%') AND vType='department' AND iState='1') UNION"; $query .= $productSearch; $query .= "(SELECT iContentid_PK as id,vTitle,vSeoTitle,tShortDescription,'' as vImage1, 'content' FROM " . CONTENTS . " INNER JOIN " . FUSIONS . " ON iContentid_PK=iSubId_FK WHERE "; $query .= "(vTitle LIKE '%" . $this->request['mode'] . "%' OR "; $query .= "tShortDescription LIKE '%" . $this->request['mode'] . "%' OR "; $query .= "tContent LIKE '%" . $this->request['mode'] . "%') AND vType='content' AND iState='1')"; $pn = new PrevNext($this->pageTplPath, $this->pageTplFile, $this->obDb); $pn->formno = 1; $navArr = $pn->create($query, $this->pageSize, $extraStr, $this->noPaging); $rowDept = $navArr['qryRes']; $totalRecords = $navArr['totalRecs']; $deptCount = $navArr['fetchedRecords']; $this->totalRecords = $totalRecords; if ($deptCount > 0) { for ($i = 0; $i < $deptCount; $i++) { $this->obDb->query = "SELECT count(*) as cnt FROM " . FUSIONS . " WHERE iSubId_FK='" . $rowDept[$i]->id . "' AND iState='1' AND vType='" . $rowDept[$i]->flag . "'"; $rowCnt = $this->obDb->fetchQuery(); if ($rowCnt[0]->cnt > 0) { if ($rowDept[$i]->flag == "department") { $deptUrl = SITE_URL . "ecom/index.php?action=ecom.details&mode=" . $rowDept[$i]->vSeoTitle; } elseif ($rowDept[$i]->flag == "product") { $deptUrl = SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $rowDept[$i]->vSeoTitle; } elseif ($rowDept[$i]->flag == "content") { $deptUrl = SITE_URL . "ecom/index.php?action=ecom.cdetails&mode=" . $rowDept[$i]->vSeoTitle; } $this->ObTpl->set_var("TPL_VAR_DEPTURL", $this->libFunc->m_safeUrl($deptUrl)); $this->ObTpl->set_var("TPL_VAR_DEPTNAME", $this->libFunc->m_displayContent($rowDept[$i]->vTitle)); if ($rowDept[$i]->tShortDescription != "") { $shortDesc = substr($this->libFunc->m_displayContent($rowDept[$i]->tShortDescription), 0, 100); $this->ObTpl->set_var("TPL_VAR_SHORTDESC", "<p>" . $shortDesc . "</p>"); } else { $this->ObTpl->set_var("TPL_VAR_SHORTDESC", ""); } if ($rowDept[$i]->flag == "department") { $this->ObTpl->set_var("TPL_VAR_FLAG", "Department"); } elseif ($rowDept[$i]->flag == "product") { $this->ObTpl->set_var("TPL_VAR_FLAG", "Product"); } elseif ($rowDept[$i]->flag == "content") { $this->ObTpl->set_var("TPL_VAR_FLAG", "Content"); } $this->ObTpl->parse("dept_blk", "TPL_DEPARTMENT_BLK", true); } else { $this->totalRecords--; } } } if ($totalRecords > $this->pageSize) { #PAGINATION $this->ObTpl->set_var("PagerBlock1", $navArr['pnContents']); } else { $this->ObTpl->set_var("PagerBlock1", ""); } } elseif ($_SESSION['adv'] == "products") { #TO QUERY PRODUCT TABLE $extraStr = "ecom/index.php?action=ecom.search&mode=" . $this->request['mode']; $query = $productSearch; //$query .= "(SELECT iProdid_PK as id,vTitle,vSeoTitle,tShortDescription, 'product' FROM ".PRODUCTS." INNER JOIN ".FUSIONS." ON iProdid_PK=iSubId_FK WHERE "; //$query .="(vTitle LIKE '%".$this->request['mode']."%' OR "; //$query .="tShortDescription LIKE '%".$this->request['mode']."%' OR "; //$query .="vSku LIKE '%".$this->request['mode']."%' OR "; //$query .="tContent LIKE '%".$this->request['mode']."%') AND vType='product' AND iState='1') UNION"; $pn = new PrevNext($this->pageTplPath, $this->pageTplFile, $this->obDb); $pn->formno = 1; $navArr = $pn->create($query, $this->pageSize, $extraStr, $this->noPaging); $rowProduct = $navArr['qryRes']; $totalRecords = $navArr['totalRecs']; $productCount = $navArr['fetchedRecords']; $this->totalRecords = $totalRecords; if ($productCount > 0) { for ($i = 0; $i < $productCount; $i++) { $this->obDb->query = "SELECT count(*) as cnt FROM " . FUSIONS . " WHERE iSubId_FK='" . $rowProduct[$i]->id . "' AND iState='1' AND vType='product'"; $rowCnt = $this->obDb->fetchQuery(); if ($rowCnt[0]->cnt > 0) { $prodUrl = SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $rowProduct[$i]->vSeoTitle; $this->ObTpl->set_var("TPL_VAR_PRODUCTURL", $this->libFunc->m_safeUrl($prodUrl)); $this->ObTpl->set_var("TPL_VAR_PRODUCTNAME", $this->libFunc->m_displayContent($rowProduct[$i]->vTitle)); if ($this->libFunc->m_displayContent($rowProduct[$i]->vImage1) != "") { $this->ObTpl->set_var("TPL_VAR_PRODIMAGE_TAG", "<img src=\"" . SITE_URL . "libs/timthumb.php?src=/images/product/" . $this->libFunc->m_displayContent($rowProduct[$i]->vImage1) . "&h=40&w=40&zc=r\" alt=\"" . $this->libFunc->m_displayContent($rowProduct[$i]->vTitle) . "\" /> "); } else { $this->ObTpl->set_var("TPL_VAR_PRODIMAGE_TAG", ""); } if ($rowProduct[$i]->tShortDescription != "") { $shortDesc = substr($this->libFunc->m_displayContent($rowProduct[$i]->tShortDescription), 0, 100); $this->ObTpl->set_var("TPL_VAR_SHORTDESC", "<p>" . $shortDesc . "</p>"); } else { $this->ObTpl->set_var("TPL_VAR_SHORTDESC", ""); } $this->ObTpl->parse("product_blk", "TPL_PRODUCT_BLK", true); } else { $this->totalRecords--; } $this->ObTpl->set_var("TPL_VAR_FLAG", "Product"); } } if ($totalRecords > $this->pageSize) { #PAGINATION $this->ObTpl->set_var("PagerBlock1", $navArr['pnContents']); } else { $this->ObTpl->set_var("PagerBlock1", ""); } } elseif ($_SESSION['adv'] == "department") { #TO QUERY DEPARTMENT TABLE $extraStr = "ecom/index.php?action=ecom.search&mode=" . $this->request['mode']; $query = "SELECT iDeptid_PK,vTitle,vSeoTitle,tShortDescription FROM " . DEPARTMENTS . " INNER JOIN " . FUSIONS . " ON iDeptid_PK=iSubId_FK WHERE "; $query .= "(vTitle LIKE '%" . $this->request['mode'] . "%' OR "; $query .= "tShortDescription LIKE '%" . $this->request['mode'] . "%' OR "; $query .= "tContent LIKE '%" . $this->request['mode'] . "%') AND vType='department' AND iState='1'"; $pn = new PrevNext($this->pageTplPath, $this->pageTplFile, $this->obDb); $pn->formno = 1; $navArr = $pn->create($query, $this->pageSize, $extraStr, $this->noPaging); $rowDept = $navArr['qryRes']; $totalRecords = $navArr['totalRecs']; $deptCount = $navArr['fetchedRecords']; $this->totalRecords = $totalRecords; if ($deptCount > 0) { for ($i = 0; $i < $deptCount; $i++) { $this->obDb->query = "SELECT count(*) as cnt FROM " . FUSIONS . " WHERE iSubId_FK='" . $rowDept[$i]->iDeptid_PK . "' AND iState='1' AND vType='department'"; $rowCnt = $this->obDb->fetchQuery(); if ($rowCnt[0]->cnt > 0) { $deptUrl = SITE_URL . "ecom/index.php?action=ecom.details&mode=" . $rowDept[$i]->vSeoTitle; $this->ObTpl->set_var("TPL_VAR_DEPTURL", $this->libFunc->m_safeUrl($deptUrl)); $this->ObTpl->set_var("TPL_VAR_DEPTNAME", $this->libFunc->m_displayContent($rowDept[$i]->vTitle)); if ($rowDept[$i]->tShortDescription != "") { $shortDesc = substr($this->libFunc->m_displayContent($rowDept[$i]->tShortDescription), 0, 100); $this->ObTpl->set_var("TPL_VAR_SHORTDESC", "<p>" . $shortDesc . "</p>"); } else { $this->ObTpl->set_var("TPL_VAR_SHORTDESC", ""); } $this->ObTpl->parse("dept_blk", "TPL_DEPARTMENT_BLK", true); } else { $this->totalRecords--; } $this->ObTpl->set_var("TPL_VAR_FLAG", "Department"); } } if ($totalRecords > $this->pageSize) { #PAGINATION $this->ObTpl->set_var("PagerBlock1", $navArr['pnContents']); } else { $this->ObTpl->set_var("PagerBlock1", ""); } } elseif ($_SESSION['adv'] == "content") { #TO QUERY CONTENT TABLE $extraStr = "ecom/index.php?action=ecom.search&mode=" . $this->request['mode']; $query = "SELECT iContentid_PK,vTitle,vSeoTitle,tShortDescription FROM " . CONTENTS . " INNER JOIN " . FUSIONS . " ON iContentid_PK=iSubId_FK WHERE "; $query .= "(vTitle LIKE '%" . $this->request['mode'] . "%' OR "; $query .= "tShortDescription LIKE '%" . $this->request['mode'] . "%' OR "; $query .= "tContent LIKE '%" . $this->request['mode'] . "%') AND vType='content' AND iState='1'"; $rowProduct = $this->obDb->fetchQuery(); $pn = new PrevNext($this->pageTplPath, $this->pageTplFile, $this->obDb); $pn->formno = 1; $navArr = $pn->create($query, $this->pageSize, $extraStr, $this->noPaging); $rowProduct = $navArr['qryRes']; $totalRecords = $navArr['totalRecs']; $productCount = $navArr['fetchedRecords']; $this->totalRecords = $totalRecords; if ($productCount > 0) { for ($i = 0; $i < $productCount; $i++) { $this->obDb->query = "SELECT count(*) as cnt FROM " . FUSIONS . " WHERE iSubId_FK='" . $rowProduct[$i]->iContentid_PK . "' AND iState='1' AND vType='content'"; $rowCnt = $this->obDb->fetchQuery(); if ($rowCnt[0]->cnt > 0) { $prodUrl = SITE_URL . "ecom/index.php?action=ecom.cdetails&mode=" . $rowProduct[$i]->vSeoTitle; $this->ObTpl->set_var("TPL_VAR_CONTENTURL", $this->libFunc->m_safeUrl($prodUrl)); $this->ObTpl->set_var("TPL_VAR_CONTENTNAME", $this->libFunc->m_displayContent($rowProduct[$i]->vTitle)); if ($rowProduct[$i]->tShortDescription != "") { $shortDesc = substr($this->libFunc->m_displayContent($rowProduct[$i]->tShortDescription), 0, 100); $this->ObTpl->set_var("TPL_VAR_SHORTDESC", "<p>" . $shortDesc . "</p>"); } else { $this->ObTpl->set_var("TPL_VAR_SHORTDESC", ""); } $this->ObTpl->parse("content_blk", "TPL_CONTENT_BLK", true); } else { $this->totalRecords--; } $this->ObTpl->set_var("TPL_VAR_FLAG", "Content"); } } if ($totalRecords > $this->pageSize) { #PAGINATION $this->ObTpl->set_var("PagerBlock1", $navArr['pnContents']); } else { $this->ObTpl->set_var("PagerBlock1", ""); } } if ($this->totalRecords == 0) { $this->ObTpl->set_var("TPL_VAR_TOTALRECORDS", MSG_NO_SEARCHRESULT); } else { $this->ObTpl->set_var("TPL_VAR_TOTALRECORDS", $this->totalRecords . " Records Found"); } ##Search terms for admin statistics. $this->obDb->query = "SELECT * FROM " . SEARCHES . " WHERE vSearchTerm ='" . strtolower($this->request['mode']) . "'"; $rowSearch = $this->obDb->fetchQuery(); $rowCount = $this->obDb->record_count; if ($rowCount > 0) { $NumberOfSearches = $rowSearch[0]->iNumberOfSearches + 1; $RecordsFound = $rowSearch[0]->iRecFound + $this->totalRecords; $this->obDb->query = "UPDATE " . SEARCHES . " SET iNumberOfSearches='" . $NumberOfSearches . "', iRecFoud ='" . $RecordsFound . "' WHERE iSearchPK='" . $rowSearch[0]->iSearchPK . "'"; $this->obDb->updateQuery(); } else { $this->obDb->query = "INSERT INTO " . SEARCHES . "(`vSearchTerm`, `iNumberOfSearches`,`iRecFoud`) VALUES(\n\t\t'" . $this->libFunc->m_addToDB(strtolower($this->request['mode'])) . "','1','" . $this->totalRecords . "')"; $this->obDb->updateQuery(); } return $this->ObTpl->parse("return", "TPL_SEARCH_FILE"); }
function m_showContentReport() { $this->ObTpl = new template(); $this->ObTpl->set_file("cReport", $this->contentTemplate); #INTIALIZING TEMPLATE BLOCKS $this->ObTpl->set_block("cReport", "TPL_MESSAGE_BLK", "dspMess_blk"); $this->ObTpl->set_block("cReport", "TPL_CONTENT_BLK", "dspContent_blk"); $this->ObTpl->set_block("TPL_CONTENT_BLK", "TPL_LINK_BLK", "link_blk"); $this->ObTpl->set_block("TPL_CONTENT_BLK", "TPL_NOLINK_BLK", "nolink_blk"); $this->ObTpl->set_var("dspContent_blk", ""); $this->ObTpl->set_var("TPL_VAR_SITEURL", SITE_URL); $this->ObTpl->set_var("TPL_VAR_OSEL1", "selected"); $this->ObTpl->set_var("TPL_VAR_SEARCHTEXT", ""); $this->ObTpl->set_var("TPL_VAR_CHECK1", "checked='checked'"); $this->ObTpl->set_var("TPL_VAR_CHECK2", ""); $this->ObTpl->set_var("PagerBlock1", ""); $this->ObTpl->set_var("PagerBlock2", ""); #QUERY TO GET PRODUCT REPORT $query1 = "SELECT vTitle,F.iState as state,iContentid_PK,iOwner_FK,vOwnerType FROM " . CONTENTS . " C LEFT JOIN " . FUSIONS . " F ON iContentid_PK=iSubId_FK AND vType='content'"; if (!isset($this->request['search'])) { $this->request['search'] = ""; } if (!isset($this->request['order_type'])) { $this->request['order_type'] = ""; } if (!isset($this->request['orderby'])) { $this->request['orderby'] = "vTitle"; } $this->request['search'] = trim($this->request['search']); if (!empty($this->request['search'])) { $this->ObTpl->set_var("TPL_VAR_SEARCHTEXT", $this->libFunc->m_displayContent($this->request['search'])); $query1 .= " WHERE ( vTitle LIKE '%" . $this->libFunc->m_addToDB($this->libFunc->m_addToDB($this->request['search'])) . "%' || tShortDescription LIKE '%" . $this->libFunc->m_addToDB($this->libFunc->m_addToDB($this->request['search'])) . "%' || tContent LIKE '%" . $this->libFunc->m_addToDB($this->libFunc->m_addToDB($this->request['search'])) . "%')"; } else { $this->ObTpl->set_var("TPL_VAR_SEARCHTEXT", ""); } if ($this->request['order_type'] == "desc") { $query1 .= " ORDER BY " . $this->request['orderby'] . " DESC"; $this->ObTpl->set_var("TPL_VAR_CHECK1", "checked='checked'"); $this->ObTpl->set_var("TPL_VAR_CHECK2", ""); } else { $query1 .= " ORDER BY " . $this->request['orderby'] . " ASC"; $this->ObTpl->set_var("TPL_VAR_CHECK2", "checked='checked'"); $this->ObTpl->set_var("TPL_VAR_CHECK1", ""); } if ($this->request['orderby'] == "iState") { $this->ObTpl->set_var("TPL_VAR_OSEL2", "selected"); } else { $this->ObTpl->set_var("TPL_VAR_OSEL1", "selected"); } #PAGGING $pn = new PrevNext($this->pageTplPath, $this->pageTplFile, $this->obDb); $extraStr = "action=home.creport&order_type=" . $this->request['order_type'] . "&orderby=" . $this->request['orderby'] . "&search=" . urlencode(stripslashes($this->request['search'])); $pn->formno = 1; $navArr = $pn->create($query1, $this->pageSize, $extraStr); $pn2 = new PrevNext($this->pageTplPath, $this->pageTplFile, $this->obDb, "top"); $pn2->formno = 2; $navArr2 = $pn2->create($query1, $this->pageSize, $extraStr); $rowContent = $navArr['qryRes']; $totalRecord = $navArr['totalRecs']; $selRecord = $navArr['selRecs']; $this->ObTpl->set_var("TPL_VAR_TOTALRECORDS", $totalRecord); $this->ObTpl->set_var("TPL_VAR_CURRENCY", CONST_CURRENCY); if ($selRecord > 0) { for ($i = 0; $i < $selRecord; $i++) { $this->ObTpl->set_var("nolink_blk", ""); $this->ObTpl->set_var("link_blk", ""); $this->ObTpl->set_var("TPL_VAR_CONTENT_TITLE", $this->libFunc->m_displayContent($rowContent[$i]->vTitle)); if ($rowContent[$i]->state == 1) { $this->ObTpl->set_var("TPL_VAR_ONOFF", "On"); } else { $this->ObTpl->set_var("TPL_VAR_ONOFF", "Off"); } if ($rowContent[$i]->iOwner_FK == '') { $this->ObTpl->set_var("TPL_CONTENT_URL", "#"); $this->ObTpl->parse("nolink_blk", "TPL_NOLINK_BLK"); } else { $this->ObTpl->set_var("TPL_CONTENT_URL", SITE_URL . "ecom/adminindex.php?action=ec_show.home&owner=" . $rowContent[$i]->iContentid_PK . "&type=content"); $this->ObTpl->parse("link_blk", "TPL_LINK_BLK"); } $this->ObTpl->set_var("TPL_SUBPRODUCT_ID", $rowContent[$i]->iContentid_PK); $this->ObTpl->set_var("TPL_OWNER_ID", $rowContent[$i]->iOwner_FK); $this->ObTpl->set_var("TPL_OTYPE", $rowContent[$i]->vOwnerType); $this->ObTpl->set_var("TPL_SHOP_URL", SITE_URL . "ecom/adminindex.php"); $this->ObTpl->set_var("dspMess_blk", ""); $this->ObTpl->parse("dspContent_blk", "TPL_CONTENT_BLK", true); } if ($totalRecord > $this->pageSize) { $this->ObTpl->set_var("PagerBlock1", $navArr['pnContents']); $this->ObTpl->set_var("PagerBlock2", $navArr2['pnContents']); } } else { $this->ObTpl->set_var("dspContent_blk", ""); $this->ObTpl->set_var("TPL_VAR_MESSAGE", MSG_NO_CONTENT); $this->ObTpl->parse("dspMess_blk", "TPL_MESSAGE_BLK"); } $this->ObTpl->set_var("FORM_URL", SITE_URL . "adminindex.php?action=home.creport"); $this->ObTpl->set_var("HELP_URL", SITE_URL . "adminindex.php?action=home.help"); $this->ObTpl->set_var("TPL_VAR_BREDCRUMBTEXT", BREDCRUMBTEXT); $this->ObTpl->set_var("TPL_VAR_BREDCRUMB", SHOPBUILDER_HOME); $this->ObTpl->set_var("GRAPHICSMAINPATH", GRAPHICS_PATH); return $this->ObTpl->parse("return", "cReport"); }
function m_dspOrders() { $this->ObTpl = new template(); $this->ObTpl->set_file("TPL_ORDER_FILE", $this->orderTemplate); #INTIALIZING TEMPLATE BLOCKS $this->ObTpl->set_block("TPL_ORDER_FILE", "TPL_ORDERMAIN_BLK", "ordermain_blk"); $this->ObTpl->set_block("TPL_ORDERMAIN_BLK", "TPL_ORDERS_BLK", "orders_blk"); $this->ObTpl->set_block("TPL_ORDERS_BLK", "TPL_BLK_REGISTERED_USER", "registereduser_blk"); $this->ObTpl->set_block("TPL_ORDERS_BLK", "TPL_BLK_NOTREGISTERED_USER", "notregistereduser_blk"); $this->ObTpl->set_block("TPL_ORDER_FILE", "TPL_PAGE_BLK2", "page_blk2"); $this->ObTpl->set_block("TPL_ORDER_FILE", "TPL_MSG_BLK", "msg_blk"); $this->ObTpl->set_var("GRAPHICSMAINPATH", GRAPHICS_PATH); $this->ObTpl->set_var("TPL_VAR_SITEURL", SITE_URL); #INTIALIZING BLOCKS $this->ObTpl->set_var("orders_blk", ""); $this->ObTpl->set_var("page_blk2", ""); $this->ObTpl->set_var("msg_blk", ""); $this->ObTpl->set_var("ordermain_blk", ""); $this->ObTpl->set_var("TPL_VAR_SEL1", ""); $this->ObTpl->set_var("TPL_VAR_SEL2", ""); $this->ObTpl->set_var("SELECTED1", ""); $this->ObTpl->set_var("SELECTED2", ""); $this->ObTpl->set_var("SELECTED3", ""); $this->ObTpl->set_var("SELECTED4", ""); $this->ObTpl->set_var("SELECTED5", ""); $this->ObTpl->set_var("SELECTED6", ""); $this->ObTpl->set_var("SELECTED8", ""); $this->ObTpl->set_var("SELECTED_ORDERBY", ""); $this->ObTpl->set_var("SELECTED_ORDERBY1", ""); $this->ObTpl->set_var("SELECTED_ORDERBY2", ""); $this->ObTpl->set_var("SELECTED_ORDERBY3", ""); $this->ObTpl->set_var("SELECTED_ORDERBY4", ""); $this->ObTpl->set_var("SELECTED_ORDERBY5", ""); $this->ObTpl->set_var("SELECTED_ORDERBY6", ""); $this->ObTpl->set_var("SELECTED_ORDERBY8", ""); $this->ObTpl->set_var("TPL_VAR_MESSAGE", "There are currently no orders available."); #QUERY TO GET ORDERS PLACED $query = "SELECT iInvoice,tmOrderDate,vPayMethod,iPayStatus,vStatus,"; $query .= " vFirstName,vLastName,iCustomerid_FK,iOrderid_PK,iOrderStatus FROM " . ORDERS . " WHERE 1=1 "; if (!isset($this->request['mstatus'])) { $this->request['mstatus'] = ""; } switch ($this->request['mstatus']) { case "New": $query .= " AND vStatus='New' "; $this->ObTpl->set_var("SELECTED1", "selected"); break; case "Pending": $query .= " AND vStatus='Pending' "; $this->ObTpl->set_var("SELECTED2", "selected"); break; case "Received": $query .= " AND vStatus='Received' "; $this->ObTpl->set_var("SELECTED3", "selected"); break; case "Backorder": $query .= " AND vStatus='Backorder' "; $this->ObTpl->set_var("SELECTED4", "selected"); break; case "Shipped": $query .= " AND vStatus='Shipped' "; $this->ObTpl->set_var("SELECTED5", "selected"); break; case "Void": $query .= " AND vStatus='Void' "; $this->ObTpl->set_var("SELECTED6", "selected"); break; case "Delete": $query .= " AND vStatus='Delete' "; $this->ObTpl->set_var("SELECTED7", "selected"); break; case "All": $query .= ""; $this->ObTpl->set_var("SELECTED8", "selected"); break; default: $query .= " AND vStatus='New' "; $this->ObTpl->set_var("SELECTED1", "selected"); break; } if (!isset($this->request['orderby'])) { $this->request['orderby'] = ""; } switch ($this->request['orderby']) { case "date": $query .= " ORDER BY tmOrderDate"; $this->ObTpl->set_var("SELECTED_ORDERBY1", "selected"); break; case "paymethod": $query .= " ORDER BY vPayMethod"; $this->ObTpl->set_var("SELECTED_ORDERBY2", "selected"); break; case "paystatus": $query .= " ORDER BY iPayStatus"; $this->ObTpl->set_var("SELECTED_ORDERBY3", "selected"); break; case "lastname": $query .= " ORDER BY vLastName"; $this->ObTpl->set_var("SELECTED_ORDERBY4", "selected"); break; case "city": $query .= " ORDER BY vCity"; $this->ObTpl->set_var("SELECTED_ORDERBY5", "selected"); break; case "state": $query .= " ORDER BY vState"; $this->ObTpl->set_var("SELECTED_ORDERBY6", "selected"); break; case "country": $query .= " ORDER BY vCountry"; $this->ObTpl->set_var("SELECTED_ORDERBY7", "selected"); break; case "alt_city": $query .= " ORDER BY vAltCity"; $this->ObTpl->set_var("SELECTED_ORDERBY8", "selected"); break; case "alt_state": $query .= " ORDER BY vAltState"; $this->ObTpl->set_var("SELECTED_ORDERBY9", "selected"); break; case "alt_country": $query .= " ORDER BY vAltCountry"; $this->ObTpl->set_var("SELECTED_ORDERBY10", "selected"); break; default: $query .= " ORDER BY iInvoice"; $this->ObTpl->set_var("SELECTED_ORDERBY", "selected"); break; } if (isset($this->request['direction']) && $this->request['direction'] == "asc") { $query .= " ASC"; $this->request['direction'] = "asc"; $this->ObTpl->set_var("TPL_VAR_SEL1", "checked"); } else { $query .= " DESC"; $this->request['direction'] = "desc"; $this->ObTpl->set_var("TPL_VAR_SEL2", "checked"); } if (!isset($this->request['page'])) { $this->request['page'] = '1'; } $pn = new PrevNext($this->pageTplPath, $this->pageTplFile, $this->obDb); $extraStr = "action=orders.home&mstatus=" . $this->request['mstatus'] . "&orderby=" . $this->request['orderby'] . "&direction=" . $this->request['direction']; $this->ObTpl->set_var("TPL_VAR_EXTRASTRING1", "action=orders.home&mstatus=" . $this->request['mstatus'] . "&orderby=" . $this->request['orderby'] . "&direction=" . $this->request['direction'] . "&page=" . $this->request['page']); $this->ObTpl->set_var("TPL_VAR_EXTRASTRING", "action=orders.updatehome&mstatus=" . $this->request['mstatus'] . "&orderby=" . $this->request['orderby'] . "&direction=" . $this->request['direction'] . "&page=" . $this->request['page']); $pn->formno = 1; $navArr = $pn->create($query, $this->pageSize, $extraStr); $pn2 = new PrevNext($this->pageTplPath, $this->pageTplFile, $this->obDb); $pn2->formno = 2; $navArr2 = $pn2->create($query, $this->pageSize, $extraStr, "top"); $res = $navArr['qryRes']; $rCount = $navArr['selRecs']; $totalRecord = $navArr['totalRecs']; if ($rCount > 0) { $this->ObTpl->set_var("TPL_VAR_TOTALRECORD", $rCount); for ($i = 0; $i < $rCount; $i++) { $this->ObTpl->set_var("registereduser_blk", ""); $this->ObTpl->set_var("notregistereduser_blk", ""); $this->ObTpl->set_var("TPL_VALID_ORDER", "Incomplete"); if ($res[$i]->iOrderStatus == 1) { $this->ObTpl->set_var("TPL_VALID_ORDER", "Complete"); } $this->ObTpl->set_var("SEL1", ""); $this->ObTpl->set_var("SEL2", ""); $this->ObTpl->set_var("SEL3", ""); $this->ObTpl->set_var("SEL4", ""); $this->ObTpl->set_var("SEL5", ""); $this->ObTpl->set_var("SEL6", ""); if ($res[$i]->vStatus == "New") { $this->ObTpl->set_var("SEL1", "selected"); } elseif ($res[$i]->vStatus == "Pending") { $this->ObTpl->set_var("SEL2", "selected"); } elseif ($res[$i]->vStatus == "Received") { $this->ObTpl->set_var("SEL3", "selected"); } elseif ($res[$i]->vStatus == "Backorder") { $this->ObTpl->set_var("SEL4", "selected"); } elseif ($res[$i]->vStatus == "Shipped") { $this->ObTpl->set_var("SEL5", "selected"); } elseif ($res[$i]->vStatus == "Void") { $this->ObTpl->set_var("SEL6", "selected"); } else { $this->ObTpl->set_var("SEL1", "selected"); } $this->ObTpl->set_var("TPL_VAR_ORDERDATE", $this->libFunc->dateFormat1($res[$i]->tmOrderDate)); $this->ObTpl->set_var("TPL_VAR_ORDERID", $res[$i]->iOrderid_PK); $this->ObTpl->set_var("TPL_VAR_INVOICE", $res[$i]->iInvoice); $this->ObTpl->set_var("TPL_VAR_CUSTOMER", $this->libFunc->m_displayContent($res[$i]->vFirstName) . " " . $this->libFunc->m_displayContent($res[$i]->vLastName)); $this->ObTpl->set_var("TPL_VAR_CUSTOMERID", $res[$i]->iCustomerid_FK); if ($res[$i]->iCustomerid_FK > 0) { #IF ORDER PLACED BY REGISTERED USER $this->ObTpl->parse("registereduser_blk", "TPL_BLK_REGISTERED_USER"); } else { #IF ORDER IS PLACED BY NOT REGISTERD USER $this->ObTpl->parse("notregistereduser_blk", "TPL_BLK_NOTREGISTERED_USER"); } $this->ObTpl->set_var("TPL_VAR_METHOD", $res[$i]->vPayMethod); if ($res[$i]->iPayStatus == "1") { $this->ObTpl->set_var("TPL_VAR_PAYSTATUS", "paid"); } else { $this->ObTpl->set_var("TPL_VAR_PAYSTATUS", "unpaid"); } $this->ObTpl->set_var("TPL_VAR_SITEURL", SITE_URL); $this->ObTpl->set_var("TPL_VAR_MESSAGE", ""); $this->ObTpl->parse("orders_blk", "TPL_ORDERS_BLK", true); } $this->ObTpl->parse("ordermain_blk", "TPL_ORDERMAIN_BLK", true); $this->ObTpl->set_var("PagerBlock2", $navArr2['pnContents']); $this->ObTpl->parse("page_blk2", "TPL_PAGE_BLK2"); } else { $this->ObTpl->parse("msg_blk", "TPL_MSG_BLK"); } return $this->ObTpl->parse("return", "TPL_ORDER_FILE"); }
function m_showWishlist() { $this->ObTpl = new template(); $this->ObTpl->set_file("TPL_WISHLIST_FILE", $this->template); $this->ObTpl->set_var("TPL_VAR_SITEURL", SITE_URL); $this->ObTpl->set_var("TPL_VAR_GRAPHICSURL", GRAPHICS_PATH); $this->ObTpl->set_var("TPL_VAR_CURRENCY", CONST_CURRENCY); $this->ObTpl->set_var("TPL_VAR_USERNAME", $this->libFunc->m_displayContent($_SESSION['username'])); #SETTING TEMPLATE BLOCKS $this->ObTpl->set_block("TPL_WISHLIST_FILE", "TPL_MAINPRODUCT_BLK", "mainproduct_blk"); $this->ObTpl->set_block("TPL_MAINPRODUCT_BLK", "TPL_PRODUCT_BLK", "product_blk"); $this->ObTpl->set_block("TPL_WISHLIST_FILE", "TPL_MAINWISHLIST_BLK", "mainwishlist_blk"); $this->ObTpl->set_block("TPL_MAINWISHLIST_BLK", "TPL_WISHLIST_BLK", "wishlist_blk"); $this->ObTpl->set_block("TPL_WISHLIST_FILE", "TPL_ADDWISHEMAIL_BLK", "addwishlist_blk"); $this->ObTpl->set_block("TPL_WISHLIST_FILE", "TPL_SENDWISHEMAIL_BLK", "sendwishlist_blk"); #INTIALIZING $this->ObTpl->set_var("mainproduct_blk", ""); $this->ObTpl->set_var("product_blk", ""); $this->ObTpl->set_var("mainwishlist_blk", ""); $this->ObTpl->set_var("wishlist_blk", ""); $this->ObTpl->set_var("addwishlist_blk", ""); $this->ObTpl->set_var("sendwishlist_blk", ""); $this->ObTpl->set_var("TPL_VAR_MSG", ""); if (isset($this->request['mode']) && $this->request['mode'] == "dspmsg") { $this->ObTpl->set_var("TPL_VAR_MSG", MSG_EMAIL_SENT); } $this->ObTpl->set_var("TPL_VAR_WISHLIST", MSG_VAR_WISHLIST); #*******************DISPLAY MAIN PRODUCT***************************** ##WISHLIST URL $wishModifyUrl = SITE_URL . "ecom/index.php?action=wishlist.modify"; $this->ObTpl->set_var("TPL_VAR_WISHLISTMODIFYURL", $this->libFunc->m_safeUrl($wishModifyUrl)); $addEmailUrl = SITE_URL . "ecom/index.php?action=wishlist.emailadd"; $this->ObTpl->set_var("TPL_VAR_ADDEMAIL", $this->libFunc->m_safeUrl($addEmailUrl)); $removeUrl = SITE_URL . "ecom/index.php?action=wishlist.emailremove"; $this->ObTpl->set_var("TPL_VAR_REMOVE_EMAIL", $this->libFunc->m_safeUrl($removeUrl)); $sendUrl = SITE_URL . "ecom/index.php?action=wishlist.emailsend"; $this->ObTpl->set_var("TPL_VAR_SEND_EMAIL", $this->libFunc->m_safeUrl($sendUrl)); #******************DISPLAY WISHLIST PRODUCT********************** #QUERY TO GET PRODUCTS UNDER SELECTED $query = "SELECT iShopWishid_PK,vTitle,vQuantity,vSeoTitle FROM " . PRODUCTS . "," . WISHLIST . " WHERE iProductid_FK=iProdid_PK AND iCustomerid_FK='" . $_SESSION['userid'] . "'"; $pn = new PrevNext($this->pageTplPath, $this->pageTplFile, $this->obDb); $extraStr = "action=ecom.wishlist&mode=" . $this->request['mode']; $pn->formno = 1; $navArr = $pn->create($query, $this->pageSize, $extraStr); $this->obDb->query = $navArr['query']; $rowProduct = $this->obDb->fetchQuery(); $productCount = $this->obDb->record_count; if ($productCount > 0) { for ($i = 0; $i < $productCount; $i++) { $productUrl = SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $rowProduct[$i]->vSeoTitle; $this->ObTpl->set_var("TPL_VAR_PRODUCTURL", $this->libFunc->m_safeUrl($productUrl)); $this->ObTpl->set_var("TPL_VAR_ID", $this->libFunc->m_displayContent($rowProduct[$i]->iShopWishid_PK)); $this->ObTpl->set_var("TPL_VAR_TITLE", $this->libFunc->m_displayContent($rowProduct[$i]->vTitle)); $this->ObTpl->set_var("TPL_VAR_QTY", $this->libFunc->m_displayContent($rowProduct[$i]->vQuantity)); $this->ObTpl->parse("product_blk", "TPL_PRODUCT_BLK", true); } $this->ObTpl->parse("mainproduct_blk", "TPL_MAINPRODUCT_BLK"); #QUERY TO GET WISH EMAILS $this->obDb->query = "SELECT iWishid_PK,vEmail FROM " . WISHEMAILS . " WHERE iCustomerid_FK='" . $_SESSION['userid'] . "'"; $rsWishEmail = $this->obDb->fetchQuery(); $rsCount = $this->obDb->record_count; if ($rsCount > 0) { for ($i = 0; $i < $rsCount; $i++) { $this->ObTpl->set_var("TPL_VAR_EMAILID", $this->libFunc->m_displayContent($rsWishEmail[$i]->iWishid_PK)); $this->ObTpl->set_var("TPL_VAR_EMAIL", $this->libFunc->m_displayContent($rsWishEmail[$i]->vEmail)); $this->ObTpl->parse("wishlist_blk", "TPL_WISHLIST_BLK", true); } $this->ObTpl->parse("mainwishlist_blk", "TPL_MAINWISHLIST_BLK"); $this->ObTpl->parse("sendwishlist_blk", "TPL_SENDWISHEMAIL_BLK"); } $this->ObTpl->parse("addwishlist_blk", "TPL_ADDWISHEMAIL_BLK"); #PAGINATION $this->ObTpl->set_var("PagerBlock1", $navArr['pnContents']); } else { $this->ObTpl->set_var("TPL_VAR_MSG", MSG_NOPRODUCT_WISHLIST); } return $this->ObTpl->parse("return", "TPL_WISHLIST_FILE"); }
function m_dspCustomers() { #INTIALIZING TEMPLATES $this->ObTpl = new template(); $this->ObTpl->set_file("TPL_USER_FILE", $this->userTemplate); $this->ObTpl->set_block("TPL_USER_FILE", "TPL_USERMAIN_BLK", "usermain_blk"); $this->ObTpl->set_block("TPL_USERMAIN_BLK", "TPL_USER_BLK", "user_blk"); $this->ObTpl->set_block("TPL_USER_FILE", "TPL_MSG_BLK", "msg_blk"); $this->ObTpl->set_block("TPL_USER_FILE", "TPL_PAGE_BLK2", "page_blk2"); $this->ObTpl->set_var("GRAPHICSMAINPATH", GRAPHICS_PATH); $this->ObTpl->set_var("TPL_VAR_SITEURL", SITE_URL); $this->ObTpl->set_var("usermain_blk", ""); $this->ObTpl->set_var("user_blk", ""); $this->ObTpl->set_var("msg_blk", ""); $this->ObTpl->set_var("page_blk1", ""); $this->ObTpl->set_var("page_blk2", ""); #defining language pack variables. $this->ObTpl->set_var("LANG_VAR_CUSTOMERS", LANG_CUSTOMERS); $this->ObTpl->set_var("LANG_VAR_ADDCUSTOMER", LANG_ADDCUSTOMER); $this->ObTpl->set_var("LANG_VAR_SEACRH", LANG_SEARCH); $this->ObTpl->set_var("LANG_VAR_BY", LANG_BY); $this->ObTpl->set_var("LANG_VAR_FIRSTNAME", LANG_FIRSTNAME); $this->ObTpl->set_var("LANG_VAR_LASTNAME", LANG_LASTNAME); $this->ObTpl->set_var("LANG_VAR_CITY", LANG_CITY); $this->ObTpl->set_var("LANG_VAR_STATE", LANG_COUNTYSTATE); $this->ObTpl->set_var("LANG_VAR_COUNTRY", LANG_COUNTRY); $this->ObTpl->set_var("LANG_VAR_NEWSLETTER", LANG_NEWSLETTER); $this->ObTpl->set_var("LANG_VAR_SIGNUP", LANG_SIGNUP); $this->ObTpl->set_var("LANG_VAR_DETAILS", LANG_DETAILS); $this->ObTpl->set_var("LANG_VAR_STATUS", LANG_STATUS); $this->ObTpl->set_var("LANG_VAR_ENABLE", LANG_ENABLE); $this->ObTpl->set_var("LANG_VAR_DISABLE", LANG_DISABLE); $this->ObTpl->set_var("LANG_VAR_DELETE", LANG_DELETE); $this->ObTpl->set_var("TPL_VAR_MSG", ""); $this->request['search'] = $this->libFunc->ifSet($this->request, 'search', ""); $this->request['searchtype'] = $this->libFunc->ifSet($this->request, 'searchtype', ""); $this->request['todo'] = $this->libFunc->ifSet($this->request, 'todo', ""); $this->request['status'] = $this->libFunc->ifSet($this->request, 'status', ""); switch ($this->request['todo']) { case "delete": if ($this->request['status'] == 1) { $this->ObTpl->set_var("TPL_VAR_MSG", MSG_USER_DELSUCCESS); $this->ObTpl->parse("msg_blk", "TPL_MSG_BLK"); } else { $this->ObTpl->set_var("TPL_VAR_MSG", MSG_USER_DELNOSUCCESS); $this->ObTpl->parse("msg_blk", "TPL_MSG_BLK"); } break; case "disable": if ($this->request['status'] == 1) { $this->ObTpl->set_var("TPL_VAR_MSG", MSG_USER_DISABLESUCCESS); $this->ObTpl->parse("msg_blk", "TPL_MSG_BLK"); } else { $this->ObTpl->set_var("TPL_VAR_MSG", MSG_USER_DISABLENOSUCCESS); $this->ObTpl->parse("msg_blk", "TPL_MSG_BLK"); } break; case "enable": if ($this->request['status'] == 1) { $this->ObTpl->set_var("TPL_VAR_MSG", MSG_USER_ENABLESUCCESS); $this->ObTpl->parse("msg_blk", "TPL_MSG_BLK"); } else { $this->ObTpl->set_var("TPL_VAR_MSG", MSG_USER_ENABLENOSUCCESS); $this->ObTpl->parse("msg_blk", "TPL_MSG_BLK"); } break; } $this->ObTpl->set_var("TPL_VAR_SEL1", ""); $this->ObTpl->set_var("TPL_VAR_SEL2", ""); $this->ObTpl->set_var("TPL_VAR_SEL3", ""); $this->ObTpl->set_var("TPL_VAR_SEL4", ""); $this->ObTpl->set_var("TPL_VAR_SEL5", ""); $query = "SELECT iCustmerid_PK,vEmail,vLastName,vFirstName,vState,vStateName,vCountry,"; $query .= "iMailList,tmSignupDate,iStatus FROM " . CUSTOMERS . " WHERE iRegistered='1'"; if (!empty($this->request['search'])) { $this->ObTpl->set_var("TPL_VAR_SEARCHTEXT", $this->request['search']); if ($this->request['searchtype'] == "last_name") { $query .= " AND (vLastName LIKE '%" . $this->request['search'] . "%')"; $this->ObTpl->set_var("TPL_VAR_SEL1", "selected"); } elseif ($this->request['searchtype'] == "first_name") { $query .= " AND (vFirstName LIKE '%" . $this->request['search'] . "%')"; $this->ObTpl->set_var("TPL_VAR_SEL2", "selected"); } elseif ($this->request['searchtype'] == "city") { $query .= " AND (vCity LIKE '%" . $this->request['search'] . "%')"; $this->ObTpl->set_var("TPL_VAR_SEL3", "selected"); } elseif ($this->request['searchtype'] == "state") { $this->obDb->query = "SELECT iStateId_PK FROM " . STATES . " WHERE (vStateName LIKE '%" . $this->request['search'] . "%')"; $row_state = $this->obDb->fetchQuery(); $stateCount = $this->obDb->record_count; $stateString = "2000000,"; for ($i = 0; $i < $stateCount; $i++) { $stateString = $stateString . $row_state[$i]->iStateId_PK . ","; } $stateString = substr($stateString, 0, -1); $query .= " WHERE vState IN ({$stateString})"; $this->ObTpl->set_var("TPL_VAR_SEL4", "selected"); } elseif ($this->request['searchtype'] == "country") { $this->obDb->query = "SELECT iCountryId_PK FROM " . COUNTRY . " WHERE (vCountryName LIKE '%" . $this->request['search'] . "%') order by vCountryName"; $row_country = $this->obDb->fetchQuery(); $countryCount = $this->obDb->record_count; $stateCount = $this->obDb->record_count; $countryString = "20000000,"; for ($i = 0; $i < $countryCount; $i++) { $countryString = $countryString . $row_country[$i]->iCountryId_PK . ","; } $countryString = substr($countryString, 0, -1); $query .= " WHERE vCountry IN ({$countryString})"; $this->ObTpl->set_var("TPL_VAR_SEL5", "selected"); } } else { $this->ObTpl->set_var("TPL_VAR_SEARCHTEXT", ""); } $query .= " ORDER BY vFirstName"; if (!isset($this->request['page'])) { $this->request['page'] = '1'; } $extraStr = "action=user.home&search=" . $this->request['search'] . "&searchtype=" . $this->request['searchtype']; $this->ObTpl->set_var("TPL_VAR_EXTRASTRING", "search=" . $this->request['search'] . "&searchtype=" . $this->request['searchtype'] . "&page=" . $this->request['page']); $pn = new PrevNext($this->pageTplPath, $this->pageTplFile, $this->obDb); $pn->formno = 1; $navArr = $pn->create($query, $this->pageSize, $extraStr); $pn2 = new PrevNext($this->pageTplPath, $this->pageTplFile, $this->obDb); $pn2->formno = 2; $navArr2 = $pn2->create($query, $this->pageSize, $extraStr, "top"); $row_customer = $navArr['qryRes']; $recordCount = $navArr['selRecs']; $totalRecord = $navArr['totalRecs']; $this->ObTpl->set_var("PagerBlock1", ""); $this->ObTpl->set_var("PagerBlock2", ""); $this->ObTpl->set_var("TPL_VAR_STATE", ""); if ($recordCount > 0) { for ($i = 0; $i < $recordCount; $i++) { if ($row_customer[$i]->iStatus == 1) { $this->ObTpl->set_var("TPL_VAR_IMG", "<span class=\"statusActive\">Active</span>"); } else { $this->ObTpl->set_var("TPL_VAR_IMG", "<span class=\"statusInactive\">Inactive</span>"); } $this->ObTpl->set_var("TPL_VAR_ID", $row_customer[$i]->iCustmerid_PK); $this->ObTpl->set_var("TPL_VAR_EMAIL", $this->libFunc->m_displayContent($row_customer[$i]->vEmail)); $this->ObTpl->set_var("TPL_VAR_USERNAME", $this->libFunc->m_displayContent($row_customer[$i]->vLastName) . ", " . $this->libFunc->m_displayContent($row_customer[$i]->vFirstName)); if ($row_customer[$i]->vState > 1) { $this->obDb->query = "SELECT distinct vStateName FROM " . STATES . " where iStateId_PK = '" . $row_customer[$i]->vState . "'"; $row_state = $this->obDb->fetchQuery(); if (!empty($row_state[0]->vStateName)) { $this->ObTpl->set_var("TPL_VAR_STATE", $this->libFunc->m_displayContent($row_state[0]->vStateName)); } } elseif ($row_customer[$i]->vState = "-1") { $this->ObTpl->set_var("TPL_VAR_STATE", ""); } else { if (!empty($row_customer[$i]->vStateName)) { $this->ObTpl->set_var("TPL_VAR_STATE", $this->libFunc->m_displayContent($row_customer[$i]->vStateName)); } } $this->obDb->query = "SELECT vCountryName FROM " . COUNTRY . " where iCountryId_PK = '" . $row_customer[$i]->vCountry . "' order by vCountryName"; $row_country = $this->obDb->fetchQuery(); if (!empty($row_country[0]->vCountryName)) { $this->ObTpl->set_var("TPL_VAR_COUNTRY", $this->libFunc->m_displayContent($row_country[0]->vCountryName)); } if ($row_customer[$i]->iMailList == 1) { $maillist = "HTML"; } elseif ($row_customer[$i]->iMailList == 2) { $maillist = "Plain text "; } else { $maillist = "None"; } $this->ObTpl->set_var("TPL_VAR_NEWSLETTER", $maillist); $this->ObTpl->set_var("TPL_VAR_SIGNUPDATE", $this->libFunc->dateFormat1($row_customer[$i]->tmSignupDate)); $this->ObTpl->parse("user_blk", "TPL_USER_BLK", true); } $this->ObTpl->parse("usermain_blk", "TPL_USERMAIN_BLK"); $this->ObTpl->set_var("PagerBlock1", $navArr['pnContents']); $this->ObTpl->set_var("PagerBlock2", $navArr2['pnContents']); $this->ObTpl->parse("page_blk2", "TPL_PAGE_BLK2"); $this->ObTpl->parse("countmsg_blk", "TPL_COUNTMSG_BLK"); } #endif $this->ObTpl->set_var("TPL_VAR_RECORDCOUNT", $totalRecord . " records found"); return $this->ObTpl->parse("return", "TPL_USER_FILE"); }
function m_attachedProduct($ownerId, $ownerType) { $comFunc = new c_commonFunctions(); $comFunc->obDb = $this->obDb; $attCondition = ""; if ($this->request['sort'] == 'attribute') { $this->ObTpl->set_var("TPL_VAR_ATTRIBUTESELECTED", "class=\"selected\""); $attCondition = " AND iAttrValueId_FK <> 0 "; } else { $this->ObTpl->set_var("TPL_VAR_OPTIONSELECTED", "class=\"selected\""); } if (isset($this->request['listview']) && $this->request['listview'] == "gridview") { $_SESSION['listview'] = $this->request['listview']; } else { unset($_SESSION['listview']); } if ($_SESSION['listview'] == "gridview") { $this->ObTpl->set_var("TPL_VAR_PRODUCTCLASS", "class=\"products grid\""); $this->ObTpl->set_var("TPL_VAR_IMGONLYSELECTED", "selected"); } else { $this->ObTpl->set_var("TPL_VAR_PRODUCTCLASS", "class=\"products\""); } if (!isset($_SESSION['sort'])) { $_SESSION['sort'] = "ORDER BY iSort"; } if (isset($this->request['sortbyprice'])) { if ($this->request['sortbyprice'] == "ASC" || $this->request['sortbyprice'] == "DESC") { $_SESSION['sort'] = "ORDER BY fPrice " . $this->request['sortbyprice']; $_SESSION['pricedirect'] = $this->request['sortbyprice']; unset($_SESSION['alphadirect']); } } if (isset($this->request['alphasort'])) { if ($this->request['alphasort'] == '0') { $_SESSION['sort'] = ""; $_SESSION['alphadirect'] = ""; } elseif ($this->request['alphasort'] == 'ASC') { $_SESSION['sort'] = "ORDER BY vTitle " . $this->request['alphasort']; $_SESSION['alphadirect'] = $this->request['alphasort']; } elseif ($this->request['alphasort'] == 'DESC') { $_SESSION['sort'] = "ORDER BY vTitle " . $this->request['alphasort']; $_SESSION['alphadirect'] = $this->request['alphasort']; } unset($_SESSION['pricedirect']); } if (isset($_SESSION['pricedirect'])) { if ($_SESSION['pricedirect'] == "ASC") { $this->ObTpl->set_var("TPL_VAR_ASC2", "selected = \"selected\""); } if ($_SESSION['pricedirect'] == "DESC") { $this->ObTpl->set_var("TPL_VAR_DESC2", "selected = \"selected\""); } } if (isset($_SESSION['alphadirect'])) { if ($_SESSION['alphadirect'] == "ASC") { $this->ObTpl->set_var("TPL_VAR_ASC1", "selected = \"selected\""); } if ($_SESSION['alphadirect'] == "DESC") { $this->ObTpl->set_var("TPL_VAR_DESC1", "selected = \"selected\""); } } if (isset($this->request['prodperpage']) && $this->request['prodperpage'] != '0' && is_numeric($this->request['prodperpage'])) { $_SESSION['pageSize'] = $this->request['prodperpage']; $this->pageSize = $_SESSION['pageSize']; } elseif (isset($_SESSION['pageSize']) && !empty($_SESSION['pageSize'])) { $this->pageSize = $_SESSION['pageSize']; } if (!isset($this->request['attkey'])) { $query = "SELECT vTitle,iProdid_PK,iAttrValueId_FK,vSeoTitle,tShortDescription,fPrice,fRetailPrice,fListPrice,iTaxable,vImage1,iSale "; $query .= " FROM " . PRODUCTS . " D, " . FUSIONS . " F WHERE iProdid_PK =iSubId_FK AND vtype='product' AND "; $query .= " iOwner_FK='" . $ownerId . "' AND vOwnerType='" . $ownerType . "' AND iState=1 " . $attCondition . $_SESSION['sort']; } else { $query = "SELECT vTitle,iProdid_PK,iAttrValueId_FK,vSeoTitle,tShortDescription,fPrice,fRetailPrice,fListPrice,iTaxable,vImage1,iSale "; $query .= "FROM " . PRODUCTS . ", " . PRODUCTATTRIBUTES . ", " . ATTRIBUTEVALUES; $query .= " WHERE iValueId_PK = iValueid_FK AND iProductid_FK = iProdid_PK"; $query .= " AND tValues LIKE '%?" . $this->request['attkey'] . "?%'"; } $pn = new PrevNext($this->pageTplPath, $this->pageTplFile, $this->obDb); if ($ownerType == "product") { $extraStr = "ecom/index.php?action=ecom.pdetails&mode=" . $this->request['mode']; } elseif ($ownerType == "department") { $extraStr = "ecom/index.php?action=ecom.details&mode=" . $this->request['mode']; } $pn->formno = 1; $navArr = $pn->create($query, $this->pageSize, $extraStr, $this->noPaging); $pn2 = new PrevNext($this->pageTplPath, $this->pageTplFile, $this->obDb); $pn2->formno = 2; $navArr2 = $pn2->create($query, $this->pageSize, $extraStr, $this->noPaging); $rowProduct = $navArr['qryRes']; $totalRecords = $navArr['totalRecs']; $productCount = $navArr['fetchedRecords']; $attributeexistFlag = 0; if ($productCount > 0) { for ($i = 0; $i < $productCount; $i++) { #MARGIN CALCULATOR switch (MARGINSTATUS) { case "increase": $rowProduct[$i]->fPrice = $rowProduct[$i]->fPrice * MARGINPERCENT / 100 + $rowProduct[$i]->fPrice; break; case "decrease": $rowProduct[$i]->fPrice = $rowProduct[$i]->fPrice - $rowProduct[$i]->fPrice * MARGINPERCENT / 100; break; default: $rowProduct[$i]->fPrice = $rowProduct[$i]->fPrice; break; } #END MARGIN CALCULATOR //--- Switch to retail price if Retail customer if ($comFunc->m_checkCustomerType() == 1 && ENABLE_WHOLESALE == 1 && $rowProduct[$i]->fRetailPrice > 0) { $rowProduct[$i]->fPrice = $rowProduct[$i]->fRetailPrice; } //----End switch price # CHECK IF THE DEPARTMENT HAS PRODUCTS WITH ATTRIBUTES if ($rowProduct[$i]->iAttrValueId_FK != 0) { $attributeexistFlag = 1; } # $this->ObTpl->set_var("TPL_VAR_LISTOPTIONS", ""); $this->ObTpl->set_var("TPL_VAR_LISTCHOICES", ""); $this->ObTpl->set_var("TPL_VAR_ONSALE", ""); $this->ObTpl->set_var("rrp_price_blk", ""); $comFunc->productId = $rowProduct[$i]->iProdid_PK; $shopUrl = SITE_URL . "ecom/index.php?action=ecom.addmulticart&mode=" . $rowProduct[$i]->vSeoTitle; $this->ObTpl->set_var("TPL_VAR_SHOPURL", $this->libFunc->m_safeUrl($shopUrl)); if ($rowProduct[$i]->iSale == 1) { $this->ObTpl->set_var("TPL_VAR_ATTACHED_ONSALE", "<p class=\"onSale\">On Sale!</p>"); } else { $this->ObTpl->set_var("TPL_VAR_ATTACHED_ONSALE", ""); } $productUrl = SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $rowProduct[$i]->vSeoTitle; $_SESSION['own'] = $ownerId; $this->ObTpl->set_var("TPL_VAR_PRODUCTURL", $this->libFunc->m_safeUrl($productUrl)); $this->ObTpl->set_var("TPL_VAR_ID", $this->libFunc->m_displayContent($rowProduct[$i]->iProdid_PK)); $this->ObTpl->set_var("TPL_VAR_TITLE", $this->libFunc->m_displayContent($rowProduct[$i]->vTitle)); ##TO CHECK WHEATHER TO DISPLAY WISHLIST OR NOT MANAGED BY ADMIN if (USEWISHLIST == 1) { //if ($this->request['listview']=="gridview"){ //$this->ObTpl->set_var("attached_wishlist_blk",""); //}else{ $wishListUrl = SITE_URL . "ecom/index.php?action=wishlist.add&mode=" . $rowProduct[$i]->iProdid_PK; $this->ObTpl->set_var("TPL_VAR_ATTACHED_WISHLISTLINK", "<p id=\"addWishlistAttached\"><a href=\"" . $this->libFunc->m_safeUrl($wishListUrl) . "\">Add to Wish List</a></p>"); //$this->ObTpl->parse("attached_wishlist_blk", "TPL_ATTACHED_WISHLIST_BLK"); //} } else { $this->ObTpl->set_var("TPL_VAR_ATTACHED_WISHLISTLINK", ""); } #TO CHECK WHETHER TO DISPLAY COMPARELIST OR NOT MANAGED BY ADMIN if (USECOMPARE == 1) { //if ($this->request['listview']=="gridview"){ //$this->ObTpl->set_var("attached_compare_blk",""); //}else{ $compareListUrl = SITE_URL . "ecom/index.php?action=compare.add&mode=" . $rowProduct[$i]->iProdid_PK; $this->ObTpl->set_var("TPL_VAR_ATTACHED_COMPARELINK", "<p id=\"addComparisonAttached\"><a href=\"" . $this->libFunc->m_safeUrl($compareListUrl) . "\">Add to Comparison List</a></p>"); //$this->ObTpl->parse("attached_compare_blk", "TPL_ATTACHED_COMPARE_BLK"); //} } else { $this->ObTpl->set_var("TPL_VAR_ATTACHED_COMPARELINK", ""); } if ($rowProduct[$i]->tShortDescription != "") { if ($this->request['listview'] == "gridview") { $this->ObTpl->set_var("productdesc_blk", ""); } else { $this->ObTpl->set_var("TPL_VAR_DESC", nl2br($this->libFunc->m_displayContent($rowProduct[$i]->tShortDescription))); $this->ObTpl->parse("productdesc_blk", "TPL_PDESC_BLK"); } } else { if ($this->request['listview'] == "gridview") { $this->ObTpl->set_var("productdesc_blk", ""); } else { $this->ObTpl->set_var("TPL_VAR_DESC", ""); $this->ObTpl->parse("productdesc_blk", "TPL_PDESC_BLK"); } } # MANIPULATE NETGROSS & INC_VAT DISPLAY if ($rowProduct[$i]->iTaxable == 1) { $this->ObTpl->set_var("TPL_VAR_PRICE", $comFunc->m_Format_Price($rowProduct[$i]->fPrice)); } else { $this->ObTpl->set_var("TPL_VAR_PRICE", number_format($rowProduct[$i]->fPrice, 2)); } ##CHECK FOR RRP PRICE if (!$this->libFunc->m_isNull($rowProduct[$i]->fListPrice) && $rowProduct[$i]->fListPrice > 0) { $this->ObTpl->set_var("TPL_VAR_RRP_AMOUNT", RRP_TEXT . ": <strike>" . CONST_CURRENCY . number_format($rowProduct[$i]->fListPrice, 2, '.', '') . "</strike>"); $this->ObTpl->parse("rrp_price_blk", "TPL_RRPPRICE_BLK"); } if (!$this->libFunc->m_isNull($rowProduct[$i]->vImage1)) { $img = $this->libFunc->m_checkFile($rowProduct[$i]->vImage1, "product", $this->libFunc->m_displayContent($rowProduct[$i]->vTitle)); if ($img) { $this->ObTpl->set_var("TPL_VAR_IMG", $img); } else { $this->ObTpl->set_var("TPL_VAR_IMG", MSG_NOIMG); } } else { $this->ObTpl->set_var("TPL_VAR_IMG", MSG_NOIMG); } if (CUSTOMER_REVIEWS == 1) { ##OVERALL PRODUCT STAR RANKING $this->obDb->query = "SELECT SUM(vRank) as total, COUNT(iItemid_FK) as reviewcount FROM " . REVIEWS . " WHERE iItemid_FK ='" . $rowProduct[$i]->iProdid_PK . "'"; $OverallReviewRating = $this->obDb->fetchQuery(); $ReviewRating = $OverallReviewRating[0]->total / $OverallReviewRating[0]->reviewcount; $ReviewRating = number_format($ReviewRating, 0, '.', ''); switch ($ReviewRating) { case "0": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating0\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "1": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating1\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "2": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating2\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "3": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating3\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "4": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating4\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "5": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating5\">" . $OverallReviewRating[0]->reviewcount . "reviews</p>"); break; case "6": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating6\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "7": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating7\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "8": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating8\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "9": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating9\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "10": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating10\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; } $this->ObTpl->parse("reviewrank_blk", "TPL_REVIEWRANK_BLK"); } #GET OPTIONS $this->ObTpl->set_var("TPL_VAR_LISTOPTIONS", $comFunc->m_getOptions('0')); #GET CHOICES $this->ObTpl->set_var("TPL_VAR_LISTCHOICES", $comFunc->m_getChoices()); $this->ObTpl->parse("dspproduct_blk", "TPL_PRODUCT_BLK", true); } # END FOR LOOP # DISPLAY "SORT BY ATTRIBUTES" TAB IF THE DEPARTMENT HAS PRODUCTS WITH ATTRIBUTE if ($attributeexistFlag == 1) { $this->ObTpl->parse("sortattributetab_blk", "TPL_SORTATTRIBUTETAB_BLK"); } if ($this->request["sort"] == "attribute") { $this->ObTpl->parse("sortattribute_blk", "TPL_SORTATTRIBUTE_BLK"); } else { $this->ObTpl->parse("sortoptions_blk", "TPL_SORTOPTIONS_BLK"); } $this->ObTpl->parse("mainproduct_blk", "TPL_MAINPRODUCT_BLK"); } # END IF PRODUCT COUNT > 0 if ($totalRecords > $this->pageSize) { #PAGINATION $this->ObTpl->set_var("PagerBlock1", $navArr['pnContents']); $this->ObTpl->set_var("PagerBlock2", $navArr2['pnContents']); } else { $this->ObTpl->set_var("PagerBlock1", ""); $this->ObTpl->set_var("PagerBlock2", ""); } }
function m_showComparelist() { $this->ObTpl = new template(); $this->ObTpl->set_file("TPL_COMPARE_FILE", $this->template); $this->ObTpl->set_var("TPL_VAR_SITEURL", SITE_URL); $this->ObTpl->set_var("TPL_VAR_GRAPHICSURL", GRAPHICS_PATH); $this->ObTpl->set_var("TPL_VAR_CURRENCY", CONST_CURRENCY); $this->ObTpl->set_var("TPL_VAR_USERNAME", $this->libFunc->m_displayContent($_SESSION['username'])); #SETTING TEMPLATE BLOCKS $this->ObTpl->set_block("TPL_COMPARE_FILE", "TPL_MAINPRODUCT_BLK", "mainproduct_blk"); $this->ObTpl->set_block("TPL_COMPARE_FILE", "TPL_MSG_BLK", "msg_blk"); $this->ObTpl->set_block("TPL_MAINPRODUCT_BLK", "TPL_PRODUCT_BLK", "product_blk"); $this->ObTpl->set_block("TPL_PRODUCT_BLK", "TPL_ATTRIBUTEFIELD_BLK", "attributefield_blk"); #INTIALIZING $this->ObTpl->set_var("msg_blk", ""); $this->ObTpl->set_var("mainproduct_blk", ""); $this->ObTpl->set_var("product_blk", ""); $this->ObTpl->set_var("attributefield_blk", ""); $this->ObTpl->set_var("TPL_VAR_MSG", ""); $this->ObTpl->set_var("fieldname_blk", ""); $this->ObTpl->set_var("TPL_VAR_COMPARELIST", MSG_VAR_COMPARELIST); #*******************DISPLAY MAIN PRODUCT***************************** ##WISHLIST URL $compareModifyUrl = SITE_URL . "ecom/index.php?action=compare.modify"; $this->ObTpl->set_var("TPL_VAR_COMPAREMODIFYURL", $this->libFunc->m_safeUrl($compareModifyUrl)); #******************DISPLAY WISHLIST PRODUCT********************** #QUERY TO GET PRODUCTS UNDER SELECTED $query = "SELECT iCompareid_PK,vTitle,vSku,vSeoTitle,tShortDescription,fListPrice,fPrice,iProdid_PK,iVendorid_FK FROM " . PRODUCTS . "," . COMPARE . " WHERE iProductid_FK=iProdid_PK AND iCustomerid_FK='" . $_SESSION['userid'] . "'"; $pn = new PrevNext($this->pageTplPath, $this->pageTplFile, $this->obDb); echo $this->request['mode']; $extraStr = "action=ecom.compare&mode=" . $this->request['mode']; $pn->formno = 1; $navArr = $pn->create($query, $this->pageSize, $extraStr); $this->obDb->query = $navArr['query']; $rowProduct = $this->obDb->fetchQuery(); $productCount = $this->obDb->record_count; if ($productCount > 0) { for ($i = 0; $i < $productCount; $i++) { $productUrl = SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $rowProduct[$i]->vSeoTitle; $this->ObTpl->set_var("TPL_VAR_PRODUCTURL", $this->libFunc->m_safeUrl($productUrl)); $this->ObTpl->set_var("TPL_VAR_ID", $this->libFunc->m_displayContent($rowProduct[$i]->iCompareid_PK)); $this->ObTpl->set_var("TPL_VAR_TITLE", $this->libFunc->m_displayContent($rowProduct[$i]->vTitle)); $this->ObTpl->set_var("TPL_VAR_SKU", $this->libFunc->m_displayContent($rowProduct[$i]->vSku)); $this->ObTpl->set_var("TPL_VAR_SHORTDESC", $this->libFunc->m_displayContent($rowProduct[$i]->tShortDescription)); $this->ObTpl->set_var("TPL_VAR_PRICERRP", CONST_CURRENCY . number_format($rowProduct[$i]->fListPrice, 2, '.', '')); $this->ObTpl->set_var("TPL_VAR_PRICEMAIN", CONST_CURRENCY . number_format($rowProduct[$i]->fPrice, 2, '.', '')); $this->obDb->query = "SELECT vCompany FROM " . SUPPLIERS . " WHERE iVendorid_PK='" . $rowProduct[$i]->iVendorid_FK . "'"; $vendor = $this->obDb->fetchQuery(); if ($vendor[0]->vCompany != "") { $this->ObTpl->set_var("TPL_VAR_SUPPLIER", $vendor[0]->vCompany); } else { $this->ObTpl->set_var("TPL_VAR_SUPPLIER", "N/A"); } #DISPLAY PRODUCT ATTRIBUTE $this->obDb->query = "SELECT * FROM " . PRODUCTATTRIBUTES . " WHERE iProductid_FK ='" . $rowProduct[0]->iProdid_PK . "'"; $attributerow = $this->obDb->fetchQuery(); $attcount = $this->obDb->record_count; if ($attcount > 0) { $this->obDb->query = "SELECT A.*, AV.tValues FROM " . ATTRIBUTES . " A, " . ATTRIBUTEVALUES . " AV WHERE AV.iValueId_PK=" . $attributerow[0]->iValueid_FK . " AND A.iAttributesid_PK = " . $attributerow[0]->iAttributeid_FK; $attribute = $this->obDb->fetchQuery(); if ($attribute[0]->vAttributeTitle != "") { $this->ObTpl->set_var("TPL_VAR_ATTRIBUTETITLE", $attribute[0]->vAttributeTitle); $attdesc = explode("¬", $attribute[0]->tValues); $attfieldname = explode("¬", $attribute[0]->vFieldname); $prefix = explode("¬", $attribute[0]->vPrefix); $suffix = explode("¬", $attribute[0]->vSuffix); for ($i = 0; $i < $attribute[0]->iFieldnumber; $i++) { $this->ObTpl->set_var("TPL_VAR_FILEDNAME", $attfieldname[$i]); $this->ObTpl->set_var("TPL_VAR_FIELDVALUE", $attdesc[$i]); $this->ObTpl->set_var("TPL_VAR_PREFIX", $prefix[$i]); $this->ObTpl->set_var("TPL_VAR_SUFFIX", $suffix[$i]); $this->ObTpl->parse("attributefield_blk", "TPL_ATTRIBUTEFIELD_BLK", true); } $this->ObTpl->parse("attributetable_blk", "TPL_ATTRIBUTETABLE_BLK"); } } #DISPALY PRICE FOR SELECTED PRODUCT $this->ObTpl->parse("product_blk", "TPL_PRODUCT_BLK", true); } $this->ObTpl->parse("mainproduct_blk", "TPL_MAINPRODUCT_BLK"); } else { $this->ObTpl->set_var("TPL_VAR_MSG", MSG_NOPRODUCT_WISHLIST); $this->ObTpl->parse("msg_blk", "TPL_MSG_BLK"); } return $this->ObTpl->parse("return", "TPL_COMPARE_FILE"); }