Jump to content

[Solved] Page with downloadable freebies


Recommended Posts

you can upload files anywhere you want, for example - you can create new directory and then upload files there. Everything depends on you :)

 

in tinymce (wysiwyg) editor you can easily add own pictures. Editor looks like text processor like word / libreoffice. it's easy in use.

  • Like 1
Link to comment
Share on other sites

when you go to the preferences > CMS you can create new page there, just click on add new page button, you've got there editor:

 

vVWeM70.png

 

as you can see, there is many options to customize content (own pictures also)

Link to comment
Share on other sites

I will try that, vekia, as soon as I can get back into my shop. I am testing another installation on a localhost, logged out and now cannot get back in - forgot my password and don't know where to start looking. Hopefully I will be able to access my back office soon.

Link to comment
Share on other sites

I thought it funny - getting a handle hahaha!

 

Thanks for the link, Benjamin!

 

Benjamin, you are a super star - thank you!

 

vekia, thanks so much for that tutorial - you, too, are a super star!

 

I am back in the BO and will now try again...

 

I have looked at this tutorial from Nemo, but cannot find the javascript he is talking about.

 

This is the only reference in the form.tpl to tinymce - line 391:

 

[size=4]{if isset($tinymce) && $tinymce}[/size]
<script type="text/javascript">

var iso = '{$iso}';
var pathCSS = '{$smarty.const._THEME_CSS_DIR_}';
var ad = '{$ad}';

$(document).ready(function(){
{block name="autoload_tinyMCE"}
tinySetup({
editor_selector :"autoload_rte"

});
{/block}
});
</script>
{/if}

Edited by Benjamin Utterback (see edit history)
Link to comment
Share on other sites

there is:

tinySetup({
editor_selector :"autoload_rte"
});

 

use this:

 

tinySetup({
editor_selector :"autoload_rte"
	  theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,fontselect,fontsizeselect",
	  theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,codemagic,|,insertdate,inserttime,preview,|,forecolor,backcolor",
	  theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
	  theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,visualblocks",
	  theme_advanced_toolbar_location : "top",
	  theme_advanced_toolbar_align : "left",
	  theme_advanced_statusbar_location : "bottom",
	  theme_advanced_resizing : false,
		    extended_valid_elements: \'pre[*],script[*],style[*]\',
		    valid_children: "+body[style|script],pre[script|div|p|br|span|img|style|h1|h2|h3|h4|h5],*[*]",
		    valid_elements : \'*[*]\',
		    force_p_newlines : false,
		    cleanup: false,
		    forced_root_block : false,
		    force_br_newlines : true
   });

Link to comment
Share on other sites

sorry it was my mistake!!!!

 

i tested code after little modifications, now it works!

check: tinymce editor + extended version + javascript/ html support

 

editor_selector :"autoload_rte",
			  theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,fontselect,fontsizeselect",
			  theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,codemagic,|,insertdate,inserttime,preview,|,forecolor,backcolor",
			  theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
			  theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,visualblocks",
			  theme_advanced_toolbar_location : "top",
			  theme_advanced_toolbar_align : "left",
			  theme_advanced_statusbar_location : "bottom",
			  theme_advanced_resizing : false,
						extended_valid_elements: 'pre[*],script[*],style[*]',
						valid_children: "+body[style|script],pre[script|div|p|br|span|img|style|h1|h2|h3|h4|h5],*[*]",
						valid_elements : '*[*]',
						force_p_newlines : false,
						cleanup: false,
						forced_root_block : false,
						force_br_newlines : true

 

 

effect:

JXqJiz5.png

  • Like 1
Link to comment
Share on other sites

lol it disappeared :D

 

insted old theme_advanced_buttons3 :

 

use this:

theme_advanced_buttons3 : "code,|,tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",

 

 

effect:

OYyNJvU.png

Link to comment
Share on other sites

everything depends on you ;)

if you've got any other questions - feel free to write

 

i think that we can mark this thread as solved,

solved isn't mean close - so we can continue discussion even if the topis is [solved] ;)

 

regards

Link to comment
Share on other sites

I do have another question, but it is regarding the gallery - I will bump that topic.

 

Next question about this freebie page:

 

I have created it and it works great. Now I want to make the freebies available only to subscribed members, in other words you have to be logged in to download it. How would I do that?

Link to comment
Share on other sites

controllers/front/CmsController.php

 

right after the:

public function initContent()
{

 

add:

$this->context->smarty->assign('customer', $this->context->customer);

 

 

next open the cms.tpl in your theme directory

 

instead the:

 

{$cms->content}

 

use this:

 

   {if Tools::getValue('id_cms')==4}
    {if $customer->logged==1}
 {$cms->content}
    {else}
	    {l s='unlogged. login first.'}
    {/if}
   {else}
    {$cms->content}
   {/if}

 

where the 4 from: {if Tools::getValue('id_cms')==4} is an ID of the cms page for which, you want to add login restriction.

  • Like 1
Link to comment
Share on other sites

Thanks, vekia, will make the changes now.

 

vekia, where will I find the ID of the page?

 

Has anyone told you lately you are a superstar, vekia?

 

Thank you so much - it works!

 

Another question: How do I add a hyperlink to the words "log in" in the cms.tpl file?

Link to comment
Share on other sites

Hmmm, editor? I am using Dreamweaver and it is not showing on the page. Here is the bit of code:

 

{l s='<strong>You have to be logged in to see this page - please <u><a href="http://touchdezines.com/shop/authentication?back=my-account">log in</a></u> or create an account.</strong>'}

Link to comment
Share on other sites

I don't know, Dolke, I suppose it is because I have it and don't know too much about Prestashop yet. I still have a lot to learn, but at least I got my shop working.

 

vekia, I will give this page another think. I think it is important to have that "login" as a link, but maybe there is another way to do it...

 

I want it to look like this:

 

You have to be logged in to see this page - please log in or create an account.

 

Instead of having to go to the top right of the page, just to click on the link to go to the log in page.

Link to comment
Share on other sites

im back dudes ;)

 

okay, i think that this will be the best way:

 

blabla bla <a href="{$link->getPageLink('my-account', true)}">{l s='Log In'}</a> blabla

 

this is the default method to get links to my-account / login page. No matter what language you browsing - you will get proper link always.

Link to comment
Share on other sites

Hey everyone, just a reminder to everywhere to refrain from "double-posting" or triple posting! (posting two consecutive posts in a row)... Simply edit your message and add 'UPDATE' or something. Now I'm going to merge these posts, :) No worries just keep it in mind, it helps maintain the flow and conciseness of the thread. Thank you!

Link to comment
Share on other sites

This is the cms.tpl file in the themes directory:

 

{if ($content_only == 0)}
{include file="$tpl_dir./breadcrumb.tpl"}
{/if}
{if isset($cms) && !isset($cms_category)}
{if !$cms->active}
<br />
<div id="admin-action-cms">
<p>{l s='This CMS page is not visible to your customers.'}
<input type="hidden" id="admin-action-cms-id" value="{$cms->id}" />
<input type="submit" value="{l s='Publish'}" class="exclusive" onclick="submitPublishCMS('{$base_dir}{$smarty.get.ad|escape:'htmlall':'UTF-8'}', 0, '{$smarty.get.adtoken|escape:'htmlall':'UTF-8'}')"/>
<input type="submit" value="{l s='Back'}" class="exclusive" onclick="submitPublishCMS('{$base_dir}{$smarty.get.ad|escape:'htmlall':'UTF-8'}', 1, '{$smarty.get.adtoken|escape:'htmlall':'UTF-8'}')"/>
</p>
<div class="clear" ></div>
<p id="admin-action-result"></p>
</p>
</div>
{/if}
<div class="rte{if $content_only} content_only{/if}">
<h4>{if Tools::getValue('id_cms')==8}
{if $customer->logged==1}
{$cms->content}
{else}
{l s='<strong>You have to be logged in to see this page - please <a href="{$link->getPageLink('my-account', true)}">{l s='Log In'}log in</a> or create an account.</strong>'}
{/if}
{else}
{$cms->content}
{/if}
       </h4>
</div>

{elseif isset($cms_category)}
<div class="block-cms">
<h1><a href="{if $cms_category->id eq 1}{$base_dir}{else}{$link->getCMSCategoryLink($cms_category->id, $cms_category->link_rewrite)}{/if}">{$cms_category->name|escape:'htmlall':'UTF-8'}</a></h1>
{if isset($sub_category) & !empty($sub_category)} 
<p class="title_block">{l s='List of sub categories in %s:' sprintf=$cms_category->name}</p>
<ul class="bullet">
{foreach from=$sub_category item=subcategory}
<li>
<a href="{$link->getCMSCategoryLink($subcategory.id_cms_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">{$subcategory.name|escape:'htmlall':'UTF-8'}</a>
</li>
{/foreach}
</ul>
{/if}
{if isset($cms_pages) & !empty($cms_pages)}
<p class="title_block">{l s='List of pages in %s:' sprintf=$cms_category->name}</p>
<ul class="bullet">
{foreach from=$cms_pages item=cmspages}
<li>
<a href="{$link->getCMSLink($cmspages.id_cms, $cmspages.link_rewrite)|escape:'htmlall':'UTF-8'}">{$cmspages.meta_title|escape:'htmlall':'UTF-8'}</a>
</li>
{/foreach}
</ul>
{/if}
</div>
{else}
<div class="error">
{l s='This page does not exist.'}
</div>
{/if}
<br />

Link to comment
Share on other sites

you do it wrong ;)

 

you can't use variables ($link in this case) in the l s= function: {l s=' HERE ' }

 

 

use this:

<strong>
{l s='You have to be logged in to see this page - please'} <a href="{$link->getPageLink('my-account', true)}">{l s='Log In'}</a> {l s='or create an account.'}
</strong>

 

 

Also, remember to not use html tags inside the {ls =''} function

 

... and don't forget to let us know if this works :)

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...