Test Version of WordPress site

Richard Korts
Richard Korts used Ask the Experts™
on
I manage a Wordpress Site with custom php code & a custom MySQL database. During the time period Jan 1. thru abut April 15, the customer offers their customers discount prices for buying a service plan during that time frame. The also require a variation on the main page slider where there an alternate image is placed inbetween each existing image where the alternate image pushes the discount pricing.

It's very straignt forward to do this, I've done it several years in a row, but I've always had to do it on Jan 1 (actually Jan 2), but it needs to go live like at 6 AM Eastern & I am in Pacific, so 3AM Pacific.

I would like to do it such that I can set it all up ahead of time & have the customer verify it's working correctly AHEAD of time, for the obvious reasons.

It occurred to me I can do the database part by having two tables, one for the normal pricing & one for discount. Then I can with custom php code make it use the discount pricing ONLY during the dates 1/1 through 4/15 OR if the user is me or the customer contact. Since no login is needed, not sure how to do that. I just thought, I can make a login needed to test the upcoming discount period, then use the alternate table if login is proper.

But how can I use a different carousel for the slider (this part all done in Wordpress) for the testing and the discount date range?

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
David FavorFractional CTO
Distinguished Expert 2018

Commented:
What you're looking for will likely be membership plugin, like https://restrictcontentpro.com or something similar.

Then you'll setup an offer to run at certain times at a discount, in your case once every year at a certain time.

You can try writing your own membership-esque system + likely best just to purchase one that already works.
David FavorFractional CTO
Distinguished Expert 2018

Commented:
To test this, you'll spin up a test version of your site... called dev or test or staging...

Just some other host name to test.
Scott FellDeveloper & EE Moderator
Fellow 2018
Most Valuable Expert 2013

Commented:
It sense multiple items here.

First, I would set up an alternate testing and staging site. If you don't have that done already, you can duplicate the current site a couple of times over. The testing version can be on your local computer for your use and the staging version on a different domain or sub domain live somewhere that your client can use to test.  I know with a lot of custom work this can be easier said than done.

What I have done in a case like this is to set up a pricing table instead of another database. The pricing table can have fields for the product_id linked to the product table along with datestamp fields for date_start and date_end.

You end up with something like a product table

ID          Name
123       Widget

Pricing Table
ID        Product_ID        Date_Start                                  Date_End                                        Price
5          123                    2019-10-01 12:00:00 AM           2019-12-31 11:59:59 pm             2500
6          123                    2020-01-01 12:00:00 AM           2020-04-15 11:59:59 pm             2000
7          123                    2020-04-16 12:00:00 AM           2020-12-31 11:59:59 pm             2600

When you pull the price for the widget, it will be dependent on the current date.  The side benefit of this is you get a static history of past prices offered.  It is also automated as far as the user seeing prices go. You just need to modify your screen in the admin area to allow to view and edit multiple prices.  Use logic in php to prevent changing prices for dates that have past and also show warnings for date ranges that overlap.
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

Richard KortsBusiness Owner / Chief Developer

Author

Commented:
OK, I think you are saying I can set up the site like at www.xyz.com/test, out all the new stuff there, test there, then on Jan 1, copy test back to "live".

Correct?

Thanks,

Richard
Fractional CTO
Distinguished Expert 2018
Commented:
Tip: For me, managing 1000s of sites, I avoid nested installs like the plague, as they generate many subtle problems.

Better to run...

1) xyz.com - has it's own DocumentRoot

2) test.xzy.com - has another completely different (not nested) DocumentRoot

You'll save yourself many headaches by keeping all your site DocumentRoot directories flat (side by side, rather than nested).
Scott FellDeveloper & EE Moderator
Fellow 2018
Most Valuable Expert 2013

Commented:
David said what I did though more directly. Set up the testing on a separate domain as a separate install. I like to use subdomains and just pick up a wildcard cert.  If you are just testing one page then www.xyz.com/test is ok, but I do think you are best off testing custom work on a test domain.

As far as copying, my suggestion is to use a separate pricing table.  Once you test it, you can make it live at any time. The price will change automatically based on the current date. The downside to this is going to be changing the structure of how you server up pricing. Though it should be a matter of changing from table to a query with the same data. Still that can throw things off and may or may not be worth your time.
Richard KortsBusiness Owner / Chief Developer

Author

Commented:
OK, now I need a Wordpress Backup hopefully FREE (read, NOT backup buddy) so I can make a full copy & move elsewhere.

Suggestions?

Suppose I should open another question.
Scott FellDeveloper & EE Moderator
Fellow 2018
Most Valuable Expert 2013

Commented:
I can't help you with which back up plug in, I use plesk and the feature is built in.
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Best to open another question.

And https://wordpress.org/plugins/duplicator works well.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial