logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to forums.ablecommerce.com. Please use your AbleCommerce username and password to Login. Forums Registration.

Notification

Icon
Error

Options
Go to last post Go to first unread
Joe Payne @ AbleMods LLC  
#1 Posted : Wednesday, August 25, 2021 10:40:06 AM(UTC)
Joe Payne @ AbleMods LLC

Rank: Advanced Member

Groups: HelpDesk, Developers
Joined: 11/9/2018(UTC)
Posts: 489

Thanks: 82 times
Was thanked: 14 time(s) in 13 post(s)
I have a Facebook Pixel control that needs migrated to AC9.

Part of the control needs to know which page is being rendered so it can create the appropriate javascript required by Facebook.

But how do I tell if I'm on a product page, or a category page?

In Able Gold, I could pull in HttpContext.Current.Request and look at the Url property. It would contain the original (native) url before anything got converted to the actual url.

That isn't the case in Able v9.

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. Forums Registration.

shaharyar  
#2 Posted : Wednesday, August 25, 2021 3:09:16 PM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 555

Thanks: 2 times
Was thanked: 84 time(s) in 83 post(s)
You can use the following code

Code:
if (CurrentRequestData.PageData.PageType == PageDataType.Product)
{
}
thanks 1 user thanked shaharyar for this useful post.
Joe Payne @ AbleMods LLC on 8/26/2021(UTC)
Joe Payne @ AbleMods LLC  
#3 Posted : Thursday, August 26, 2021 5:53:40 AM(UTC)
Joe Payne @ AbleMods LLC

Rank: Advanced Member

Groups: HelpDesk, Developers
Joined: 11/9/2018(UTC)
Posts: 489

Thanks: 82 times
Was thanked: 14 time(s) in 13 post(s)
Works perfectly, thank you!

A helper class just for identifying application pages would sure be handy:
IsBasketPage()
IsPasswordReset()
IsCheckoutBilling()
IsCheckoutPayment()
IsReceiptPage()

That sort of thing. a LOT of these pixel/page tracking snippets are page-dependent.

I know WebpageController has IsReceiptPage() but would just be nice to have them all in one helper class.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.