Edit Product - Button
- igavemybest
- Captain (CAPT)
- Posts: 388
- Joined: Sun Apr 06, 2008 5:47 pm
Edit Product - Button
I want to add an "Edit Product" button that would appear on a store front-end products page while browsing the store's products as an admin. This would save tons of time going back into the catalog and looking up the item and I think it would be a great feature to also include in the next update. How would I go about this, or does anyone already have code for this?
Re: Edit Product - Button
You can do this fairly easily by changing the BuyProductDialog user control as follows:
Edit /ConLib/BuyProductDialog.ascx and find (near the bottom):
And change it to look like this:
Now edit the code-behind file /ConLib/BuyProductDialog.ascx.cs and find (near the top):
and make it look like this:
Now every product page will have a 3rd button "Edit Product". The button will only be visible if the authenticated user is both an Admin User and the user account has been approved.
Edit /ConLib/BuyProductDialog.ascx and find (near the bottom):
Code: Select all
<tr>
<td colspan="2">
<asp:ValidationSummary ID="ValidationSummary" runat="server" ValidationGroup="AddToBasket" />
<asp:Button ID="AddToWishlistButton" runat="server" Visible="true" OnClick="AddToWishlistButton_Click" Text="Add to Wishlist" EnableViewState="false" ValidationGroup="AddToBasket"></asp:Button>
<asp:Button ID="AddToBasketButton" runat="server" Visible="true" OnClick="AddToBasketButton_Click" Text="Add to Cart" EnableViewState="false" ValidationGroup="AddToBasket"></asp:Button>
</td>
</tr>
Code: Select all
<tr>
<td colspan="2">
<asp:ValidationSummary ID="ValidationSummary" runat="server" ValidationGroup="AddToBasket" />
<asp:Button ID="AddToWishlistButton" runat="server" Visible="true" OnClick="AddToWishlistButton_Click" Text="Add to Wishlist" EnableViewState="false" ValidationGroup="AddToBasket"></asp:Button>
<asp:Button ID="AddToBasketButton" runat="server" Visible="true" OnClick="AddToBasketButton_Click" Text="Add to Cart" EnableViewState="false" ValidationGroup="AddToBasket"></asp:Button>
<asp:Button ID="EditProductButton" runat="server" Visible="false" Text="Edit Product" EnableViewState="false"></asp:Button>
</td>
</tr>
Code: Select all
protected void Page_Init(object sender, System.EventArgs e)
{
_ProductId = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
_Product = ProductDataSource.Load(_ProductId);
if (_Product != null)
{
//DISABLE PURCHASE CONTROLS BY DEFAULT
AddToBasketButton.Visible = false;
rowQuantity.Visible = false;
Code: Select all
protected void Page_Init(object sender, System.EventArgs e)
{
_ProductId = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
_Product = ProductDataSource.Load(_ProductId);
if (_Product != null)
{
//BEGIN MOD: AbleMods.com
//8/10/2010
// Show Edit-Product button if user is admin
if (Token.Instance.User.IsAdmin && Token.Instance.User.IsApproved)
{
EditProductButton.Visible = true;
EditProductButton.PostBackUrl = string.Format("~/Admin/Products/EditProduct.aspx?ProductId={0}", _Product.ProductId);
}
//END MOD: AbleMods.com
//DISABLE PURCHASE CONTROLS BY DEFAULT
AddToBasketButton.Visible = false;
rowQuantity.Visible = false;
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
- igavemybest
- Captain (CAPT)
- Posts: 388
- Joined: Sun Apr 06, 2008 5:47 pm
Re: Edit Product - Button
Simple enough! Thanks Joe!
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Edit Product - Button
Down at the bottom of the page, underneath the Mode for View Page or Edit, there is a link that you can click to edit the product. There is also one for edit category, but I don't remember if that was originally there or if it came in a newer build.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
- igavemybest
- Captain (CAPT)
- Posts: 388
- Joined: Sun Apr 06, 2008 5:47 pm
Re: Edit Product - Button
Judy, you are correct. I have never seen that before. I have 7.0.4, guess I must have missed it! I like Joe's approach though, more my style =)
Re: Edit Product - Button
SCORE ! 
sadly, I didn't know it was down there until Judy pointed it out in this thread

sadly, I didn't know it was down there until Judy pointed it out in this thread

Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com