Jump to content
Sign in to follow this  
SureWeb

Hook to add content to product group page

Recommended Posts

Hi,

Is  there   a hook   so   that   I   can   add   content   to   a   product   group   page   eg.   cart.php?gid=1    so   that   the   content   shows   after   the   pricing   tables?

Thanks!
James

Share this post


Link to post
Share on other sites

Hi James,

13 hours ago, SureWeb said:

Is  there   a hook   so   that   I   can   add   content   to   a   product   group   page   eg.   cart.php?gid=1    so   that   the   content   shows   after   the   pricing   tables?

this will probably be dependent upon which orderform template you're using - if you're using Standard_cart, you should be able to use ShoppingCartViewCategoryBelowProductsOutput...

<?php

# Conditional Footer Output on Products Page Hook
# Written by brian! 
 
add_hook('ShoppingCartViewCategoryBelowProductsOutput', 1, function($vars) {
	
	if ($_GET['gid'] == '1') {
		return "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
	}
});

oWQteh3.png

obviously is this simple example, i'm just outputting Lorem Ipsum text, but you could equally use html code in there if that's the content you had in mind.

I don't think it would be supported in the other Comparison/Slider templates, nor with the old Modern or Boxes templates either... for those, you might need to edit the template, but it depends what the content you want to add it... because there could be ways to do it with language overrides and/or jQuery.

Share this post


Link to post
Share on other sites

Hi Brian,

Thanks for your reply.

Unfortunately it places   the   content   before   the   <!DOCTYPE>   even   if   I   change   the   template   to   Six   and   use   the   Standard   Cart   order   form.

Share this post


Link to post
Share on other sites

I   was   able   to   add   it   to   the   template   with

{if $smarty.get.gid eq 1}
<p>Hello!</p>
{/if}

But it   would be easier to keep track of edits with a hook.

Thanks!

Share this post


Link to post
Share on other sites
14 hours ago, SureWeb said:

Unfortunately it places the content before the <!DOCTYPE> even if I change the template to Six and use the Standard Cart orderform.

on any recent version, probably most of v7, it should work as shown... obviously, if you're using an older version of WHMCS, or custom templates that don't include the required template code, then as I said, it might not work and you'd need to edit the template.

though i'm surprised it outputted anything in the wrong place, perhaps there is a corruption in your hook code.

15 hours ago, SureWeb said:

I was able to add it to the template with, but it would be easier to keep track of edits with a hook.

using Smarty in the template will work, but what version of WHMCS are you using and which orderform template is assigned to this product group ??

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated