Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9111843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:35:50+00:00 2026-06-17T03:35:50+00:00

I have a situation that Tinybrick has referred to as advanced hole punching and

  • 0

I have a situation that Tinybrick has referred to as “advanced hole punching” and I can’t seem to get it to work. We recently installed the Subscriptions and Recurring Payments extension from Aheadworks. This extension allows customers to subscribe to products they buy on a regular basis and extends the functionality of the Recurring Profiles for PayPal. For this to work, the addtocart block on the product view pages needs to be dynamic. Depending on whether the customer is logged in and the specific details of the product in question determine what is displayed in the addtocart block.

Using the Lightspeed hole punching, I’ve been able to fill various dynamic blocks on the page (top links, header cart, related products, etc). The problem with this block is that it depends on the Mage::registry('current_product') value. When Lightspeed is returning a cached page, it doesn’t run the full Magento code, and the current_product registry value isn’t set. I can not find a way to make this work.

I sent an email to Tinybrick and got back the following response:

For advanced hole punching like this, you would have to make a call via API / SOAP in the Controller. Basically, you would make a call for whatever information you need, then use that information to display your dynamic content. I have personally never done it like this, but was informed by our lead developer that it can be done.

I responded asking for examples or more information but have not heard back yet. I figured I’d throw something up here to see if anyone has any experience with this and can offer some help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T03:35:51+00:00Added an answer on June 17, 2026 at 3:35 am

    When lightspeed.php sees a corresponding cache file in var/lightspeed directory, it loads it and parses. Now it sees, that some content needs to be dynamic. So lightspeed.php makes a fake GET request to Magento via Mage::run() with changed $_REQUEST['URI'] before. Take a look at the following code:

    lightspeed.php:

    self::report("attempting to retrieve hole punched content from {$data[2]}");
    $_SERVER['originalRequestUri'] = $_SERVER['REQUEST_URI'];
    $_SERVER['REQUEST_URI'] = self::$request_path . "/" . $data[2];
    

    You can see here how I copy $_SERVER['REQUEST_URI'] to $_SERVER['originalRequestUri']. Let’s go next and take a look at

    HoleController.php:

        $originalRequest = new Mage_Core_Controller_Request_Http('http://example' . $_SERVER['originalRequestUri']);
        $originalRequest->setPathInfo()->setDispatched(false);
        Mage::getModel('core/url_rewrite')->rewrite($originalRequest);
    
        $params = explode('/', $originalRequest->getPathInfo());
        /* IF YOU HAVE SOME ADDITONAL PARAMS PASSED AS /color/1/size/2, 
           THIS PARAMS SHOULD BE ALSO PARSED AND SET TO REQUEST OBJECT
        for ($i = 3, $l = sizeof($params); $i < $l; $i+=2) {
            $originalRequest->setParam($params[$i], isset($params[$i + 1]) ? $params[$i + 1] : '');
        }
        */
    
        if ($params[1] == 'product') { // if parsed URL is product view page URL
            $productId = $originalRequest->getParam('id');
            $product = Mage::getModel('catalog/product')->load($productId);
            Mage::register('current_product', $product);
        }
    

    Yay! Now we have current_product in registry. You’re able to create a block you need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to rails, and have a situation that I can't quite get
I have a somewhat unique situation that I can't quite get working. I've followed
I have a situation that I can't seem to find any help on. I
I have a situation that I can't seem to resolve. It is causing a
I have a situation that requires me to get the 12 past months in
I have an interesting situation that has me stumped. It seems that posting appliction/json
During work over a simple project I have found situation that I don't fully
I have a situation that I'm trying to make work with an array ,
I have a situation that I can not wrap my head around at the
In my program I have a situation that I can simplify to the following:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.