Zen Cart Logo
Forums / Code Collaboration / Moving from live server to localhost issues part 2

Moving from live server to localhost issues part 2

Views: 2,929

Results 1 to 9 of 9
30 Sep 2020, 9:58 PM
#1
wolfderby avatar

wolfderby

Zen Follower

Join Date:
Dec 2008
Location:
Pittsburgh, PA
Posts:
241
Plugin Contributions:
0

Moving from live server to localhost issues part 2

So I have my site backed up to gitlab.com

I ssh into my server and pull

I git bash into my local and pull/push

...issue I'm having... w/ hardcoded links to admin from catalog side.... a href"=http://www.mysite.com/etc" to "http://localhost"

Is there an easy way change the paths w/ a DIR_ constant or something like that?

Thanks for your help in advance,
b

1 Oct 2020, 1:19 AM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Moving from live server to localhost issues part 2

Well, don't use hard-coded links to reference material on your own site is the first thing. All links should either be entered as relative to the current location or via the Zen Cart php function zen_href_link found in includes/functions/html_output.php.

The base link is provided in the typical ```

<head></head> ``` area of the page. Whatever needs to be reached from that point is the hard-coded link necessary. So to reach the etc folder: <a href="etc"
1 Oct 2020, 1:19 AM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Moving from live server to localhost issues part 2

wolfderby:

...issue I'm having... w/ hardcoded links to admin from catalog side.... a href"=http://www.mysite.com/etc" to "http://localhost"

Is there an easy way change the paths w/ a DIR_ constant or something like that?
No. The non-admin side has zero visibility into where the actual admin directory is.

You can use your browser bookmarks/favorites for that.

1 Oct 2020, 3:18 PM
#4
wolfderby avatar

wolfderby

Zen Follower

Join Date:
Dec 2008
Location:
Pittsburgh, PA
Posts:
241
Plugin Contributions:
0

Re: Moving from live server to localhost issues part 2

DrByte:

No. The non-admin side has zero visibility into where the actual admin directory is.

You can use your browser bookmarks/favorites for that.

Is there a secure way to link to the admin from the front end? I'm trying to add some custom admin functionality to the front-end catalog side. I have it hidden both within a ip address and browser COOKIE.

1 Oct 2020, 4:00 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Moving from live server to localhost issues part 2

Again, the front-end knows nothing of the admin.

If you want to add an Admin link onto your front-end somewhere, and since YOU do already know the URL of your Admin, just code it directly into your template wherever you want it to be displayed.

1 Oct 2020, 6:07 PM
#6
wolfderby avatar

wolfderby

Zen Follower

Join Date:
Dec 2008
Location:
Pittsburgh, PA
Posts:
241
Plugin Contributions:
0

Re: Moving from live server to localhost issues part 2

DrByte:

Again, the front-end knows nothing of the admin.

If you want to add an Admin link onto your front-end somewhere, and since YOU do already know the URL of your Admin, just code it directly into your template wherever you want it to be displayed.

Ok thanks, maybe one day I can do something fancier to make it more secure. I'm creating an if no image file, upload file/camera button on the front end. Goal is to swipe through products w/ hammerjs, jquery toggle stock status (if I don't actually have the product), if I do, upload photos w/ auto deletion of background/masking from front end (maybe imagemagick lib?) (w/ automatic naming of the picture from the product model sku (adding .jpg).

Should make for a super user friendly app like website.

1 Oct 2020, 6:14 PM
#7
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Moving from live server to localhost issues part 2

What though is the need for the catalog to reach the admin? Meaning, what is in the admin side that can't be performed/done from the catalog side to achieve whatever it is that is desired? From this latest description, I don't see anything that requires the admin side...

1 Oct 2020, 6:42 PM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Moving from live server to localhost issues part 2

wolfderby:

I'm creating an if no image file, upload file/camera button on the front end. Goal is to swipe through products w/ hammerjs, jquery toggle stock status (if I don't actually have the product), if I do, upload photos w/ auto deletion of background/masking from front end (maybe imagemagick lib?) (w/ automatic naming of the picture from the product model sku (adding .jpg).

Should make for a super user friendly app like website.

You could build all that with an admin-side page too. No need for doing it on the non-admin front-end at all.

1 Oct 2020, 8:02 PM
#9
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,717
Plugin Contributions:
56

Re: Moving from live server to localhost issues part 2

MC's earlier point

Well, don't use hard-coded links to reference material on your own site is the first thing.

deserves emphasis. But using only relative URLs, you will allow yourself to easily move the cart, set up test sites, change the domain name, etc.

This is discussed in the doc here:
https://docs.zen-cart.com/user/first_steps/relative_urls/