Jump to content
Sign in to follow this  
Victorious

Adding Footer Information Pages

Recommended Posts

Hello,

I would have information in the footer. I had looked the different module inside the marketplace but I don't know what I want.

Could you tell me how to make that?

Share this post


Link to post
Share on other sites

Is it a menu, in this case, you can use the page manager inside the application to make that ?

Share this post


Link to post
Share on other sites
Posted (edited)

No, it's not a menu.
I think a dynamic could better because if I need to change something, it will be easier.

Edited by Victorious

Share this post


Link to post
Share on other sites

In this case, I think you can createa page inside the page manager (you will have an fix id) and inside yoru file you can call the id.
This option allow to use the multilanguage and change when you want..

 

The second option is to call the language file. But in this case you must every time to edit your language  and change the content. You can also make by the administration but if you reset  your language, your lost your content.

Share this post


Link to post
Share on other sites

@Drack,

 

What do you mean :

You can also make by the administration but if you reset your language, your lost your content.

 

Share this post


Link to post
Share on other sites

@Ronaldo,

Inside your administration / tools menu, you can edit a language definition and change all that you want. It's easy.

The inconvenient, the language is saved in the mysql database and if you reset the language, it take all the default language file.

You lost all that you have inside the db.

 

Share this post


Link to post
Share on other sites
Posted (edited)

@Victorious,

 

I will help you, it's very simple to make a new file. You mus create 6 files

 

modules_footer/fo_footer_my_template.php

modules_footer/content/fo_footer_my_template.php

language/english/modules/modules_footer/fo_footer_my_template.php

language/french/modules/modules_footer/fo_footer_my_template.php

css/english/modules/modules_footer/fo_footer_my_template.php

css/french/modules/modules_footer/fo_footer_my_template.php (if it used)

 

Below an example,  make that quickly, it can have litle error inside the files.

 

The most important files (after you can make the other)

 

modules_footer/fo_footer_my_template.php

 

<?php
/**
 *
 *  @copyright 2008 - https://www.clicshopping.org
 *  @Brand : ClicShopping(Tm) at Inpi all right Reserved
 *  @Licence GPL 2 & MIT
 *  @licence MIT - Portion of osCommerce 2.4
 *  @Info : https://www.clicshopping.org/forum/trademark/
 *
 */

  use ClicShopping\OM\Registry;
  use ClicShopping\OM\CLICSHOPPING;

  class fo_footer_my_template {
    public $code;
    public $group;
    public $title;
    public $description;
    public $sort_order;
    public $enabled = false;
    public $pages;
    protected $rewriteUrl;

    public function __construct() {
      $this->code = get_class($this);
      $this->group = basename(__DIR__);
      $this->title = CLICSHOPPING::getDef('module_footer_my_template_title');
      $this->description = CLICSHOPPING::getDef('module_footer_my_template_description');
      $this->rewriteUrl = Registry::get('RewriteUrl');

      if ( defined('MODULES_FOOTER_MY_TEMPLATE_STATUS') ) {
        $this->sort_order = MODULES_FOOTER_MY_TEMPLATE_SORT_ORDER;
        $this->enabled = (MODULES_FOOTER_MY_TEMPLATE_STATUS == 'True');
        $this->pages = MODULE_FOOTER_MY_TEMPLATE_DISPLAY_PAGES;
      }
    }

    public function execute() {
      $CLICSHOPPING_Template = Registry::get('Template');
      $CLICSHOPPING_Customer = Registry::get('Customer');
      $CLICSHOPPING_PageManagerShop = Registry::get('PageManagerShop');
      $CLICSHOPPING_Db = Registry::get('Db');

      if  ( MODE_VENTE_PRIVEE == 'false' || (MODE_VENTE_PRIVEE == 'true' && $CLICSHOPPING_Customer->isLoggedOn() )) {

// change pages_id = 55 by your id
        $Qpages = $CLICSHOPPING_Db->prepare('select pd.pages_title,
                                                    p.links_target
                                            from :table_pages_manager p,
                                                 :table_pages_manager_description pd
                                            where p.status = 1
                                            and ( p.customers_group_id = :customers_group_id or  p.customers_group_id = 99)
                                            and p.pages_id = pd.pages_id
                                            and  p.pages_id = 55 
                                           ');
        $Qpages->bindInt(':customers_group_id', (int)$CLICSHOPPING_Customer->getCustomersGroupID() );

        $Qpages->execute();
  
        $content = HTML::link($this->rewriteUrl->getPageManagerContentUrl($Qpages->valueInt('pages_id')), $Qpages->value('pages_title'), 'target="' . $Qpages->value('links_target') . '"')

        $content_width = (int)MODULE_FOOTER_MY_TEMPLATE_CONTENT_WIDTH;

        $my_template_footer = '<!-- footer page manager start -->' . "\n";

        ob_start();

        require($CLICSHOPPING_Template->getTemplateModules($this->group . '/content/footer_my_template'));

        $my_template_footer .= ob_get_clean();

        $my_template_footer .='<!-- footer page manager end -->' . "\n";

        $CLICSHOPPING_Template->addBlock($my_template_footer, $this->group);
      }
    }

    public function isEnabled() {
      return $this->enabled;
    }

    public function check() {
      return defined('MODULES_FOOTER_MY_TEMPLATE_STATUS');
    }

    public function install() {
      $CLICSHOPPING_Db = Registry::get('Db');

      $CLICSHOPPING_Db->save('configuration', [
          'configuration_title' => 'Do you want activate this module ?',
          'configuration_key' => 'MODULES_FOOTER_MY_TEMPLATE_STATUS',
          'configuration_value' => 'True',
          'configuration_description' => 'Do you want activate this module in your shop ?',
          'configuration_group_id' => '6',
          'sort_order' => '1',
          'set_function' => 'clic_cfg_set_boolean_value(array(\'True\', \'False\'))',
          'date_added' => 'now()'
        ]
      );

      $CLICSHOPPING_Db->save('configuration', [
          'configuration_title' => 'Please select the width of the module',
          'configuration_key' => 'MODULE_FOOTER_MY_TEMPLATE_CONTENT_WIDTH',
          'configuration_value' => '12',
          'configuration_description' => 'Select a number between 1 and 12',
          'configuration_group_id' => '6',
          'sort_order' => '1',
          'set_function' => 'clic_cfg_set_content_module_width_pull_down',
          'date_added' => 'now()'
        ]
      );

      $CLICSHOPPING_Db->save('configuration', [
          'configuration_title' => 'Sort order',
          'configuration_key' => 'MODULES_FOOTER_MY_TEMPLATE_SORT_ORDER',
          'configuration_value' => '10',
          'configuration_description' => 'Sort order of display. Lowest is displayed first',
          'configuration_group_id' => '6',
          'sort_order' => '4',
          'set_function' => '',
          'date_added' => 'now()'
        ]
      );

      $CLICSHOPPING_Db->save('configuration', [
          'configuration_title' => 'Indicate the page where the module is displayed',
          'configuration_key' => 'MODULE_FOOTER_MY_TEMPLATE_DISPLAY_PAGES',
          'configuration_value' => 'all',
          'configuration_description' => 'Select the page where the module is displayed.',
          'configuration_group_id' => '6',
          'sort_order' => '5',
          'set_function' => 'clic_cfg_set_select_pages_list',
          'date_added' => 'now()'
        ]
      );
  }

  public function remove() {
      return Registry::get('Db')->exec('delete from :table_configuration where configuration_key in ("' . implode('", "', $this->keys()) . '")');
  }

    public function keys() {
      return ['MODULES_FOOTER_MY_TEMPLATE_STATUS',
              'MODULE_FOOTER_MY_TEMPLATE_CONTENT_WIDTH',
              'MODULES_FOOTER_MY_TEMPLATE_SORT_ORDER',
              'MODULE_FOOTER_MY_TEMPLATE_DISPLAY_PAGES'
            ];
    }
  } 

modules_footer/content/footer_my_template.php

 

<div class="col-md-<?php echo $content_width; ?> moduleFooterMyTemplater">
  <span class="moduleFooterMyTemplate">
    <span class="footerMyTemplate"><?php echo $content; ?></span>
  </span>
</div>

 

 

 

 

 

 

 

 

 

Edited by Julie
  • Thanks 5

Share this post


Link to post
Share on other sites

Just for your information you can look the class includes/Apps/Communication/PageManager/Classes/Shop/PageManagerShop

you will some code you can use.

  • Thanks 1

Share this post


Link to post
Share on other sites

@Julie,

Thank you for the details of your example and how to make a module.

Note : the language and css are not included, but it's easy to do that.

Share this post


Link to post
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.   Restore formatting

  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.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use