Jump to content

Adding a new document


Recommended Posts

Hi All,

      I have created  a new document in admin>file manager>documents and what I want to do is have this new document appear in the home page which I realize I can do by checking the home page radio button but unfortunately this then removes the original home page document. Is there a way  that I can have 2 home page documents. I have moved the original home page to display above the logo on the Mican template but obviously when I check the home page radio button in the documents of the new document that I have created this then appears above the logo. So would it possible to have the original homepage document to appear above the logo and then the new document that we have created appear in the original position on the home page at the same time

Hope somebody can help.

Best Regards,

Peterp

Link to comment
Share on other sites

You can create a snippet using the hook named class.cubecart.display_homepage, and for the PHP code, use a slightly modified version of the code that gets the Homepage document:

<?php
if (($home = $this->getDocument(99)) !== false) {
  $GLOBALS['smarty']->assign('DOCUMENT_ALT', array(
    'title'  => $home['doc_name'],
    'content' => $home['doc_content'],
    'hide_title' => $home['hide_title']
  ));
}

You will need to know the the 'doc_id' of the alternate homepage document (replace 99), and in the Mican skin:

Replace:
{if isset($DOCUMENT)}
<div id="announcement">
  <h1>{$DOCUMENT.title}</h1>
  {$DOCUMENT.content}
</div>
{/if}

With:
{if isset($DOCUMENT_ALT)}
<div id="announcement">
  <h1>{$DOCUMENT_ALT.title}</h1>
  {$DOCUMENT_ALT.content}
</div>
{/if}

 

Link to comment
Share on other sites

Hi Brian,

             I have tried this code and on one of the locally hosted version of the cubecart when I try to save the snippet all I get is a blank screen and it doesn't go back to the admin screen. I decided to try it on another machine which is using the same cubecart version and it all worked perfectly. what could be the cause of the blank screen happening when i try to save the snippet.

Hope you can Help,

Peterp

Link to comment
Share on other sites

Hi Brian,

Thankyou for helping me with this issue. I'm currently using xampp (as localhost) so I'm not really sure how to configure a web server to write error log sorry for my lack of knowledge.

If you can instruct me as to what I have to do I'm sure I can make it happen

Best Regards,

Peterp

Link to comment
Share on other sites

hi Brian,

I think I have fixed it. I uninstalled xampp and then reinstalled it and then did all of the mods again and it seems to have worked.

Thanks again for all of your help I appreciate it immensely.

Best Regards,

Peterp

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...