If this is your first visit, check our documentation. To post, register or login.
Forums / Community Contributed Add-Ons / All Other Contributions/Addons / Adding to end of body for shipping cart page - Google Analytics

Adding to end of body for shipping cart page - Google Analytics

Started by susb8383 on 5 Jun 2011, 6:10 PM · Views: 1,156

Results 1 to 8 of 8
5 Jun 2011, 6:10 PM
#1
susb8383 avatar

susb8383

Zen Follower

Join Date:
Feb 2008
Posts:
129
Plugin Contributions:
0

Adding to end of body for shipping cart page - Google Analytics

Hi,

I want to add code to the end of the body section, but for a single page only, like the shopping cart.

I found great info on adding it to the bottom of the head tag for a single page (putting the code in /includes/modules/pages/shopping_cart/jscript_compete-com.php) but is there a similar kind of hook to add to the body, right before the end body tag?

Thanks, Susie

5 Jun 2011, 6:17 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Adding to end of body for shipping cart page - Google Analytics

  1. Find the name of your present template.
  2. go to /includes/templates/YOUR_TEMPLATE_NAME_HERE/ and create a new folder called shopping_cart
  3. Copy the /includes/templates/YOUR_TEMPLATE_NAME_HERE/common/tpl_footer.php file into that new shopping_cart folder.
    (If you don't have such a file in your YOUR_TEMPLATE_NAME_HERE/common folder, then copy the one from template_default/common instead.)
  4. Make any page-specific customizations to this new copy of the file.

Alternatively you could copy tpl_main_page instead of tpl_footer, but tpl_footer is less likely to be altered in upgrades so would be a simpler place to put your custom code.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

9 Jun 2011, 8:18 PM
#3
susb8383 avatar

susb8383

Zen Follower

Join Date:
Feb 2008
Posts:
129
Plugin Contributions:
0

Re: Adding to end of body for shipping cart page - Google Analytics

Hey, that worked! Thanks!

But it brings up an unrelated question...when I look at the page source of the shopping cart, I don't have an /body or /html at all. The last thing I see is the comment End mainWrapper.

Do you happen to know why this is?

Thanks, Susie

9 Jun 2011, 11:40 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Adding to end of body for shipping cart page - Google Analytics

Sounds like whatever you added caused the rest of the PHP execution to die with an error.

Errors don't display to the screen, for security reasons. You'll have to find the error by looking at the logs: https://www.zen-cart.com/tutorials/index.php?article=82

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

10 Jun 2011, 12:20 PM
#5
susb8383 avatar

susb8383

Zen Follower

Join Date:
Feb 2008
Posts:
129
Plugin Contributions:
0

Re: Adding to end of body for shipping cart page - Google Analytics

Hmm...it seems to be related to me creating the shopping_cart folder. After I undid my changes, I still got an error in the log that it can't find
shopping_cart//google_analytics.php

Note there are two slashes.

I should probably start a different thread, huh? Unless you happen to know the problem off the top of your head...

--Susie

10 Jun 2011, 6:27 PM
#6
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,748
Plugin Contributions:
0

Re: Adding to end of body for shipping cart page - Google Analytics

Moderator's note - thread has been moved and renamed for clarity.

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

10 Oct 2011, 5:15 PM
#7
mr_pibb avatar

mr_pibb

New Zenner

Join Date:
Jul 2009
Posts:
20
Plugin Contributions:
0

Re: Adding to end of body for shipping cart page - Google Analytics

susb8383:

Hmm...it seems to be related to me creating the shopping_cart folder. After I undid my changes, I still got an error in the log that it can't find
shopping_cart//google_analytics.php

Note there are two slashes.

I should probably start a different thread, huh? Unless you happen to know the problem off the top of your head...

--Susie

Did you figure out the double slash issue? I'm seeing the same problem.

29 Oct 2011, 6:11 PM
#8
susb8383 avatar

susb8383

Zen Follower

Join Date:
Feb 2008
Posts:
129
Plugin Contributions:
0

Re: Adding to end of body for shipping cart page - Google Analytics

Mr.Pibb:

Did you figure out the double slash issue? I'm seeing the same problem.

No, I never did.

Moderator, if you move and rename a thread, it would be really helpful if you included a link to it, or at the very least, tell us where you moved it to and what you renamed it to. Now I have to find it...

Thanks.