Jump to content

Facebook social plug in not showing on some document pages


F22raptor
 Share

Recommended Posts

I have the facebook social plug in installed, and have set it to appear at the bottom of all the site DOCUMENT pages.

The Facebook button appears at the bottom on all site documents - except the contact page (which is fine) and the homepage document - which is really the only place I NEED it to be.

and idea why it displays on all document pages except the homepage? Or even know how to tweak it so it only appears on the Homepage document?

Thanks

Tom

Link to comment
Share on other sites

Welcome F22raptor! Glad to see you made it to the forums.

Technically, the "HomePage" document is an editable document, but CubeCart does not consider the HomePage document as a Site Document. Otherwise, the HomePage would show listed in the series of Site Documents at the bottom of the page.

We can certainly develop the means for you to show this social button on the HomePage.

 

Link to comment
Share on other sites

But are you ready to start?

You will need a programmer's text editor (Notepad++ or EditPad Lite is what I recommend) and a means to retrieve and send files to/from your hosting site (some kind of FTP program). Your hosting control panel may have an editor for you to use.

 

Link to comment
Share on other sites

Examine the file /classes/cubecart.class.php at these line numbers (for CC6011):

Document: 342-345
Product: 2545-2548
HomePage: 137

/* Social Bookmarks */
$GLOBALS['smarty']->assign('SHARE', $this->_getSocial('product', 'getButtonHTML'));
/* Social Comments */
$GLOBALS['smarty']->assign('COMMENTS', $this->_getSocial('product', 'getCommunityHTML'));

In the code above, the call to $this->_getSocial() has an argument that specifies where the social button is going to go: 'document' or 'product'. But the code for the homepage doesn't have this code.

So, the first edit will be to add it.

In /classes/cubecart.class.php, near line 139, find:
$content = $GLOBALS['smarty']->fetch('templates/content.homepage.php');

On a new blank line ABOVE that, add:

/* Social Bookmarks */
$GLOBALS['smarty']->assign('SHARE', $this->_getSocial('homepage', 'getButtonHTML'));
/* Social Comments */
$GLOBALS['smarty']->assign('COMMENTS', $this->_getSocial('homepage', 'getCommunityHTML'));

Send the file back to your site.

Link to comment
Share on other sites

Next, we will edit the skin templates.

Examine the file /skins/foundation/templates/content.document.php. Find:

{if $SHARE}
<hr>
<div class="row">
   <div class="small-12 columns">
      {foreach from=$SHARE item=html}
      {$html}
      {/foreach}
   </div>
</div>
{/if}
{foreach from=$COMMENTS item=html}
{$html}
{/foreach}

Then examine the file /skins/foundation/templates/content.product.php. Find:

   {if $SHARE}
   <hr>
   {foreach from=$SHARE item=html}
   {$html}
   {/foreach}
   {/if}
   <hr>
   {include file='templates/element.product_reviews.php'}
   {foreach from=$COMMENTS item=html}
   {$html}
   {/foreach}

Now, we will edit the file /skins/foundation/templates/content.homepage.php. Find:

   {$DOCUMENT.content}
</div>
{/if}
{if $LATEST_PRODUCTS}

We will put a slight variation of the code we've looked at in the other two templates here.

   {$DOCUMENT.content}
</div>
{/if}
   {if $SHARE}
   <hr>
   {foreach from=$SHARE item=html}
   {$html}
   {/foreach}
   {/if}
   {if $COMMENTS}
   <hr>
   {foreach from=$COMMENTS item=html}
   {$html}
   {/foreach}
   {/if}
{if $LATEST_PRODUCTS}

 

Link to comment
Share on other sites

Next, we need to add a new phrase to the language pack. Unfortunately, there is no easy way to do this. Ideally, the file /language/definitions.xml must not be directly edited. But we will do so anyway.

In /language/definitions.xml, find near line 1398:

    <string name="social_location" introduced="5.0.0"><![CDATA[Where to show]]></string>
    <string name="social_location_all" introduced="5.0.0"><![CDATA[Product Detail &amp; Site Documents]]></string>
    <string name="social_location_product" introduced="5.0.0"><![CDATA[Product Detail Only]]></string>
    <string name="social_location_document" introduced="5.0.0"><![CDATA[Site Documents Only]]></string>

On a new blank line AFTER, add:

    <string name="social_location_homepage" introduced="5.0.0"><![CDATA[HomePage Only]]></string>

We can also adjust the phrase for the "social_location_all" to include the HomePage, but that's up to you.

 

Link to comment
Share on other sites

This should be the last edit. There may be a tweak needed, however.

In the file /modules/social/Facebook/skin/admin/index.tpl, find:

		<select id="location" name="module[like_location]" class="textbox">
			<option value="all" {$SELECT_like_location_all}>{$LANG.module.social_location_all}</option>
			<option value="product" {$SELECT_like_location_product}>{$LANG.module.social_location_product}</option>
			<option value="document" {$SELECT_like_location_document}>{$LANG.module.social_location_document}</option>

On a new blank line AFTER, add:
			<option value="homepage" {$SELECT_like_location_homepage}>{$LANG.module.social_location_homepage}</option>

This adds the option to choose the HomePage as the section to to show the social media button.

In admin, Maintenance, Rebuild tab, select 'Clear Cache' and Submit. This will have Cubecart rebuild the language array from the edited language file. Also, since we edited a skin template, clearing the cache will force the template rendering engine to make another finalized HTML file from that template.

Link to comment
Share on other sites

Okay interesting outcome so far, the facebook module is now correctly placed on the homepage!..However, the option to select only the homepage isn't coming up in the drop down box in my admin panel.

Further, the facebook module only appears on the homepage when I select "product detail and site documents" option, aka:

<option value="all" {$SELECT_like_location_all}>{$LANG.module.social_location_all}</option>

The "Homepage only" option in the drop down box in the admin panel is not actually appearing at all, even though I added it to index.tpl

Please see the attached image, it shows the "Homepage Only" option missing, as well as what option DOES make it show on the homepage (of all things).

The "Product detail & site documents" option will display the module on Product detail, site documents AND the homepage.

- Product detail only shows it on products as designed and
- site documents shows on site documents as designed.

Screen Shot 2016-04-17 at 16.32.49.png

Link to comment
Share on other sites

Please review the edit to the file /modules/social/Facebook/skin/admin/index.tpl near line 28.

There is also a very similar set of statements near line 61 which is for the Comments chooser. It's up to you if you want that as well.

There was the option to change the language phrase, but:

"I have decided to not opt for adjusting the phrase to include the homepage, as the "Homepage Only" option is a perfect option."

 

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

 Share

×
×
  • Create New...