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 AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

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

Rank: Advanced Member

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

Thanks: 122 times
Was thanked: 26 time(s) in 25 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. New Registrations are disabled.

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: 703

Thanks: 5 times
Was thanked: 113 time(s) in 112 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 Payne2 on 8/26/2021(UTC)
Joe Payne2  
#3 Posted : Thursday, August 26, 2021 5:53:40 AM(UTC)
Joe Payne2

Rank: Advanced Member

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

Thanks: 122 times
Was thanked: 26 time(s) in 25 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.