Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Integrate a photo gallery to Oscommerce


Joahim2509

Recommended Posts

I what to integrate a gallery from wordpres in to oscommerce. Now I am trying to make first, one menu with a list of posts names from data base that a "gallery type". The selection work fine and return the result. Now I try to integrate it in other php file from oscommerce but my result return only errors. Plese help my to integrate my code into other code. This is the selection from data base and the returns from it.

<?php
//db parameters
$localhost = '####';
$db_username = '######';
$db_password = '#######';
$db_database = '1131496_class';

//connect to the database
mysql_connect($localhost, $db_username, $db_password);
@mysql_select_db($db_database) or die("Unable to select database");

//get data from database -- !
$query = "Select * FROM gall_posts WHERE post_type='bw_gallery' AND post_status='publish' ORDER BY id DESC";

$query_result = mysql_query($query);
$num_rows = mysql_numrows($query_result);

//close database connection
mysql_close();
?>
<?php
//start a loop
for($i=0; $i< $num_rows; $i++){

//assign data to variables, $i is the row number, which increases with each run of the loop
$blog_title = mysql_result($query_result, $i, "post_title");

echo '<li><a href="#">' .$blog_title. '</a></li>';

} //end the for loop
?>

and the code where I what to integrate in it is from includes/modules/boxe. I use a file with some modification on it and I want to add a meniu list to it from database where is located the database for wordpress. After That I want to make a selection from database that correspond to specific category on a specific page. But that is other point

<?php
/*
  $Id$

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

  Copyright (c) 2013 osCommerce

  Released under the GNU General Public License
*/

  class bm_gallery {
    var $code = 'bm_gallery';
    var $group = 'boxes';
    var $title;
    var $description;
    var $sort_order;
    var $enabled = false;

    function bm_gallery() {
      $this->title = MODULE_BOXES_GALLERY_TITLE;
      $this->description = MODULE_BOXES_GALLERY_DESCRIPTION;

      if ( defined('MODULE_BOXES_GALLERY_STATUS') ) {
        $this->sort_order = MODULE_BOXES_GALLERY_SORT_ORDER;
        $this->enabled = (MODULE_BOXES_GALLERY_STATUS == 'True');

        $this->group = ((MODULE_BOXES_GALLERY_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right');
      }
    }

    function execute() {
      global $oscTemplate;

      $data = '<div class="ui-widget infoBoxContainer mj-information">' .
              '  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_GALLERY_BOX_TITLE . '</div>' .
              '  <div class="ui-widget-content infoBoxContents">' .
              '    <p>Lesen Sie hier was unsere Kunden über uns sagen: </p>' .
              '    <a href="bewertungen.php">' . 'Alle Kundenmeinungen' . '</a><br />' .

              '  </div>' .
              '</div>';

      $oscTemplate->addBlock($data, $this->group);
    }

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

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

    function install() {
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Information Module', 'MODULE_BOXES_GALLERY_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_BOXES_GALLERY_CONTENT_PLACEMENT', 'Left Column', 'Should the module be loaded in the left or right column?', '6', '1', 'tep_cfg_select_option(array(\'Left Column\', \'Right Column\'), ', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_BOXES_GALLERY_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
    }

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

    function keys() {
      return array('MODULE_BOXES_GALLERY_STATUS', 'MODULE_BOXES_GALLERY_CONTENT_PLACEMENT', 'MODULE_BOXES_GALLERY_SORT_ORDER');
    }
  }
?>

I know that my selection and for loop function must be somewhere hear 

function execute() {
      global $oscTemplate;

      $data = '<div class="ui-widget infoBoxContainer mj-information">' .
              '  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_GALLERY_BOX_TITLE . '</div>' .
              '  <div class="ui-widget-content infoBoxContents">' .
              '    <p>Lesen Sie hier was unsere Kunden über uns sagen: </p>' .
              '    <a href="bewertungen.php">' . 'Alle Kundenmeinungen' . '</a><br />' .

              '  </div>' .
              '</div>';

      $oscTemplate->addBlock($data, $this->group);
    }
Link to comment
Share on other sites

In the add-ons section there are a number of existing photo galleries that you can just drop in to osC. Have you already taken a look at them, and found them to be unsatisfactory? Do they not work with your version of osC (without major modifications)? It seems like that would be a lot less work for you, even if you do have to re-enter the photos into the osC database rather than just importing the Wordpress database.

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...