-
Posts
379 -
Joined
-
Last visited
-
Days Won
18
Content Type
Profiles
Forums
Gallery
Downloads
Articles
Store
Blogs
Everything posted by Acer
-
Hi As we needed dynamic URLs in the Menu, CMS pages and TB HTML Block, and TB doesn't have this functionality natively out the box, I've decided to write a little 'workaround' / solution to try and fix this issue (at least temporarily until TB one day does this natively). Solution: Static URLs to Dynamic URLs maker + Smarty Tags in CMS, Menu and TB HTML Block The problem with static URLs is that they are a pain to maintain especially if everything you added to the site in the CMS is saved as a Static URL... So if you need to move the site from Local -> Staging -> Live and to another domain, you're going to have a bit of a problem. I've had to 'fix' this for the Top Menu, CMS page and TB HTML Block This solution also allows you to 'call' Smarty variables in the Admin BO CMS, Top Menu and TB HTML Blocks. How does it work and how to use? Add the code to either blocktopmenu.tpl, blockcms.tpl in your template file or tbhtmlblock.tpl - replacing the content generator: either {$MENU} or {cms->content} or {$customblock} Specify on which page (Menu/CMS/TB HTMLBlock) the code needs to appear {$MENU} or {cms->content} or {$customblock} The code replaces the "content generation" for the target page / section You need to specify the Static URLs you want to replace (remember to do this wherever the script is added). Static URLs normally for Local, Staging or Old Live addresses (can add 3 more if required) If you know what the Staging and Live Locations are going to be beforehand, then you do not need to update this again after the site has been moved / re-deployed. You can call a predefined Smarty variable in the Menu, CMS or TB HTML Block using the Smarty tag identifier {$content_dir} for example. When you add a link, you can either just use the full static path (as previously specified), or use the Smarty variable {$content_dir}blog/link-to-page If you add an image via the CMS RTE or even a link to an image, it will identify the Static URL and replace it with the Dynamic URL as set by $content_dir. So if you move the site to another address, all your Static URLs (if specified in the Menu, CMS or TB HTML Block) will be automatically updated - with no maintenance required from your side. Credits: This would not be possible without FullCircles - who way back in 2014, came up with the base solution. I've just modified it a bit. https://www.prestashop.com/forums/topic/372976-global-smarty-variables-used-in-cms-content/?tab=comments#comment-1855331 https://www.prestashop.com/forums/profile/720051-fullcircles/ Datakick supplied the correct Smarty variable name to be used as "BaseUrl" $content_dir Hope it helps. Instructions: Insert the following code in either "nameoftemplate/" blocktopmenu.tpl or blockcms.tpl or modules/tbhtmlblock/views/templates/hook/tbhtmlblock.tpl And make sure that it replaces the "page content generator" {$MENU} or {cms->content} or {$customblock} Configure as mentioned previously I've included a 'tester' code you can add to a CMS page to test that it's working properly Main Script (for tpl files): {* /// STATIC TO DYNAMIC URL MAKER - with 'Dynamic Tags' / 'Fake' Smarty Variables Functionality /// * v1.1 - last updated: 11/10/19 * To be used on BO Admin pages where Dynamic URLs are required * Automagically Replaces Static URLs on Runtime with 'dynamic' URL based on $content_dir * So if your site is on Local, Staging, Live or has been moved, this script has you covered * If you know what the Staging and Live Locations are going to be beforehand, then you do not need to update this again after the * site has been moved / re-deployed. * Just remember to change the 'Static URL Sources' whereever you've included this script * * CAVEAT: This does not save the updated safe URLs, it just replaces them on run-time for the front-end. * CAVEAT: The links and images pointing to the old URLS will still be 'broken' in BO Admin CMS until manually updated. * * Allows for the use of limited Smarty variable 'printing' within the 'code location' (CMS,TB HTML Block,Menu,etc) * I.e. using {$content_dir} in a CMS page will now work (like in a TPL file) * This code should be placed on the Target location's TPL file like "blocktopmenu.tpl, blockcms.tpl" within your theme * or for the TB HTML Block: modules/tbhtmlblock/views/templates/hook/tbhtmlblock.tpl * The Code Location must be changed accordingly below * Extendable by adding more Smarty variables or code locations * Note: If you want to have 'BaseUrl in a TPL page, just use the normal Smarty var $content_dir as this script is built for BO Admin pages * ie. <a href="{$content_dir}info/link-to-cms-page">cms page link</a> * * Credit to FullCircles for initial 'BaseURL' solution back in 2014. Without you, we'd be f'ed. Thanks bro :D * https://www.prestashop.com/forums/topic/372976-global-smarty-variables-used-in-cms-content/?tab=comments#comment-1855331 * https://www.prestashop.com/forums/profile/720051-fullcircles/ * * Credit to Datakick for the Smarty variable for the correct site domain path: $content_dir * * // To use: * Adjust the settings (values) below and add Smarty variables etc if you require * Replace the page's content generator tag, i.e. $cms->content, with this entire script block. * Refresh Cache * Static URLs as specified should now be replaced and 'dynamic' tags should be displayed * Note: the URLs come with a trailing slash (pagename/) so keep that in mind * *} {* /// Initial build, do not modify this one - Creates 6 available Static URL slots if you need them /// *} {assign var=s2d_specifysourceurls value=['placeholder-donotchangethis0','placeholder-donotchangethis1','placeholder-donotchangethis2','placeholder-donotchangethis3','placeholder-donotchangethis4','placeholder-donotchangethis5','placeholder-donotchangethis6']} {* /// /// *} {* /// Set Static URL Sources (array with 3 values for now - supports up to 56): /// - Remember to include trailing slash (pagename/) - Example array currently set for Local, Staging, Live Old - Example: {$s2d_specifysourceurls[0] = 'http://localhost/siteaddress/'} *} {* /// Set Local Address Source - Change this /// *} {$s2d_specifysourceurls[0] = 'http://localhost/siteaddress/'} {* /// Set Staging Address Source /// *} {$s2d_specifysourceurls[1] = 'http://www.stagingaddress.com/'} {* /// Set Old Live Address Source /// *} {$s2d_specifysourceurls[2] = 'http://www.liveaddress-old.com/'} {* /// Extendable if required - up to 6 available slots: (0-5) //*} {* {$s2d_specifysourceurls[3] = 'http://www.emptyslot4.com'} {$s2d_specifysourceurls[4] = 'http://www.emptyslot5.com'} {$s2d_specifysourceurls[5] = 'http://www.emptyslot6.com'} *} {* /// Set Dynamic URL source, leave as $content_dir for dynamic URL. Only 1 URL required /// *} {assign var=s2d_url_maker_target value="{$content_dir}"} {* /// Set Code Location /// - Set the Code Location by changing the value below accordingly: - CMS page: {$cms->content} - TB HTML BLOCK: {$customblock} - MENU: {$MENU} *} {assign var=s2d_url_maker_code_location value="{$MENU}"} {* /// Generator that does the work: /// - You can add more variables to the beginning of the source and target arrays below if required - Default list of available Smarty variables: - $content_dir, $base_uri, $base_dir, $base_dir_ssl, $img_dir (template img dir bytw), - $page_name, $logo_url, $shop_name, $shop_phone *} {* /// Generator /// *} {str_replace( array('{$content_dir}','{$base_uri}','{$base_dir}','{$base_dir_ssl}','{$img_dir}','{$page_name}','{$logo_url}','{$shop_name}','{$shop_phone}',$s2d_specifysourceurls[0],$s2d_specifysourceurls[1],$s2d_specifysourceurls[2],$s2d_specifysourceurls[3],$s2d_specifysourceurls[4],$s2d_specifysourceurls[5]), array($content_dir,$base_uri, $base_dir, $base_dir_ssl, $img_dir, $page_name, $logo_url, $shop_name, $shop_phone, $s2d_url_maker_target,$s2d_url_maker_target,$s2d_url_maker_target,$s2d_url_maker_target,$s2d_url_maker_target,$s2d_url_maker_target), $s2d_url_maker_code_location )} {* /// *** *** /// *} Tester Code: <h2>Static 2 Dynamic URL Maker with Limited 'Smarty' Tags in CMS Tester</h2> <br/> <b>Static URL Locations to be updated:</b> <br/> <br/> <b>Local: </b> http://localhost/siteaddress/ <br/> <b>Staging: </b> http://www.stagingaddress.com/ <br/> <b>Live old/prev: </b> http://www.liveaddress-old.com/ <br/><br/> <b>Smarty variable print:</b> <br/> <br/> <b>$content_dir:</b> {$content_dir} <br/> <b>$base_uri:</b> {$base_uri} <br/> <b>$base_dir:</b> {$base_dir} <br/> <b>$base_dir_ssl:</b> {$base_dir_ssl} <br/> <b>$img_dir:</b> {$img_dir} <br/> <b>$page_name:</b> {$page_name} <br/> <b>$logo_url:</b> {$logo_url} <br/> <b>$shop_name:</b> {$shop_name} <br/> <b>$shop_phone:</b> {$shop_phone} Script not active yet: Script activated, Static URLs + Smarty Tags updated + Menu Links updated
- 2 replies
-
- 2
-
-
- smarty tags in cms
- dynamic urls
- (and 4 more)
-
Thanks for the feedback and variable, datakick... Static URLs... it's like being back in the 90's... ๐ TB is a great eCommerce platform (like amazing) from what we can tell so far, but not so great in terms of CMS functionality (fairly dated and primitive CMS component and RTE - imo)... Especially in terms of content maintenance and being compared to a platform like Joomla (with regards to CMS) oh... and Module Positions! (let's not even think of comparing the ease of creating new module positions and placing modules anywhere in Joomla vs TB)... {loadposition anymodulehere}. And no, Joomla sucks at being a vanilla eCommerce platform (without plugins like VirtueMart). Because it isn't one.. so no comparison there, but in terms of its CMS functionality... it's pretty advanced... It makes life easier for both the developer as well as the 'site runner' content person... We were so focused on evaluating the eCommerce functionality of TB and making sure that the platform suited our needs, that we didn't think to consider the fact that the CMS component could be lacking... Especially in terms of link and image maintenance. We just assumed (lol, my bad, ouch) that the CMS functionality would be on par and modern... If the site is ever moved to another domain... ah the pain... ๐คจ Unfortunately static URLs won't do. I've been trying to work on a 'solution' / workaround that I will be sharing shortly if it works. But not ideal, no... I wonder if this magical problem affects the FileManager as well... ah sh*t it does... ๐ญ
-
[Solved] How to prevent Javascript code from being wrapped in CDATA?
Acer posted a question in Technical help
Hi How do I prevent / turn off CDATA wrapping of JS code? I've tried turning off HTMLPurifier, yet my JS code is still being wrapped by CDATA. I need to turn this off as we've encountered issues with Google Console complaining about FAQ Schema code being wrapped in CDATA. If you unwrap the schema code from CDATA, then Google is happy. Bytw this is from a CMS page (after implementing Vekia's TinyMCE enhancements to allow for script tag to be used on CMS page) <script>// <![CDATA[ console.log("hello"); // ]]></script> Vekia's Extended TinyMCE enhancements https://mypresta.eu/en/art/prestashop-16/extended-rich-text-editor.html -
Hi Traumflug, thanks for comment about the code. For me, and it appears for others as well, this is an actual problem, as resizing the browser window or clicking on another menu item to collapse the menu just feels unnecessary and frustrates the UX. In terms of the 'workaround' that you mentioned: as it seems that this problem has been around since many previous versions of PS 1.6 (if I recall) and TB - it appears that no one has come around to it as yet... Can you perhaps show us the workaround you suggested and where to update the code to implement? As it's so 'easy', and as the menu system is already pretty complex... many of us here are not as familiar with the system as yourself and the other senior TB devs here. Hence the reason I went with my 'solution' to fix this issue. For me, this solved a real problem and is nice to use until a better solution becomes available. Your workaround would be appreciated. Also, as the default behavior when a menu item is active, is to expand the submenu, not hover, thereby giving feedback on which sub item you're on (without having to hover on the parent menu item) - it's going to be interesting to see how your suggestion behaves / functions when it's implemented.
- 7 replies
-
- 2
-
-
- admin menu
- expand contract
-
(and 2 more)
Tagged with:
-
Hi As I'll be moving the site from Local to Staging to Live, and do not want to use hardcoded static URLs for my links and images, I need to use some sort of baseURL (from what I can gather). I've noticed that smarty has $base_dir, $base_dir_ssl and $base_uri? As the different environments have different SSL setups (some with and some without), should I not just use base_uri? What exactly is base_uri and can I use it as a good baseURL identifier that changes according to the domain the site is on? Also, if the user adds an image to a CMS page on one environment (the normal way by using TinyMce and not a baseUrl 'enchancement'), does that path need to be updated again manually when the site is moved to another domain?
-
Hi guys Problem: One some menus, screen resolutions and window sizes: I've encountered a niggling issue in the Admin menu (for me at least), where long Admin menu items can cause the next menu items to not be reachable (as there is no expand / contract or scrolling functionality on the menu). The only way to access the menu items below this menu (as far as I know) is to literary go to another menu item to force the large one to contract (wtf). Solution: For me this hampers the user experience a bit. And maybe because I'm used to accordion menus... To make my life easier, I've written a little jQuery solution that can be added to the Admin menu js. This solution creates an expand / contract icon next to an Active menu item (that has a submenu and when the menu is not in the collapsed state). And without having to navigate to another menu item, it expands / contracts the active menu accordingly. The hover / fly over menu is still available. This is my first attempt at writing some code for TB, and I've decided to share it with the community. Hope it provides some value. Instructions Go to admin***\themes\default\js\admin-theme.js Find: function navSidebar() { var sidebar = $('#nav-sidebar'); sidebar.off(); $('.expanded').removeClass('expanded'); $('.maintab').not('.active').closest('.submenu').hide(); After $('.maintab').not('.active').closest('.submenu').hide(); insert the following code: /// Expand Contract Icon for Active Admin Menu Items /// // Set text for expand / contract tooltip var tooltipcontract = 'Contract dropdown menu'; var tooltipexpand = 'Expand dropdown menu'; var expandicon = '+'; var contracticon = '-'; // Finds active admin menu item and generates expand/contract icon element in opened state $('.maintab.active.has_submenu').find('a:eq(0)').append('<div class="expandcontracticon expandcontracticon-open" title="' + tooltipcontract + '">' + contracticon + '</div>'); $('.expandcontracticon').attr('style', 'background-color: #2F3237; width: 10%; float: right; margin-right: 5px; display: block; text-align: center; font-weight: bold;'); // Binds expand / contract functionality to icon $('.expandcontracticon').on('click', function (e) { // Prevents the menuitem a element from opening the default link when the icon is clicked: e.preventDefault(); /// Ensures all submenus are hidden $('.maintab').removeClass('active'); $('.maintab').removeClass('hover'); // Checks open/closed state: var checkifopen = $(this).hasClass('expandcontracticon-open'); // Does sub menu work on menu item for active and not active states // Changes icon's +- text and title tooltip depending on state if (checkifopen == true) { // If the current state is opened, close the submenu and display 'expand/+' state $(this).html(expandicon); $(this).removeClass('expandcontracticon-open'); $(this).addClass('expandcontracticon-closed'); $(this).attr('title', tooltipexpand); } else { // If the current state is closed, show the submenu and display 'contract/-' state $(this).html(contracticon); $(this).parent('a').parent('li').addClass('active'); $(this).removeClass('expandcontracticon-closed'); $(this).addClass('expandcontracticon-open'); $(this).attr('title', tooltipcontract); } }); // Checks if the Sidebar is collapsed and hides / shows icon accordingly // Check on page load $('.page-sidebar-closed').find(".expandcontracticon").hide(); $("body").not('.page-sidebar-closed').find(".expandcontracticon").show(); // Check on Toggle Sidebar menu button action and hides the icon as it's not required on collapsed sidebar // Slight timeout to allow for page-side-bar-closed class to be applied first sidebar.find('.menu-collapse').on("click", function () { setTimeout(function () { $('.page-sidebar-closed').find(".expandcontracticon").hide(); $("body").not('.page-sidebar-closed').find(".expandcontracticon").show(); }, 100); }); /// *** *** /// Save, refresh and party ๐ Hope it helps ๐
- 7 replies
-
- 1
-
-
- admin menu
- expand contract
-
(and 2 more)
Tagged with:
-
Great, thanks - I assume the "home" fix is going to be included in future Naria / TB release?
- 9 replies
-
- solved
- temporary solution
-
(and 1 more)
Tagged with:
-
[Answered] Please help: Add FileManager link to Admin Menu / Access FileManager directly?
Acer replied to Acer's question in Technical help
Thanks for clarifying. Would be cool to have this separate in the future though (not that it's a big one, just a nice to have). Will instruct our users to access it through a CMS page in the meantime. Thanks- 2 replies
-
- filemanager
- admin menu
-
(and 1 more)
Tagged with:
-
Question: Admin ShortCodes? BaseURL for static pages or TB Blog URLs?
Acer replied to Acer's question in Technical help
Thanks for the feedback... Darn, this kinda sucks. Will create feature request in near future...- 12 replies
-
- basurl
- 30bz blog static urls
-
(and 1 more)
Tagged with:
-
Question: Admin ShortCodes? BaseURL for static pages or TB Blog URLs?
Acer replied to Acer's question in Technical help
Is there no way to include this baseUrl or ShopUrl in a tag somehow that we can then reuse wherever in Admin (product edit, URL link)? Similar to Smarty's {$baseurl} As creating static links to blog posts for example is going to become very difficult to maintain imo...- 12 replies
-
- basurl
- 30bz blog static urls
-
(and 1 more)
Tagged with:
-
Question: Admin ShortCodes? BaseURL for static pages or TB Blog URLs?
Acer replied to Acer's question in Technical help
Hi To clarify: This is in the context of adding a static link to a blog post in the Main Menu (Admin) or anywhere else in Admin. So whether I'm on the 'Edit product details page' or creating a link in the Main Menu to a static blog post URL, I'd like to be able to do the following: {baseurl}/blog/blog-post-name- 12 replies
-
- basurl
- 30bz blog static urls
-
(and 1 more)
Tagged with:
-
Question: Admin ShortCodes? BaseURL for static pages or TB Blog URLs?
Acer replied to Acer's question in Technical help
Hi I've tried your suggestion, but still not working...- 12 replies
-
- basurl
- 30bz blog static urls
-
(and 1 more)
Tagged with:
-
Question: Admin ShortCodes? BaseURL for static pages or TB Blog URLs?
Acer replied to Acer's question in Technical help
Hi Because the URL you've given will give you a 404 on Local (takes you all the way to the localhost root) My test blog post name is 'this-is-a-test'. So using your URL it would be /blog/this-is-a-test: Also, if you try something like this (no initial forward slash): blog/this-is-a-test It works until you browse the site for a bit, then try to access the link on the menu again - then you get this:- 12 replies
-
- basurl
- 30bz blog static urls
-
(and 1 more)
Tagged with:
-
Hi As there are many PS 1.6 and TB experts here, I'm wondering if you guys mind sharing some ThirtyBees and Prestashop 1.6 Secrets and great tips / resources? As I'm still learning, I'm constantly looking for great tips and insights into this awesome e-commerce platform (a well deserved kudos to the team and administrators bytw ๐ ) I've found some great tutorials by @Nemo, @lesley and @Vekia (PS 1.6). However, I'm hungry for more hidden and secret tips to help me and by extension, the TB community on our ThirtyBees journey. A nice example would be PS 1.6 and TB Secret Tips, "PS 1.6 Master Course", Admin shortcodes (if they exist ๐ ) and more. I'm currently working on a TB project for work, so a bit busy on this side, but I've encountered a few useful shareable tips / tricks while looking for specific project solutions. In the spirit of sharing and strengthening the knowledge base, I will endeavor to share whatever useful tips I encounter along the way - when I have the time in between focusing on the project. Also, regarding Free Modules, perhaps we can have a Free Modules Section on the Forum (not the market place)? Nemo Tutorials and Tips and Tricks: http://nemops.com/prestashop-101-series/ http://nemops.com/category/tutorials/tips/ http://nemops.com/category/tutorials/basics/ http://store.nemops.com/5-free-modules (modules) https://www.youtube.com/user/NemoPostScriptum/videos (Nemo's Channel on YouTube - great video resource) Vekia (MyPresta, the original): https://mypresta.eu/en/art/prestashop-16/ https://mypresta.eu/en/art/tips-and-tricks/ https://mypresta.eu/en/art/know-how/ https://mypresta.eu/prestashop/tag/for-free/ (modules) DH42 (Lesley) https://dh42.com/blog/ https://dh42.com/free-prestashop-modules/ (modules)
-
Question: Admin ShortCodes? BaseURL for static pages or TB Blog URLs?
Acer posted a question in Technical help
Hi I've been creating static links to TB Blog pages on the Main Menu, but because I'm working on three different environments, the base URLs will be different. So when I move the site from Local to Staging and eventually to Live, I'll need to remember to update the base URLs every time. I've noticed in the SEO section that there are a few "shortcodes" being used, like: {categories:/}{rewrite}{/:selected_filters} Is there one for baseurl that can be used for a URL in Menu admin? Like: URL: {baseurl}/blog/myblogpostpage Also, is there a list of all the 'secret' shortcodes for PS 1.6 / TB for Admin (even product admin)? I'm aware of some nice Smarty variables for the front-end, but here I'm specifically interested in something similar for the BO Admin.- 12 replies
-
- basurl
- 30bz blog static urls
-
(and 1 more)
Tagged with:
-
Hi Is there a way to access the FileManager directly, i.e. add a link to it in the Admin Menu? I know you can access it through a CMS page, but this feels like an unnecessary run around. Is there a more direct way? I tried creating an Admin Menu item, but not sure what the class is and I'm getting Controller not found...
- 2 replies
-
- filemanager
- admin menu
-
(and 1 more)
Tagged with:
-
Hi Zen This works, thank you. Although with the caveat that it's a temporary, Naria specific issue as you mentioned. Hopefully it get's sorted in future release. Thanks again.
- 9 replies
-
- solved
- temporary solution
-
(and 1 more)
Tagged with:
-
Hi Using 30Bz 1.1.0 Naria theme: On a Blog Post: It seems that the images for related products are not being displayed... I see this has been asked here as well - any solution? https://forum.thirtybees.com/topic/3505-niara-theme-glitches-discussion/?tab=comments#comment-30768 Note: this appears to be working in the Community Default theme though. Screenshot of it not working in Naria:
- 9 replies
-
- solved
- temporary solution
-
(and 1 more)
Tagged with:
-
Thanks, datakick, I appreciate it ๐ Regarding my other requirements: For "Contact form on Product page" - I've been following Nemo's PS tutorial: "Ajax Contact Form on Contact Page" For the most part, it appears to be working - but further testing is required - it seems I may have to modify the error state in the jQuery, but so far so good. For now it seems like it's working ๐ https://www.prestashop.com/forums/topic/564724-creating-an-ajax-contact-form-on-the-product-page/ http://nemops.com/prestashop-ajax-contact-form/#.XYN8VSgzaUl Just a question regarding "Adding a new field to the Contact Form": I've found Nemo's Tutorial, but not sure if it will still work... I will try to implement, but could be a while before I provide feedback... Is there a better or easier way to do this? http://nemops.com/adding-new-fields-to-prestashop-contact-form/#.XYOCMCgzaUk
- 9 replies
-
- 30bz is awesome :)
- customer service system
-
(and 1 more)
Tagged with:
-
Ok wow... I've check it out, turns out it's not just a simple "Contact form sending a mail" module. No, it's a fully fledged "Customer Service System" with tickets, 'reply direct from system', messages timeline, and more. Wow... ๐ค Sure, a built-in Captcha system would've been a nice addition (not to mention adding fields from the BO admin - I'm pushing it, I know ๐) + I need to figure out how to leverage this on the product page, but still... Much more than I expected! 30Bz continues to impress! ๐
- 9 replies
-
- 30bz is awesome :)
- customer service system
-
(and 1 more)
Tagged with:
-
Awesomeness! Thanks Piet, I appreciate it ๐
- 9 replies
-
- 1
-
-
- 30bz is awesome :)
- customer service system
-
(and 1 more)
Tagged with:
-
Can someone please help with this question?
- 9 replies
-
- 30bz is awesome :)
- customer service system
-
(and 1 more)
Tagged with: