Jump to content

Recommended Posts

Using Phoenix version 1.0.7.6 and het this error when trying to install in admin:

1062 - Duplicate entry 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_BC_COLOR' for key 'uq_configuration_key'

insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Button Colour', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_BC_COLOR', '#FF9800', 'pick your button color', '6', '1', 'tep_cfg_select_option(array(\'greenyellow\', \'violet\', \'red\', \'blue\', \'green\', \'skyblue\', \'#FF9800\'), ', now())

Thanks

Share this post


Link to post
Share on other sites
1 minute ago, Heatherbell said:

Which tells you there is a duplicate entry in the configuration table in your database - find it and delete it.

Thank you

Share this post


Link to post
Share on other sites

Since Zahid can unfortunately no longer do the update himself (RIP), here are instructions on how to install the Back2Top button:

Modify the modulefile in includes/modules/header_tags/ and delete line 132 and 126 from ht_jcm_back_to_top.php

Thats all. It should look like this:

<?php
/*
  $Id$

  generated by: 
  https://oscompose.com (c)2018

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2018 osCommerce

  Released under the GNU General Public License
  V1.5 JcMagpie Back to top 12-10-2019
  
  

*/

  class ht_jcm_back_to_top {
    var $code = 'ht_jcm_back_to_top';
    var $group = 'footer_scripts';
    var $title;
    var $description;
    var $sort_order;
    var $enabled = false;

    function __construct() {
      $this->title = MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_TITLE;
      $this->description = MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_DESCRIPTION;
      
      $this->api_version = 'V1.5 JcMagpie Back to top 12-10-2019';

      if ( defined('MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_STATUS') ) {
        $this->sort_order = MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_SORT_ORDER;
        $this->enabled = (MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_STATUS == 'True');
      }
    }

    function execute() {
      global $oscTemplate;
      
      $oscTemplate->addBlock('<style>.jcm-back-to-top {
  display: none;
  background-color: ' . MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_BC_COLOR . ';
  width: ' . MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_WIDTH . ';
  height: ' . MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_HEIGHT . ';
  text-align: center;
  border-radius: ' . MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_RADIUS . ';
  margin: ' . MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_MARGIN . ';
  position: fixed;
  bottom: ' . MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_BOTTOM . ';
  right: ' . MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_RIGHT . ';
  transition: background-color .3s;
  z-index: 1000;
}


.jcm-back-to-top:hover {
  cursor: pointer;
  background-color: ' . MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_HOVERB_COLOR . ';
}
.jcm-back-to-top:active {
  background-color: ' . MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_ACTIVEB_COLOR . ';
}
.jcm-back-to-top::after {
  content: "\\' . MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_ICON . ' ";
  font-family: ' . MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_FONT_FAMILY . ';
  font-weight: normal;
  font-style: normal;
  font-size: 2em;
  line-height: 50px;
  color: ' . MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_AFTERTEXT_COLOR . ';
}</style>',  $this->group);


 $oscTemplate->addBlock( '<a class="jcm-back-to-top"><i style="color:' . MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_AFTERTEXT_COLOR . ';font-size:2em;" class="' . MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_CLASS . '"></i></a>' . "\n", $this->group);
      

      $oscTemplate->addBlock('<script>window.onscroll = jQuery(document).ready(function() {
    var offset = ' . MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_OFFSET . ';
    var duration = ' . MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_DURATION . ';
    jQuery(window).scroll(function() {
        if (jQuery(this).scrollTop() > offset) {
            jQuery(\'.jcm-back-to-top\').fadeIn(duration);
        } else {
            jQuery(\'.jcm-back-to-top\').fadeOut(duration);
        }
    });
    jQuery(\'.jcm-back-to-top\').click(function(event) {
        event.preventDefault();
        jQuery(\'html, body\').animate({scrollTop: ' . MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_SCROLL_TOP. '}, duration);
        return false;
    })
});</script>',  $this->group);
      

      
      
     
      
      
        }

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

    function check() {
      return defined('MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_STATUS');
    }

    function install() {
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Back To Top Module', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_STATUS', 'True', 'Add a Back To Top link after scrolling?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
   
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('font-family CSS Pseudo-Elements', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_FONT_FAMILY', 'FontAwesome', 'Font Awesome 5 Free or FontAwesome', '6', '0', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('font class', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_CLASS', 'fas fa-chevron-up', 'fas fa-chevron-up', '6', '0', now())");
      
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Button scroll offset', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_OFFSET', '250', 'offset', '6', '0', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Button scroll duration', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_DURATION', '500', 'duration', '6', '0', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Button scroll top', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_SCROLL_TOP', '0', 'scroll top', '6', '0', now())");
     
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Button icon do not use if class selected', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_ICON', '' , 'FontAwesome code f077', '6', '0', now())");
      
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Button Colour', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_BC_COLOR', '#FF9800', 'pick your button color', '6', '1', 'tep_cfg_select_option(array(\'greenyellow\', \'violet\', \'red\', \'blue\', \'green\', \'skyblue\', \'#FF9800\'), ', now())");
      
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Button text-color', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_AFTERTEXT_COLOR', '#fff', 'text-color', '6', '0', now())");
      
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Button Colour hover', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_HOVERB_COLOR', '#FFF700', 'pick your hover color', '6', '1', 'tep_cfg_select_option(array(\'greenyellow\', \'violet\', \'red\', \'blue\', \'green\', \'skyblue\', \'#FFF700\'), ', now())");
     
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Button active color', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_ACTIVEB_COLOR', '#555', 'active color', '6', '0', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Button width', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_WIDTH', '50px', 'width px', '6', '0', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Button height', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_HEIGHT', '50px', 'height px', '6', '0', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Button display margin', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_MARGIN', '30px', 'display margin px', '6', '0', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Button display bottom', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_BOTTOM', '30px', 'display bottom px', '6', '0', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Button display right', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_RIGHT', '30px', 'display right px', '6', '0', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Button radius', 'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_RADIUS', '4px', 'radius px', '6', '0', now())");
     
    }

    function remove() {
      tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')");
    }

    function keys() {
      return array('MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_STATUS',
      'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_SORT_ORDER',
      'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_FONT_FAMILY',
      'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_CLASS',
      'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_OFFSET',
      'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_DURATION',
      'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_SCROLL_TOP',
      'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_ICON',
      'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_BC_COLOR',
      'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_AFTERTEXT_COLOR',
      'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_HOVERB_COLOR',
      'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_ACTIVEB_COLOR',
      'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_WIDTH',
      'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_HEIGHT',
      'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_MARGIN',
      'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_BOTTOM',
      'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_RIGHT',
      'MODULE_HEADER_TAGS_JCM_BACK_TO_TOP_RADIUS');
    }
  }

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×