Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 Customization
 Admin variable
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

apswater
VP-CART Super User

444 Posts

Posted - May 25 2005 :  09:37:45  Show Profile  Visit apswater's Homepage  Reply with Quote
On 4.5 ...

Does anyone happen to know a variable I can use to trigger tags to appear only when logeed on as admin.

on my site labwater.com I added a bunch of edit buttons for updating categories and products on the fly.

I need to instead say " If logged in as admin then write the edit tag"

can anyone help? I was hoping on not spending a lot of time tracing the admin files for it.


greatphoto
VP-CART Super User

USA
304 Posts

Posted - May 25 2005 :  10:09:00  Show Profile  Reply with Quote
I think this is what you are after:
If GetSess("ShopAdmin")="" Then


You have an interesting idea here....but I'm wondering about security. This seems benign enough to me, but I'd think long and hard about it. I'd hate to do anything that could weaken security.

Nathan

Go to Top of Page

apswater
VP-CART Super User

444 Posts

Posted - May 25 2005 :  10:23:14  Show Profile  Visit apswater's Homepage  Reply with Quote
Thanks...

I am not worried about the security of this mod... andy hacker can call the same asp file for edit but admin should cover the attempt just fine.

I want to remove the edit tags because people just cant seem to resist clicking on em!

THanks.

Go to Top of Page

apswater
VP-CART Super User

444 Posts

Posted - May 25 2005 :  10:49:13  Show Profile  Visit apswater's Homepage  Reply with Quote
ok I got it working but havd to change the = to <>
here is how I create the edit buttons so you dont have to go into the admin section to change things.

If GetSess("ShopAdmin")<>"" Then
%><a href="shopa_addcategory.asp?which=<%=cat_id%>&idfield=categoryid&table=categories&database="><font face="Arial" size="1" color="black">Edit</font></a><br><br><%
end if

This is a major time saver.

Now I just need to figure out how to slip an if then into the tmp_products and prodcuts templates that are html. Any thoughts?

I tried the <% stuff but it didnt work...can an html file have an if then or doyou have to have it as asp first?




Edited by - apswater on May 25 2005 10:58:09
Go to Top of Page

greatphoto
VP-CART Super User

USA
304 Posts

Posted - May 26 2005 :  00:05:22  Show Profile  Reply with Quote
By the way, the code I posted is found in the ShopCheckAdmin subroutine in shop$db.asp. ...and yes, I should have changed the "equals" to "not equals."

"I am not worried about the security of this mod... andy hacker can call the same asp file for edit but admin should cover the attempt just fine. "

Yeah, you are right. I thought about this later this morning. This is a great idea and I'll probably implement it on my site...except editing individual products is probably more important to me than categories, so your other questions are really important:

"Now I just need to figure out how to slip an if then into the tmp_products and prodcuts templates that are html. Any thoughts?
I tried the <% stuff but it didnt work...can an html file have an if then or doyou have to have it as asp first?"


These are good questions. I thought of the same myself. I have been interested in using ASP code in html headers and templates as well, but haven't done it.

There are some good references for the concept of asp code in templates elsewhere in the forum. There is a hack listed here (http://www.vpasp.com/virtprog/vpaspforum/topic.asp?TOPIC_ID=1524) whose concept may be used for what we want. It doesn't really let you add ASP code to the template, but will have a similar affect. Also in this post, support states that it is not possible to use ASP code directly in the templates.

In this post (http://www.vpasp.com/virtprog/vpaspforum/topic.asp?TOPIC_ID=1449) multiple people seemed to think it is possible to add ASP code to templates, but I don't think they realized at the time that templates work differently in this regard than other HTML.

Hmmm...I have a better idea based on past posts that I'll drop in here shortly....



Go to Top of Page

greatphoto
VP-CART Super User

USA
304 Posts

Posted - May 26 2005 :  00:28:05  Show Profile  Reply with Quote
Sorry I forgot. There were plenty of discussions on this before. Probably the best way to "add ASP code to product templates" is to create new template fields. The following post discusses how to do this.

http://www.vpasp.com/virtprog/vpaspforum/topic.asp?TOPIC_ID=3242

Other relevant posts are here:
http://www.vpasp.com/virtprog/vpaspforum/topic.asp?TOPIC_ID=3557
http://www.vpasp.com/virtprog/vpaspforum/topic.asp?TOPIC_ID=2682
http://www.vpasp.com/virtprog/vpaspforum/topic.asp?TOPIC_ID=3339


Go to Top of Page

apswater
VP-CART Super User

444 Posts

Posted - May 26 2005 :  13:00:53  Show Profile  Visit apswater's Homepage  Reply with Quote
Thanks so much. I was hoping it would be easier.
Only one of the edit tags is in displayproducts. The rest are in the the templates. I guess I could always hard code the display instead of using the html template.

As far as adding the tag for categoriy edits, I use that one a lot. You can tweek your descriptions much easier and to add a category you simply pull up a category that is similar, change what you need and save as new. it is much faster then setting up cateogries or products from scratch.

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00