F22raptor Posted April 17, 2016 Share Posted April 17, 2016 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 Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 17, 2016 Share Posted April 17, 2016 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. Quote Link to comment Share on other sites More sharing options...
F22raptor Posted April 17, 2016 Author Share Posted April 17, 2016 I take it that involves money? Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 17, 2016 Share Posted April 17, 2016 Not at all. Just a willingness to follow instructions, learn from them, and not be afraid to ask questions. Ready to start? Quote Link to comment Share on other sites More sharing options...
F22raptor Posted April 17, 2016 Author Share Posted April 17, 2016 I am more than happy to direct funding towards any efforts to customise my already fantastic cubecart experience , only problem is I have none at the moment. Certainly interested though Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 17, 2016 Share Posted April 17, 2016 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. Quote Link to comment Share on other sites More sharing options...
F22raptor Posted April 17, 2016 Author Share Posted April 17, 2016 Fire away lets see what we can do Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 17, 2016 Share Posted April 17, 2016 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. Quote Link to comment Share on other sites More sharing options...
F22raptor Posted April 17, 2016 Author Share Posted April 17, 2016 First edit completed Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 17, 2016 Share Posted April 17, 2016 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} Quote Link to comment Share on other sites More sharing options...
F22raptor Posted April 17, 2016 Author Share Posted April 17, 2016 Ahh clever. Okay, the file /skins/foundation/templates/content.homepage.php has been edited and uploaded Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 17, 2016 Share Posted April 17, 2016 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 & 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. Quote Link to comment Share on other sites More sharing options...
F22raptor Posted April 17, 2016 Author Share Posted April 17, 2016 I have decided to not opt for adjusting the phrase to include the homepage, as the "Homepage Only" option is a perfect option. I have made the changes to /language/definitions.xml and uploaded the file Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 17, 2016 Share Posted April 17, 2016 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. Quote Link to comment Share on other sites More sharing options...
F22raptor Posted April 17, 2016 Author Share Posted April 17, 2016 Okay stand by Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 17, 2016 Share Posted April 17, 2016 We'll resume this no sooner than eight hours from now. Quote Link to comment Share on other sites More sharing options...
F22raptor Posted April 17, 2016 Author Share Posted April 17, 2016 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. Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 17, 2016 Share Posted April 17, 2016 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." Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.