Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 36
  1. #21
    Join Date
    Feb 2009
    Posts
    738
    Plugin Contributions
    0

    Default Re: Scheduling a new release in the store

    Yes it did and here is the content:
    Code:
    [14-Feb-2019 19:52:52 America/New_York] PHP Parse error:  syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /home/creat419/public_html/creationcassel.com/store/includes/functions/disabled_upcoming.php on line 33
    I had copied and pasted the code above (the revised version).

  2. #22
    Join Date
    Jul 2012
    Posts
    14,546
    Plugin Contributions
    17

    Default Re: Scheduling a new release in the store

    Quote Originally Posted by CaroleAs View Post
    Yes it did and here is the content:
    Code:
    [14-Feb-2019 19:52:52 America/New_York] PHP Parse error:  syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /home/creat419/public_html/creationcassel.com/store/includes/functions/disabled_upcoming.php on line 33
    I had copied and pasted the code above (the revised version).
    Argghh...
    Change:
    Code:
    while (!disabled_upcoming->EOF) {
    To:
    Code:
    while (!$disabled_upcoming->EOF) {
    Adding a $ before disabled_upcoming...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  3. #23
    Join Date
    Feb 2009
    Posts
    738
    Plugin Contributions
    0

    Default Re: Scheduling a new release in the store

    I am not sure if it works (since I already released my weekly product) but at least now, the site is up and unaffected by uploading those three files. Not sure when I will be able to use that feature next but I'll update you then.

  4. #24
    Join Date
    Jul 2012
    Posts
    14,546
    Plugin Contributions
    17

    Default Re: Scheduling a new release in the store

    Quote Originally Posted by CaroleAs View Post
    I am not sure if it works (since I already released my weekly product) but at least now, the site is up and unaffected by uploading those three files. Not sure when I will be able to use that feature next but I'll update you then.
    Please do or if someone else picks it up and takes interest, maybe they too could report.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  5. #25
    Join Date
    Feb 2009
    Posts
    738
    Plugin Contributions
    0

    Default Re: Scheduling a new release in the store

    Today, I had the opportunity to schedule the product for this coming Friday. I set it up as usual, but put the date for June 14. However, when I checked the home page, the product was available and I was even able to add it to my cart. So, I suspect something is missing (maybe user error, or code error?). I am not sure what to check since there is no error showing so nothing.

  6. #26
    Join Date
    Jul 2012
    Posts
    14,546
    Plugin Contributions
    17

    Default Re: Scheduling a new release in the store

    OK, so what is: "as usual"... settings matter. Enabled/disabled is one of the important ones.

    Sounds like if it is showing that the status was set as enabled possibly with a future date, rather than disabled with a future date.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  7. #27
    Join Date
    Feb 2009
    Posts
    738
    Plugin Contributions
    0

    Default Re: Scheduling a new release in the store

    Quote Originally Posted by mc12345678 View Post
    OK, so what is: "as usual"... settings matter. Enabled/disabled is one of the important ones.
    I set the price, set the number of items, set the date available to the 14th (this coming Friday), but I did not set it to disabled.
    Should I manually set it to disabled? I thought that if it is only going to be made available on a later date, it would mean it is not available now.
    And if I set it manually to disabled, would it become enabled on that set date?
    I might just not understand the process.
    Last edited by CaroleAs; 13 Jun 2019 at 03:12 AM.

  8. #28
    Join Date
    Jul 2012
    Posts
    14,546
    Plugin Contributions
    17

    Default Re: Scheduling a new release in the store

    Quote Originally Posted by CaroleAs View Post
    I set the price, set the number of items, set the date available to the 14th (this coming Friday), but I did not set it to disabled.
    Should I manually set it to disabled? I thought that if it is only going to be made available on a later date, it would mean it is not available now.
    And if I set it manually to disabled, would it become enabled on that set date?
    I might just not understand the process.
    The expectation of this code change was that it was not to be visible by anyone shopping the site until the release date. To accomplish that in light of how ZC otherwise operates, the product needs to be disabled and have a future date. This should prevent the product from being seen in the "upcoming" products and from the store side categories and listings (at least in a default store). There may be one caveat to that, but it requires someone being knowledgeable about Zen Cart and forcefully/manually attempting to get to the product.

    Anyways, if the product has a future date and is enabled, then it shouldn't be able to be added to the cart yet when using the standard files and shouldn't be able to be edited to the cart when the changes of this thread have been applied.

    If those changes neeed to be again clearly stated, please let me know and can post the code in a single post.

    Again though, the changes of this are supposed to keep the product completely hidden until the release date by the product being manually disabled and the release date being some date in the future as compared to the system's date.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  9. #29
    Join Date
    Feb 2009
    Posts
    738
    Plugin Contributions
    0

    Default Re: Scheduling a new release in the store

    I think that if you posted the code and the instructions again, it would make everything available in one spot. Then, I can double-check to make sure the code I have is correct too.

    Thanks.

  10. #30
    Join Date
    Jul 2012
    Posts
    14,546
    Plugin Contributions
    17

    Default Re: Scheduling a new release in the store

    Sounds like a plan.

    Okay, so here is what this code is expected to do and how to make it happen.

    The expectation of a normal Zen Cart store is that if a product is to be made available for purchase in the future, that it be set as active, but to have an available date in the future. As soon as someone visits the store on that date (ie. Hour of 00:00 based on server time), then the product is able to be purchased. Before that time, it is visible but not purchasable.

    With this code change, the product is set as disabled and given a future date. Again, when the site is visited on that date or after, the product becomes visible and purchasable.

    To offer the capability of making the product hidden (while disabled) until the available date, the following code change and addition is expected to function.


    New file:
    includes/init_includes/init_special_funcs_disabled_upcoming.php

    Code:
    <?php
    /**
     * @copyright 2018
     * @license http://www.zen-cart.com/License/2_0.txt GNU Public License V2.0
     * @author mc12345678
     **/
    
    if (empty($_SESSION['today_is']) || $_SESSION['today_is'] != date('Y-m-d') || empty($_SESSION['updateExpirations_upcoming']) || $_SESSION['updateExpirations_upcoming'] !== true) {
        /**
         * require the disabled upcoming products functions, auto-enable disabled product.
         */
        require DIR_WS_FUNCTIONS . 'disabled_upcoming.php';
        zen_enable_disabled_upcoming();
    
        // Need to set the session variable so that will not execute on every load if other default Zen Cart code sets the today_is session variable.
        $_SESSION['updateExpirations_upcoming'] = true;
    }
    new file:
    includes/functions/disabled_upcoming.php
    Code:
    <?php
    /**
     * disabled-upcoming products functions
     *
     * @copyright 2018
     * @license http://www.zen-cart.com/License/2_0.txt GNU Public License V2.0
     * @author mc12345678
     **/
    
    function zen_set_disabled_upcoming_status($products_id, $status) {
        $sql = "UPDATE " . TABLE_PRODUCTS . "
                  SET products_status = " . (int)$status . ", products_date_available = '0001-01-01' WHERE products_id = " . (int)$products_id;
    
        return $GLOBALS['db']->Execute($sql);
    }
    
    function zen_enable_disabled_upcoming() {
    
        $date_range = time();
    
        $zc_disabled_upcoming_date = date('Ymd', $date_range);
    
        $disabled_upcoming_query = "SELECT products_id
                                                FROM " . TABLE_PRODUCTS . "
                                                WHERE products_status = 0
                                                AND ((products_date_available <= " . $zc_disabled_upcoming_date . "
                                                AND products_date_available != '0001-01-01'))
                                                ";
    
        $disabled_upcoming = $GLOBALS['db']->Execute($disabled_upcoming_query);
    
        if ($disabled_upcoming->RecordCount() > 0) {
            while (!$disabled_upcoming->EOF) {
                zen_set_disabled_upcoming_status($disabled_upcoming->fields['products_id'], 1);
                $disabled_upcoming->MoveNext();
            }
        }
    }
    Then to initiate the above code (saved for last to tie it together), add the following new file:

    includes/auto_loaders/config.enable_disabled_upcoming.php

    Code:
    <?php
    /**
     * disabled-upcoming products auto_loader to execute the operations.
     *
     * @copyright 2018
     * @license http://www.zen-cart.com/License/2_0.txt GNU Public License V2.0
     * @author mc12345678
     **/
    /**
     *Load just before the other special functions that may include this product.
     */
    
    $autoLoadConfig[149][] = array(
                                          'autoType'=>'init_script',
                                          'loadFile'=>'init_special_funcs_disabled_upcoming.php',
                                         );
    Note, there is no "do this for this product, but not that product" type switch incorporated. Ie. Once the final file is in place, any product that has a products_date_available that has passed will be so enabled and the products_date_available will be set/reset to 0001-01-01 as if it never had such a future date...

    Again, the expectation is that product set to disabled and having a future available date will become active and available when the system date becomes the date entered for the available date. This code does not directly support a date/time release which would be a little more involved.

    The above code incorporates the comments and changes posted in this thread, some of the comments have been modified to clarify and the layout of the code has been modified to attempt to meet PSR-2 style coding. By inserting the new files in the sequence provided above, no change to the system's operation will be evident until the last file has been applied. An alternate sequence of loading that would still work would be for the functions file to be loaded first then the first file then the third. Loading the third before the first and the first before the second will cause an error with site loading as a result of one or more missing files in the page load sequence.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

 

 
Page 3 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. v151 Time release or calendar/scheduling of a product? Possible?
    By mickyhulse in forum General Questions
    Replies: 7
    Last Post: 16 Apr 2014, 01:28 AM
  2. What's New in the Upcoming (v1.4) V2.0 release?
    By DrByte in forum Development Road Map
    Replies: 2
    Last Post: 29 Aug 2008, 11:33 PM
  3. Adding Product Type -- New Release
    By rush_woman in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 31 Jan 2007, 08:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR