If this is your first visit, check our documentation. To post, register or login.
Forums / Setting Up Categories, Products, Attributes / Set future Product Availability Date For All Products?

Set future Product Availability Date For All Products?

Started by webskipper on 14 Feb 2021, 11:09 PM · Views: 5,594

Results 1 to 20 of 21
14 Feb 2021, 11:09 PM
#1
webskipper avatar

webskipper

Totally Zenned

Join Date:
Nov 2007
Location:
USA
Posts:
876
Plugin Contributions:
2

Set future Product Availability Date For All Products?

Seasonal Shop to open next month. Looking to create future product availability dates for all products.

Change 'Product Added Date' to future date; where?

P i n g u i c u l a . S t o r e

Cheers!
v2.2.1

15 Feb 2021, 4:31 AM
#2
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,904
Plugin Contributions:
23

Re: Set future Product Availability Date For All Products?

Badkup first, but you might want to try ```
UPDATE products
SET products_date_available = 'yyyy-mm-dd';

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

15 Feb 2021, 12:09 PM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,140
Plugin Contributions:
56

Re: Set future Product Availability Date For All Products?

dbltoe:

Badkup first, but you might want to try ```
UPDATE products
SET products_date_available = 'yyyy-mm-dd';

Since the products_date_available is a datetime field, you should also include the time-related elements (00:00:00 through 23:59:59), e.g.

UPDATE products
SET products_date_available = 'yyyy-mm-dd [B]00:00:00[/B]';

15 Feb 2021, 2:49 PM
#4
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Set future Product Availability Date For All Products?

Webskipper:

Seasonal Shop to open next month. Looking to create future product availability dates for all products.

Change 'Product Added Date' to future date; where?

P i n g u i c u l a . S t o r e
Note how the solutions provided reference ths products_date_available field. This field is what is used to control when to let the product become available or to show that it was previously set and has become available.

The field asked about, products_date_added is a different field where the result is simply displayed if turned on. It also helps with identifying what product to show in the new products grouping...

Hiding the product or limiting the interaction of a product until a future date is different than when the product is considered new to the store.

The products_date_available field identified in the sql queries above is found on the product information page towards the top of the page. The products_date_added is generally calculated when the product is added to the database and is not made to be "freely" modified. I mean, once it is added, that's when it was added right? That doesn't mean that there are not other ways to adjust the value. Dbltoe has provided that for products_date_available. A similar query could be used for products_date_added if necessary.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

15 Feb 2021, 9:52 PM
#5
webskipper avatar

webskipper

Totally Zenned

Join Date:
Nov 2007
Location:
USA
Posts:
876
Plugin Contributions:
2

Re: Set future Product Availability Date For All Products?

Add the code as an sql patch?

Just getting back on the horse; coding.

Thanks in advance.

Cheers!
v2.2.1

16 Feb 2021, 2:24 AM
#6
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Set future Product Availability Date For All Products?

Webskipper:

Add the code as an sql patch?

Just getting back on the horse; coding.

Thanks in advance.
One place it can be executed is:
admin->tools->Install SQL Patches

Statement must end with a semi-colon to execute. But remember backup the database before running any of those statements.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

16 Feb 2021, 11:12 PM
#7
webskipper avatar

webskipper

Totally Zenned

Join Date:
Nov 2007
Location:
USA
Posts:
876
Plugin Contributions:
2

Re: Set future Product Availability Date For All Products?

Well, that worked. Thanks!

"This product will be in stock on Monday dd-mm-yyyy"

Got one success line and one incomplete asking for a semicolon even though it was included as is with the time.

admin->tools->Install SQL Patch

UPDATE products
SET products_date_available = 'yyyy-mm-dd 00:00:00';

Cheers!
v2.2.1

17 Feb 2021, 12:17 AM
#8
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Set future Product Availability Date For All Products?

Webskipper:

Well, that worked. Thanks!

"This product will be in stock on Monday dd-mm-yyyy"

Got one success line and one incomplete asking for a semicolon even though it was included as is with the time.

admin->tools->Install SQL Patch

UPDATE products SET products_date_available = 'yyyy-mm-dd 00:00:00';

Yeah, guess no one said to try to enter the content as a single line (even if it wraps around to a new line the absence of a "return" is important).

Hopefully though the yyyy-mm-dd was changed to something like 2021-02-20. :)

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

17 Feb 2021, 12:23 AM
#9
webskipper avatar

webskipper

Totally Zenned

Join Date:
Nov 2007
Location:
USA
Posts:
876
Plugin Contributions:
2

Re: Set future Product Availability Date For All Products?

LOL. Yes, actual date does appear. Just keeping it general for the next programmer.

Cheers!
v2.2.1

25 Dec 2021, 5:45 PM
#10
webskipper avatar

webskipper

Totally Zenned

Join Date:
Nov 2007
Location:
USA
Posts:
876
Plugin Contributions:
2

Re: Set future Product Availability Date For All Products?

Is there an update to this? Doesn’t work since the PHP update this Summer. Thanks again; in advance.

*admin->tools->Install SQL Patch
*

*Code:

UPDATE products SET products_date_available = 'yyyy-mm-dd 00:00:00';*

Cheers!
v2.2.1

25 Dec 2021, 5:55 PM
#11
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Set future Product Availability Date For All Products?

Webskipper:

Is there an update to this? Doesn’t work since the PHP update this Summer. Thanks again; in advance.

*admin->tools->Install SQL Patch
*

*Code:

UPDATE products SET products_date_available = 'yyyy-mm-dd 00:00:00';*

When posting about an issue, please provide as much information as possible, even if posting because aggravated or "tried everything". Not doing so only slows down getting a solution.

What doesn't work?

Does the available date not display to the customer?
Is the date not in the database?
Does the product not become active at the date/time in question?
Does executing the query cause an error?
From what php to what php version?

Take a moment and think of other things about the information provided and what types of questions may be asked. Giving more information than thought necessary isn't a bad thing as long as it isn't say privacy like information. We don't need to know the specific house number of someone's address, but understanding the country involved may be of help, etc...

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

25 Dec 2021, 6:08 PM
#12
webskipper avatar

webskipper

Totally Zenned

Join Date:
Nov 2007
Location:
USA
Posts:
876
Plugin Contributions:
2

Re: Set future Product Availability Date For All Products?

v157C

PHP Version: 7.4.27 (Zend: 3.4.0)

Date is in 2022: UPDATE products SET products_date_available = ‘2022-01-01 01:01:01';

Results: WARNING: An Error occurred ….

This patch did work last year. I have the shop closed for Winter. Shop stays is Showcase no price. Fails in normal Store mode, too.

Cheers!
v2.2.1

25 Dec 2021, 6:09 PM
#13
swguy avatar

swguy

Administrator

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

Re: Set future Product Availability Date For All Products?

Bear in mind that things can fail silently in Install SQL Patches. You might need to use phpMyAdmin and run the command there to report back on the error. Just be sure to specify the prefix (if one is used) when you provide a table name (e.g. UPDATE zc_products ... if the prefix is 'zc_').

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

25 Dec 2021, 6:22 PM
#14
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Set future Product Availability Date For All Products?

Webskipper:

v157C

PHP Version: 7.4.27 (Zend: 3.4.0)

Date is in 2022: UPDATE products SET products_date_available = ‘2022-01-01 01:01:01';

Results: WARNING: An Error occurred ….

This patch did work last year. I have the shop closed for Winter. Shop stays is Showcase no price. Fails in normal Store mode, too.
What does the resulting myDebug-adm- log have to say about the operation? (Obscure the admin directory if posting the log. Also just before pasting it, look in the messagebox toolbar for the # symbol so that post between CODE tags.

If haven't yet, can install display logs in the modules->plugin manager section...

This appears will likely be a mysql related issue rather than a ZC issue.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

25 Dec 2021, 7:29 PM
#15
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Re: Set future Product Availability Date For All Products?

Webskipper:

v157C

PHP Version: 7.4.27 (Zend: 3.4.0)

Date is in 2022: UPDATE products SET products_date_available = ‘2022-01-01 01:01:01';

Results: WARNING: An Error occurred ….

This patch did work last year. I have the shop closed for Winter. Shop stays is Showcase no price. Fails in normal Store mode, too.

you quotes look off...

//from
UPDATE products SET products_date_available = ‘2022-01-01 01:01:01';
//to
UPDATE products SET products_date_available = ‘2022-01-01 01:01:01‘;
//or
UPDATE products SET products_date_available = '2022-01-01 01:01:01';

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

25 Dec 2021, 7:49 PM
#16
swguy avatar

swguy

Administrator

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

Re: Set future Product Availability Date For All Products?

Nice! Eagle-eyed @carlwhat to the rescue!

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

25 Dec 2021, 8:06 PM
#17
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Re: Set future Product Availability Date For All Products?

swguy:

Nice! Eagle-eyed @carlwhat to the rescue!

:thumbsup:

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

29 Dec 2021, 6:21 PM
#18
webskipper avatar

webskipper

Totally Zenned

Join Date:
Nov 2007
Location:
USA
Posts:
876
Plugin Contributions:
2

Re: Set future Product Availability Date For All Products?

Thanks Carl for the Catch!

Admin debug sez:
#1 trigger_error() called at [/includes/classes/db/mysql/query_factory.php:170]
#2 queryFactory->show_error() called at [/includes/classes/db/mysql/query_factory.php:142]
#3 queryFactory->set_error() called at [/includes/classes/db/mysql/query_factory.php:269]
#4 queryFactory->Execute() called at [/sniFf-mbN-Truck/sqlpatch.php:294]
#5 executeSql() called at [/sniFf-mbN-Truck/sqlpatch.php:735]
#6 require(/sniFf-mbN-Truck/sqlpatch.php) called at [/sniFf-mbN-Truck/index.php:11]
--> PHP Fatal error: 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '01:01:01‘' at line 1 :: UPDATE products SET products_date_available = ‘2022-01-01 01:01:01‘; ==> (as called by) /sniFf-mbN-Truck/sqlpatch.php on line 294 <== in /includes/classes/db/mysql/query_factory.php on line 170.

v157C
PHP Version: 7.4.27 (Zend: 3.4.0)
Store mode is Showcase only

Cheers!
v2.2.1

29 Dec 2021, 6:43 PM
#19
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Re: Set future Product Availability Date For All Products?

this works for me.

UPDATE products SET products_date_available = '2022-01-01'

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

29 Dec 2021, 6:55 PM
#20
swguy avatar

swguy

Administrator

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

Re: Set future Product Availability Date For All Products?

I think he may have the same issue as before.

Be sure you use the forward quote ' not the back quote `.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.