1. This website uses cookies. By continuing to use this website you are giving consent to cookies being used.
    For information on cookies and how you can disable them visit our Cookie Usage page.
    Dismiss Notice

PHP Need help with oscommerce.

Discussion in 'Web Development' started by Jholden, Jan 15, 2010.

  1. Jholden

    Jholden Member

    I am in need of some help with oscommerc, my store is running off it. The thing is all i have figured out how to do is change the color. I am looking to have a box added with icons and change things around and adjust other things. Putting products in is easy and i can do that but the modify php is proving to be difficult. If any one can help that would be so much appreciated. I will post the files on request or can email them direct.
     
  2. enigma1

    enigma1 New Member

    Ok if you're new to the osc, the most important part is to know the basics for the common layout elements of the framework.

    There is a header file: catalog/includes/header.php. That file contains whatever appears on the header of your site.

    The left navigation column that contains various boxes that appear on the left is located in the catalog/includes/column_left.php. The file contains various conditions to display boxes depending on what page is viewed.

    The right navigation column contains various boxes that appear on the right is located in the catalog/includes/column_right.php. It is similar to the left navigation column

    The footer contents is in catalog/includes/footer.php and contains whatever appears on the footer of your store.

    Now the boxes have various styles that are pre-set via the catalog/includes/classes/boxes.php. There are various classes in that file with the entries for infoBox and infoBoxContents typically used to create the boxes in the left/right navigation columns. There're some CSS references which can help to find the appropriate styles in the catalog/stylesheet.css

    To simply add a new box, you first create a new box file in catalog/includes/boxes folder. You then edit one of the navigation column files to include the new box file. These are the 2 basic steps. And sure go ahead post the specifics of your question.
     
  3. Jholden

    Jholden Member

    Well i am having a few problems. My site is BlackHorseMotorsports.com i took all content down to show some of the problems.

    1. I cant seem to find in the header.php file a way to get rid of the top --> catalog text.
    2. I need to create a box on the right that houses our Facebook, twitter, and myspace icon.
    3. I want to replace the Manufators box, and instead of just searching by manufatore you can do model, then choose make. But i cant seem to figure out how to create that function
    4. I also noticed that the logo uptop looks really off so i want to change the logo and then make it cover the whole top.
    5. I am really looking for any other advice or ideas to change it, i am not gonna open it till i feel it is right. There is just something off on it.
     
  4. enigma1

    enigma1 New Member

    The breadcrumb display is located by default in your catalog/includes/header.php
    comment out or remove the following line:
    Code:
        <td class="headerNavigation">&nbsp;&nbsp;<?php echo $breadcrumb->trail(' &raquo; '); ?></td>
    Use the catalog/includes/boxes/information.php file, duplicate it with a different name (eg: newbox.php). The change the links in the array so instead of this:

    '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .

    you could have
    Code:
    '<a href="' . http://www.example.com . '">' . tep_image(DIR_WS_IMAGES . facebook.jpg, 'facebook alt text') . '</a><br>' .
    '<a href="' . http://www.example.com . '">' . tep_image(DIR_WS_IMAGES . twitter.jpg, 'twitter alt text') . '</a><br>' .
     '<a href="' . http://www.example.com . '">' . tep_image(DIR_WS_IMAGES . twitter.jpg, 'myspace alt text') . '</a><br>' .
    
    just change the Example Web Page links to whatever links you need for the social networks, upload the images to the catalog/images/ directory for each one. You also need to make the new box visible. Depending which panel you want it on (lets say left nav column) open the catalog/includes/column_left.php file. Just after
    require(DIR_WS_BOXES . 'information.php');
    you add:
    require(DIR_WS_BOXES . 'newbox.php');
    where the newbox.php is the file you duplicated earlier on. Open your browser clear its cache see if the box is there.

    Requires quite some effort to have a hierarchy of fields with the search. Perhaps you can improve the search first of all by using ajax where the relevant options are filtered as the visitor types in.
    osCommerce Community Add-Ons

    The logo should be in the catalog/includes/header.php file. Now usually the logo itself is a clickable image separate from the rest of the header that puts the visitor in the home page, not a background. In any case check the headerdiv class in your catalog/stylesheet.css it's where the background is setup. Ideally the header should be sliced and the various items should be placed separately.
     
  5. Jholden

    Jholden Member

    I did it as you said and now it is throwing a code.
    Code:
    Parse error: syntax error, unexpected ':', expecting ')' in /home/content/b/l/a/blackhorsemoto/html/catalog/includes/boxes/social.php on line 23
    
    I cant seem to find it tho, i check 23 and all others its not there.
     
  6. enigma1

    enigma1 New Member

    ok, can you post the contents of the file

    catalog/includes/boxes/social.php

    so I can try it locally and fix any errors.
     
  7. Jholden

    Jholden Member

    Code:
    <?php
    /*
      $Id: information.php 1739 2007-12-20 00:52:16Z hpdl $
    
      osCommerce, Open Source E-Commerce Solutions
      http://www.oscommerce.com
    
      Copyright (c) 2003 osCommerce
    
      Released under the GNU General Public License
    */
    ?>
    <!-- information //-->
              <tr>
                <td>
    <?php
      $info_box_contents = array();
      $info_box_contents[] = array('text' => BOX_HEADING_INFORMATION);
    
      new infoBoxHeading($info_box_contents, false, false);
    
      $info_box_contents = array();
      $info_box_contents[] = array('text' => '<a href="' . http://www.facebook.com/profile.php?ref=profile&id=100000532294498 . '">' . tep_image(DIR_WS_IMAGES . facebook_32.png, 'facebook alt text') . '</a><br>' .
    					 '<a href="' . http://twitter.com/BlackHorseMotor . '">' . tep_image(DIR_WS_IMAGES . twitter_32.png, 'twitter alt text') . '</a><br>' .
     					 '<a href="' . http://www.youtube.com . '">' . tep_image(DIR_WS_IMAGES . youtube_32.png, 'youtube alt text') . '</a><br>' .
    					 '<a href="' . http://www.flicker.com . '">' . tep_image(DIR_WS_IMAGES . flickr_32.png, 'flicker alt text') . '</a><br>' .
    					 '<a href="' . http://www.myspace.com . '">' . tep_image(DIR_WS_IMAGES . myspace_32.png, 'myspace alt text') . '</a><br>' .
    
      new infoBox($info_box_contents);
    ?>
                </td>
    
              </tr>
    <!-- information_eof //-->
    
     
  8. enigma1

    enigma1 New Member

    ok I tested it here and corrected the issues. Most of them had to do with strings missing the single quotes

    Code:
    <?php
    /*
      $Id: information.php 1739 2007-12-20 00:52:16Z hpdl $
    
      osCommerce, Open Source E-Commerce Solutions
      http://www.oscommerce.com
    
      Copyright (c) 2003 osCommerce
    
      Released under the GNU General Public License
    */
    ?>
              <tr>
                <td>
    <?php
      $info_box_contents = array();
      $info_box_contents[] = array('text' => BOX_HEADING_SOCIAL);
    
      new infoBoxHeading($info_box_contents, false, false);
    
      $info_box_contents = array();
      $info_box_contents[] = array('text' => '<a href="http://www.facebook.com/profile.php?ref=profile&id=100000532294498">' . tep_image(DIR_WS_IMAGES . 'facebook_32.png', 'facebook alt text') . '</a><br>' .
                                             '<a href="http://twitter.com/BlackHorseMotor">' . tep_image(DIR_WS_IMAGES . 'twitter_32.png', 'twitter alt text') . '</a><br>' .
                                             '<a href="http://www.youtube.com">' . tep_image(DIR_WS_IMAGES . 'youtube_32.png', 'youtube alt text') . '</a><br>' .
                                             '<a href="http://www.flicker.com">' . tep_image(DIR_WS_IMAGES . 'flickr_32.png', 'flicker alt text') . '</a><br>' .
                                             '<a href="http://www.myspace.com">' . tep_image(DIR_WS_IMAGES . 'myspace_32.png', 'myspace alt text') . '</a>'
                                  );
    
      new infoBox($info_box_contents);
    ?>
                </td>
              </tr>
    
    I added a box-header text BOX_HEADING_SOCIAL
    You need to edit the catalog/includes/languages/english.php and setup a new definition for the string. Something like:

    define('BOX_HEADING_SOCIAL', 'Social Links');
     
  9. Jholden

    Jholden Member

    That worked brilliantly. You are blessed at programming. So i went into the footer (haha im slowly learning) to try and edit out the powered by oscommerce, and to try and center everything but couldnt find the area. What line am i looking for? What is the code to center?
     
  10. enigma1

    enigma1 New Member

    the footer contents are in catalog/includes/footer.php

    You should be able to comment out or remove the sections you don't want. The first table by default contains the visitors and date details. It may be the reason why the copyright info of your store is not centered. The HTML code that I see has a paragraph around the copyright but its part of the second table cell. In any case if you cannot figure it out post the contents of the file here.
     
  11. Jholden

    Jholden Member

    Alright so i have another error on the social box, i was updating with the correct info and it keeps throwing a:

    Parse error: syntax error, unexpected ')' in /home/content/b/l/a/blackhorsemoto/html/catalog/includes/boxes/social.php on line 26

    This is the code i have.

    Code:
    <?php
    /*
      $Id: information.php 1739 2007-12-20 00:52:16Z hpdl $
    
      osCommerce, Open Source E-Commerce Solutions
      http://www.oscommerce.com
    
      Copyright (c) 2003 osCommerce
    
      Released under the GNU General Public License
    */
    ?>
              <tr>
                <td>
    <?php
      $info_box_contents = array();
      $info_box_contents[] = array('text' => BOX_HEADING_SOCIAL);
    
      new infoBoxHeading($info_box_contents, false, false);
    
      $info_box_contents = array();
      $info_box_contents[] = array('text' => '<a href="http://www.facebook.com/pages/Black-Horse-Motorsports/266706437397?ref=ts">' . tep_image(DIR_WS_IMAGES . 'facebook_32.png', 'facebook alt text') . '</a>' .
                                             '<a href="http://twitter.com/BlackHorseMotor">' . tep_image(DIR_WS_IMAGES . 'twitter_32.png', 'twitter alt text') . '</a>' .
                                             '<a href="http://www.youtube.com/user/BlackHorseMotor">' . tep_image(DIR_WS_IMAGES . 'youtube_32.png', 'youtube alt text') . '</a><br>' .
                                             '<a href="http://www.flickr.com/photos/blackhorsemotor">' . tep_image(DIR_WS_IMAGES . 'flickr_32.png', 'flicker alt text') . '</a>' .
                                  );
    
      new infoBox($info_box_contents);
    ?>
                </td>
              </tr>
    <!-- information_eof //-->
    
     
  12. enigma1

    enigma1 New Member

    the text string inside the array must be terminated with a closing quote. So this text

    '<a href="http://www.flickr.com/photos/blackhorsemotor">' . tep_image(DIR_WS_IMAGES . 'flickr_32.png', 'flicker alt text') . '</a>' .

    should be:

    '<a href="http://www.flickr.com/photos/blackhorsemotor">' . tep_image(DIR_WS_IMAGES . 'flickr_32.png', 'flicker alt text') . '</a>'

    there should be no last dot there otherwise it implies continuation of the string. See if that helps
     
  13. Jholden

    Jholden Member

    Yea i ment to post it up, thats what i did a few nights ago and it worked. Then i got a huge error but you had fixed it in a thread you had on the oc site.
     
  14. Jholden

    Jholden Member

    Hello, I have 3 problems today that i cant seem to solve.

    1st is
    Code:
    Warning: include_once(includes/functions/custom_functions.php) [function.include-once]: failed to open stream: No such file or directory in /home/content/b/l/a/blackhorsemoto/html/catalog/includes/header.php on line 54
    2nd is
    Code:
    Warning: include_once() [function.include]: Failed opening 'includes/functions/custom_functions.php' for inclusion (include_path='.:/usr/local/php5/lib/php') in /home/content/b/l/a/blackhorsemoto/html/catalog/includes/header.php on line 54
    3rd is
    Code:
    Fatal error: Call to undefined function getCurrPathName() in /home/content/b/l/a/blackhorsemoto/html/catalog/includes/header.php on line 79
     
  15. Jholden

    Jholden Member

    The above 3 have been resolved.