[!][Text]v=on[/Text]
[include vars.inc][/!]
[protect ADMIN,[lookup db=prefs.db&lookinfield=PREF&value=ADMIN&returnfield=value],[lookup db=prefs.db&lookinfield=PREF&value=GROUPS&returnfield=value]]
Product Administration
[SETMIMEHEADER name=Pragma&value=no-cache]
[SETMIMEHEADER name=Expires&value=Thu, 01 Dec 1994 16:00:00 GMT]
[SETMIMEHEADER name=Cache-Control&value=max-age=0]
[Text]SelectOne=No Graphic[/Text]
[include body_tag.inc]
[showif [action]=New]
[math show=f]sku=[search db=products.db&neSKUdatarq=find_all&deSKUsort=1&SKUtype=number&max=1][founditems][SKU][/founditems][/search]+1[/math]
[/showif]
[!]---------------------------------------------------------------------[/!]
[!] Coming from Pick Category [/!]
[!]---------------------------------------------------------------------[/!]
[showif [FromPickCategory]=Yes]
[Text]selectedCategory=+[/Text]
[formvariables name=CatID_&exact=f]
[Text]selectedCategory=[selectedCategory][value]+[/Text]
[/formvariables]
[Replace db=products.db&eqSKUdata=[sku]]sections=[Url][selectedCategory][/Url][/Replace]
[Search db=related.db&eqR_SKUdatarq=[sku]&eqR_CTYPEdatarq=S]
[Showif [numFound]=0]
[text]related_id=[/text]
[/Showif]
[Showif [numFound]!0]
[Founditems]
[Text]related_id=[R_ID][/Text]
[/Founditems]
[/Showif]
[/Search]
[Showif [related_id]=]
[Search db=related.db&neR_IDdata=Find_All&deR_IDsort=1&R_IDtype=num&max=1]
[Showif [numFound]=0]
[text]NewID=1[/text]
[/Showif]
[Showif [numFound]!0]
[Founditems]
[math show=f]NewID=[R_ID]+1[/math]
[Text]related_id=[NewID][/Text]
[/Founditems]
[/Showif]
[/Search]
[/Showif]
[Replace db=related.db&eqR_IDdata=[related_id]&append=T]R_ID=[related_id]&R_SKU=[sku]&R_NAME=[Url][selectedCategory][/Url]&R_CTYPE=S[/Replace]
[/showif]
[showif [action]=New]
[text]page_title=Add New Product[/text]
[text]helpid=product_add[/text]
[include banner.inc]
[/showif]
[showif [action]=Edit]
[search db=products.db&eqSKUdatarq=[url][SKU][/url]]
[showif [numfound]=0]
SKU "[SKU]" not found in database.
[/showif]
[founditems]
[text]page_title=Edit Product[/text]
[text]helpid=product_edit[/text]
[include banner.inc]
[!] Protection needs to be fixed
[hideif [include file=protection.inc&owner=[url][OWNER][/url]]^N]
[/hideif][/!]
[/founditems][/search]
[/showif]