Jump to content

Hook module to a general CMS page


FlALo

Recommended Posts

Hi there

I am new in this forum and not sure whether this post is placed in the right thread. Please forgive me if not.

Currently I am setting up a new Prestashop web shop for my bike shop, we create a new 1.7.6.2 from scratch, abandoning our previous 1.4. legacy shop. I use a template I bought as starting point and now customize on. In this process, I have a quite specific picture on how my new website should look like - it should incorporate the web shop but also the information about the store etc (Team, Contact, Services etc..). I want to realize these general info pages with CMS sites, so far so good. Site is live under lorisvelos.ch - there is no links to it from anywhere so no disabling necessary.

I need help with one special case where I would like to have a CMS that serves as Gallery. Browsing addons.prestashop.com I found a module that allows to create a Instagram-Gallery and link to products on the current page, called shopable gallery. Best-Case scenario I would like to have this functionality on a individual CMS-Page that is linked in the megamenu. I know how to do that, no issue here, visualization in the pictures. 

My Problem now is, that all CMS pages are created from the same page.tpl file, and if I insert a hook there, all CMS pages will have this gallery. The Module offers "shortcode" functionality that is not further defined in the documentation, I suspect this could be a solution to my attempts, but I failed thus far to make it work.

Long story short: My question is, how can I use a module functionality on one specific CMS page, without influencing all the others.

------- ---------- -------- ---------- ---------- ------------

I'm currently in contact with the developer, I they are able to implement it. But I would really like to understand the process to better understand Prestashop's build and be able to solve such problems in the future for myself.

Although not having experience with implementing Prestashop myself, I'm not a total computer noob, having a brief history with coding myself as I used Java in my Education. I'm mentioning this to state that I'm not code-shy, but might need explanations especially with everything php-related.

 

Thank you, let me know if I need to provide more info!

Florian

 

ModuleShortcodeHook.png

Link to comment
Share on other sites

  • 2 weeks later...

Hi Vipul

Thank you very much for your hint, I will try it out.

One last question: Where do I put the "$gallery_id = $params['this_is_var'];" line? I know to put the {hook h='hookDsplayShoppable' this_is_var=10} into the page.tpl.

I suspect this is javascript code, so should I add a <script>$gallery_id = $params['this_is_var'];</script> to the html field of the CMS page in question?

Thanks again!

Edit: I'm continuing to research this problem online. I think it should be relatively easy to work around it with a simple if-statement filtering out the one CMS site I want, but I don't yet fully understand the .tpl/smarty, php and html interplay how to do that. Do I imagine that too simple? Cheers

 

ps. sorry for the late reaction, I was out cold last week 😕

 

 

Edited by FlALo (see edit history)
Link to comment
Share on other sites

Yes, there are several ways to resolve this issue, and your simplified version should work fine. In our research, for essayservicescanner.com we used a similar function. And it was precisely when moving the review along the Buyessayclub that some problems arose that I had to look for other options.

Edited by Amanavel (see edit history)
Link to comment
Share on other sites

On 1/27/2020 at 3:33 PM, FlALo said:

Hi Vipul

Thank you very much for your hint, I will try it out.

One last question: Where do I put the "$gallery_id = $params['this_is_var'];" line? I know to put the {hook h='hookDsplayShoppable' this_is_var=10} into the page.tpl.

I suspect this is javascript code, so should I add a <script>$gallery_id = $params['this_is_var'];</script> to the html field of the CMS page in question?

Thanks again!

Edit: I'm continuing to research this problem online. I think it should be relatively easy to work around it with a simple if-statement filtering out the one CMS site I want, but I don't yet fully understand the .tpl/smarty, php and html interplay how to do that. Do I imagine that too simple? Cheers

 

ps. sorry for the late reaction, I was out cold last week 😕

 

 

You need to put $gallery_id = $params['this_is_var']; in your hook function. e.g. public function hookDsplayShoppable(){}

Link to comment
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...