Help solving variable caching problem

Hello. I am trying to create an active state in the categories menu. I’ve edited the code as such:

  • {$category.category}

  • And the variables are cached, so if I click Category A, and then Category B, Category A remains highlighted (because the class remains in that LI) and acts as if it were the active category.

    How do I get my variables to refresh immediately? How do I avoid the caching issue?

    Thank you.

    You need to add your own javascript to change the display property.

    Are you saying “there is no solution to the caching problem; use javascript instead”?

    I guess I’m saying that your issue has nothing to do with caching… There is some other configuration issue. The options for a product should be stored individually within the cart. They should take on an initial value of whatever is first in the list (if it’s a select or radio type option). Hence if you want to save/store the values and then apply them to the options for different products then you will need to either modify the templates and php code to make the stored values available or use javascript to apply the previous selection.

    I’m dealing with categories.

    This is how I have edited the code:

    {assign var="cc_id" value=$smarty.request.category_id|default:$smarty.session.current_category_id}

  • {$category.category}

  • That works. If I click a Category A, then class=“cat-165 active”.

    If I click Category B, class of Category B is class=“cat-165”, class of Category A remains class=“cat-165 active”. My category_data.category_id is not updating.

    If I go to admin and do the admin.php?&cc cache refresh, and refresh my store front, then Category B class updates class=“cat-168 active”.

    It seems to me it’s a cache issue.

    Variables set in templates are not cached. Only items that are explicitly stored in the Registry are cached.

    What code do you have that handles the onclick event and sets the class of the id to what you want it to? That is your missing piece.

    On the style.css file, categories menu also has the class “visited”, maybe you could delete it and try again your code. Top menu doesn’t have this class set.

    There is no JavaScript.

    To make all things above true, the only thing that must be happening is that the sidebar does not get rewritten every time you click on a category. Only the content block updates. I guess that is what you are saying above and my answer is “I don’t know. I’m not using any code beyond the x_plain.tpl and CSS. I have to figure out the click.”

    How do I go about looking/finding the value of the side bar, and how do I make it write itself again every time it gets clicked or the content block is updated?


    Sandra, You problem requires much more research and unique support than what I can provide here in the forum. If you would like me to consult with you on this, contact me at (remove X’s) and we can discuss.

    Basically, most of these links have events associated with them that hide/select the proper element based on the selection. Since you are adding, there may not be an event associated with the element you’ve added hence you will need to add the appropriate event to both elements.