0

I have a situation where we need to cache a page unique to a location ID that is set to the member. This is a product listing page where there is an inventory lookup done based on the user's chosen location, so we need the page to cache based on said location vs just the category URL etc...

I would like to use the CE Cache "url_override" parameter, but I can't seem to get anything but a static value to work there.

Here's what I've tried:

 // Stash the member's zip

    {exp:stash:set name="the_location_tag"}
        {exp:cartthrob:customer_info}
            {shipping_zip}
        {/exp:cartthrob:customer_info}
    {/exp:stash:set}



 // Cache the page at URL with appended zip

    {exp:ce_cache:it 
        id="page" 
        tags="products|products-cat" 
        for="5 minutes" 
        url_override="shop/cat/{exp:stash:the_location_tag}"
    }

    {/exp:ce_cache:it}

But with this I get the page cached at: "shop/cat/expstashthe_location_tag/"

I've tried wrapping the CE Cache tag in {exp:stash:parse process="end"} but that didn't seem to make any difference.

How could I get this to work? Should I be using an embed or some other method?

1

Aha! Figured this out with an embed.

The parameter:

url_override="shop/{embed:this_product_cat_name}/{embed:this_members_location}"

The embed tag:

{embed="..." 
    this_product_cat_name="{segment_2}" 
    this_members_location="{exp:stash:the_location_tag}"
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.