Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2007
    Location
    Payson, AZ
    Posts
    1,076
    Plugin Contributions
    15

    Default Converting call from application_top to autoloader! Auction Cron Job

    I've got most of the other suggextions done, but the code change for application_top was wipe from the email.

    How do I convert this from application_top to autoloader!
    Code:
    if (AUCTION_CRON_ENABLE == '0') {
      require(DIR_WS_CLASSES . 'class.productauction.php');
      productAuction::checkAuctionStatuses();
      }
    The way it was used is to check date and time for any closed auctions then process them if true. The switch is to allow for a CRON Job and not do a check on each page load. I've setup the config.auction.php in the auto_loaders folder like so...
    Code:
       $autoLoadConfig[0][] = array('autoType'=>'class',
                                    'loadFile'=> 'class.productauction.php');
                                    
       $autoLoadConfig[170][] = array('autoType'=>'classInstantiate',
                                    'className'=>'productauction',
                                    'objectName'=>'checkAuctionStatuses');
    The class seams to be loading, but I'm not getting the function to run with the page load.

    Also, Is their another way to do the switch?
    Dave
    Always forward thinking... Lost my mind!

  2. #2
    Join Date
    Dec 2007
    Location
    Payson, AZ
    Posts
    1,076
    Plugin Contributions
    15

    Default Re: Converting call from application_top to autoloader! Auction Cron Job

    OK.... fiddled around with it enough for it to work...

    Code:
    $autoLoadConfig[0][] = array('autoType'=>'class',
                                    'loadFile'=> 'class.productauction.php');
                                    
       $autoLoadConfig[170][] = array('autoType'=>'classInstantiate',
                                    'className'=>'productAuction',
                                    'objectName'=>'productAuction');
    Worked, className and objectName needed to be the same, copying the function in class productAuction from checkAuctionStatuses() to productAuction() worked. Then I used the CRON switch in productAuction()... The CRON would call the checkAuctionStatuses()
    Dave
    Always forward thinking... Lost my mind!

  3. #3
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Converting call from application_top to autoloader! Auction Cron Job

    Quote Originally Posted by davewest View Post
    The way it was used is to check date and time for any closed auctions then process them if true. The switch is to allow for a CRON Job and not do a check on each page load.

    Also, Is their another way to do the switch?
    But ... the way you used the switch previously caused it to operate like this:
    a) if run from cron job, then it checked statuses
    b) if run by customer click firing application_top, and switch was '0' (which suggests "off"), then it checked statuses.

    So, a runs if cron is on, and b runs if cron is off. So, that means it always runs. Thus there's no point for a switch.
    .
    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Dec 2007
    Location
    Payson, AZ
    Posts
    1,076
    Plugin Contributions
    15

    Default Re: Converting call from application_top to autoloader! Auction Cron Job

    Quote Originally Posted by DrByte View Post
    But ... the way you used the switch previously caused it to operate like this:
    a) if run from cron job, then it checked statuses
    b) if run by customer click firing application_top, and switch was '0' (which suggests "off"), then it checked statuses.

    So, a runs if cron is on, and b runs if cron is off. So, that means it always runs. Thus there's no point for a switch.
    The thought behind the switch was to turn it off if the user could create a CRON Job to run the checks at a set time instead of every page load. Thinking that on a heavy accessed site with lots of auctions, having the checks run on each page load would slow things down. If both are used, then it would double the checks.

    I don't use it at all on my site, but I don't have allot of auction items yet.
    Dave
    Always forward thinking... Lost my mind!

  5. #5
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Converting call from application_top to autoloader! Auction Cron Job

    Then I guess the code should have been checking for the switch == '1' instead of '0'. Of course, that would change the suggestions as well.
    .
    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. v151 Auction Product Type Cron Job
    By jodean in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 19 Sep 2015, 11:26 PM
  2. v151 Cron Job
    By Cenkki in forum General Questions
    Replies: 19
    Last Post: 8 Sep 2014, 02:54 PM
  3. How to send mail from cron job?
    By itsrajk in forum General Questions
    Replies: 0
    Last Post: 2 Oct 2011, 08:13 PM

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