Jump to content

Recommended Posts


I am developping a module and I've been searching a way to change on which combination of a product a customer will get by clicking on a product from the category page or a product slider.

I wanted to change the link dynamically with the hook actionGetProductPropertiesAfter, however it seems that it is cached so it can't be modified every time (I need the cache to be activated).

The solution I found, which is not satisfying at all, is to add some JS on the product page detecting if the attribute is the right one for the customer and if it is not, I redirect the customer to the right attribute. In details :

- I put a parameter in catalog/_partials_miniatures/product.tpl at the end of the product url.

- On my product page, I have some JS detecting if this parameter is set, if it is, then it checks for variables I send with Media::addJsDef(). If it isn't the attribute I want for this customer, then he gets redirected (at this moment the parameter in the url disappear)


Also, I wanted to add my variables with Media::addJsDef() in the hook actionFrontControllerSetMedia, but it is also cached. So I set them in the hook displayProductAdditionalInfo (which calls a tpl with my script there), it is worth noting that it works only because I have the module Page Cache, otherwise this hook is cached too and it would be impossible to do something dynamically. I know this is not clean, that's why I'd like to get a proper solution for this if possible, I can't seem to find one at the moment.

I hope i was clear enough.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More