Jump to content

change link in php in oscommerce


virtualadz

Recommended Posts

i want to change a link in php please see the code and tell me what to do: i want to change link for the text in bold: please also see its' linking filedefine('HEADER_TITLE_CREATE_ACCOUNT', 'Create an Account');define('HEADER_TITLE_MY_ACCOUNT', 'My Account');define('HEADER_TITLE_CART_CONTENTS', 'Cart Contents');define('HEADER_TITLE_CHECKOUT', 'Checkout');define('HEADER_TITLE_TOP', 'Home');define('HEADER_TITLE_CATALOG', 'Online Shop');define('HEADER_TITLE_LOGOFF', 'Sign Out');define('HEADER_TITLE_LOGIN', 'Sign In');this is it's linking file, see the bold text here, now i want to change the link to www.anydomain.com how should i do it. as you can see there is also a breadcrumb.php file i have shown it in the last as code:// include the breadcrumb class and start the breadcrumb trail require(DIR_WS_CLASSES . 'breadcrumb.php'); $breadcrumb = new breadcrumb; $breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER); $breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

<?php/*  $Id: breadcrumb.php,v 1.3 2003/02/11 00:04:50 hpdl Exp $  osCommerce, Open Source E-Commerce Solutions  http://www.oscommerce.com  Copyright (c) 2003 osCommerce  Released under the GNU General Public License*/  class breadcrumb {    var $_trail;    function breadcrumb() {      $this->reset();    }    function reset() {      $this->_trail = array();    }    function add($title, $link = '') {      $this->_trail[] = array('title' => $title, 'link' => $link);    }    function trail($separator = ' - ') {      $trail_string = '';      for ($i=0, $n=sizeof($this->_trail); $i<$n; $i++) {        if (isset($this->_trail[$i]['link']) && tep_not_null($this->_trail[$i]['link'])) {          $trail_string .= '<a href="' . $this->_trail[$i]['link'] . '" class="headerNavigation">' . $this->_trail[$i]['title'] . '</a>';        } else {          $trail_string .= $this->_trail[$i]['title'];        }        if (($i+1) < $n) $trail_string .= $separator;      }      return $trail_string;    }  }?>

Link to comment
Share on other sites

$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);

This line is referencing HTTP_SERVER, and it appears you wish to change where this goes to. You should open catalog/includes/configure.php and around lines 14-15 change the HTTP_SERVER and most likely HTTP_CATALOG_SERVER to the domain you want the link to go to.

Link to comment
Share on other sites

$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);

This line is referencing HTTP_SERVER, and it appears you wish to change where this goes to. You should open catalog/includes/configure.php and around lines 14-15 change the HTTP_SERVER and most likely HTTP_CATALOG_SERVER to the domain you want the link to go to.

this is the code, but if i change it will it cause problems
 define('HTTP_SERVER', 'http://store.mydomain.com'); // eg, http://localhost - should not be empty for productive servers  define('HTTPS_SERVER', 'https://mydomain.com'); // eg, https://localhost - should not be empty for productive servers  define('ENABLE_SSL', false); // secure webserver for checkout procedure?  define('HTTP_COOKIE_DOMAIN', 'store.mydomian.com');  define('HTTPS_COOKIE_DOMAIN', 'mydomain.com');

Link to comment
Share on other sites

That depends on your intent. Are you only wanting to change where that one link goes or every link that call HTTP_SERVER? If you want to change them all then go ahead and change it. Also change HTTP_COOKIE_DOMAIN, HTTPS_SERVER, and HTTPS_COOKIE_DOMAIN.If you only want to change that one link then do something like this

define('HTTP_SERVER', 'http://store.mydomain.com'); // eg, http://localhost - should not be empty for productive servers define('HTTPS_SERVER', 'https://mydomain.com'); // eg, https://localhost - should not be empty for productive serversdefine('NEWHTTP_LINK', 'http://domain.com'); // this will become your new link define('ENABLE_SSL', false); // secure webserver for checkout procedure? define('HTTP_COOKIE_DOMAIN', 'store.mydomian.com'); define('HTTPS_COOKIE_DOMAIN', 'mydomain.com');

Then go back to your first page and change

$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);

to

$breadcrumb->add(HEADER_TITLE_TOP, NEWHTTP_LINK);

and everything should be fine.

Link to comment
Share on other sites

i edited the files but what happened is that after saving configure.php it comes to the same data as before editing, now i am going to change it to NEWHTTP . please visit www.store.bhuratea.com , and also www.bhuratea.com , i want to link only the logo image in store.bhuratea.com to bhuratea.com.

Link to comment
Share on other sites

In that situation you would want to do the second solution.

define('NEWHTTP_LINK', 'www.bhuratea.com');$breadcrumb->add(HEADER_TITLE_TOP, NEWHTTP_LINK);

Note: If you have some sort of a control panel for this, there may be an option in there to change that link. I do not know for sure though. Perhaps you should investigate if this does not work.

Link to comment
Share on other sites

Post all of the code for config.php and show me the changes to made to the initial page as well. Also, I hear word that in the admin panel under tools there is something called banner manager that may allow you to change the link.

Link to comment
Share on other sites

i dont think so, banner allows as i had change it's link to my site. ok well i ask you questions:my site address: store.bhuratea.comhomepage address: bhuratea.comyou visit my homepage and tell that is it possible that i can include whatever i have in bhuratea.com include it in store.bhuratea.com, is it possible, there are javascript files and and menus can i add them to store.bhuratea.com . i will just place the code in files .second can i edit: the url of my oscommerce template from store.bhuratea.com , i have mauch data feeeded, is it possible to change it's url without losing data.

Link to comment
Share on other sites

That might be an issue. I don't know much about OSCommerce, but I am going to assume that it is quite a bit like PHPbb. If this is the case you're going to have quite a bit of trouble editing it. They come with very complex PHP and it can become difficult to edit part of it unless you are either very good with PHP or just very good at using find. You most likely won't be able to straight up put links to javascript or css in the page, because of the way it combines pages.the url of my oscommerce template from store.bhuratea.com , i have mauch data feeeded, is it possible to change it's url without losing data. I do not understand what you are trying to say here, but you should not lose data by changing the variables in the file

Link to comment
Share on other sites

"the url of my oscommerce template from store.bhuratea.com , i have mauch data feeeded, is it possible to change it's url without losing data. "i mean to say here that current url of my shop is store.bhuratea.com now suppose i want to change it to good.bhuratea.com , is it possible, also am i going to loose any data that i have currently

Link to comment
Share on other sites

let me come back to my question you had asked for my configure.php file please see it and tell me why error comes

<?php/*  osCommerce, Open Source E-Commerce Solutions  http://www.oscommerce.com  Copyright (c) 2003 osCommerce  Released under the GNU General Public License*/// Define the webserver and path parameters// * DIR_FS_* = Filesystem directories (local/physical)// * DIR_WS_* = Webserver directories (virtual/URL)  define('HTTP_SERVER', 'http://store.bhuratea.com'); // eg, http://localhost - should not be empty for productive servers  define('HTTPS_SERVER', 'https://bhuratea.com'); // eg, https://localhost - should not be empty for productive servers  define('ENABLE_SSL', false); // secure webserver for checkout procedure?  define('HTTP_COOKIE_DOMAIN', 'store.bhuratea.com');  define('HTTPS_COOKIE_DOMAIN', 'bhuratea.com');  define('HTTP_COOKIE_PATH', '/');  define('HTTPS_COOKIE_PATH', '/');  define('DIR_WS_HTTP_CATALOG', '/');  define('DIR_WS_HTTPS_CATALOG', '/');

Link to comment
Share on other sites

sorry but i dont have anything in quotes, lookrequire(DIR_WS_CLASSES . 'breadcrumb.php'); $breadcrumb = new breadcrumb; $breadcrumb->add(HEADER_TITLE_TOP, HTTP_LINK); $breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

Link to comment
Share on other sites

Well, either you are telling it to replace the text with the string "HTTP_LINK", or you have set the value of the constant HTTP_LINK to "HTTP_LINK", or there is an error in the algorithm that actually does the replacement. If you are sure that the first two possibilities are not true, then paste the code that does the replacement and we can take a look at that.

Link to comment
Share on other sites

as said by nakor i added this code to configure.php $breadcrumb->add(HEADER_TITLE_TOP, HTTP_LINK);and then in application_top.php i replaced HTTP_SERVER with HTTP_LINKbut one strange thing happenedwhen i open my configure.php file after editing the code $breadcrumb->add(HEADER_TITLE_TOP, HTTP_LINK); is not to be found there, the file becomes the same before editing. this doesnot get inside my brain, i had saved it properly, what should i do now?

Link to comment
Share on other sites

Well, you don't want the $breadcrumb code in the configure.php file, I think that goes in the page that outputs everything. So don't add any code that wasn't there before, just change what is already there (or copy and paste an existing line to add another one).

Link to comment
Share on other sites

sorry my mistake i added this line in cofigure.php filedefine('HTTP_LINK', 'http://domain.com'); // this will become your new linkbut that's not the matter the configure.php file changes to the same as it was before editing it, even if i save it, so it is not the code that causes the problem but i think bcoz it does not get saved it shows that error. i dont know why doesn't it save . do you think that i have to edit another file. i am confused

Link to comment
Share on other sites

Check the attributes of the file using the cpanel file manager. You may need to temporarily change the permissions to allow write access. But make sure you set the permissions back to what they are when you finish, do NOT leave the file world-writable.

Link to comment
Share on other sites

OK, try setting it to 744. But make sure that when you are done you set it back to 444. Unix/Linux permissions are octal values. The three digits are for owner, group, world. Octal value 4 is binary 101, so the permission 444 is like this:101 101 101These are read, write, execute. So all write values are 0, if you set the permissions to 744, it will be this:111 101 101Which will give write access to the owner. If that doesn't work, make it 774 to also give write access to the group. Last case (if you don't own the file and aren't in the group that does), change it to 777 (or 775, or 755) to give everyone write access. Just make sure to change it back to 444 when you're done.

Link to comment
Share on other sites

the permission is set like this Permission: 4 4 4 each 4 is inside a check box (just like the check box enable smilies when we give fast reply for topicsso i should try to change it to the 744 and others if it doesnot work, ok let me try.

Link to comment
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
×
×
  • Create New...