Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Data Available - Make stock available mod , does it exist ?

    Hi
    I'm using the a mix of date available + publishing date from bookx module... but more or less it's the same.
    So the upcoming books or products have a stock 0 .
    Is there already some kind of module that does this automatically ?

    And if not, is this a routine checking that it's better to do on the admin or in the "front" code ?

    Thanks
    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

  2. #2
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Data Available - Make stock available mod , does it exist ?

    Quote Originally Posted by mesnitu View Post
    Hi
    I'm using the a mix of date available + publishing date from bookx module... but more or less it's the same.
    So the upcoming books or products have a stock 0 .
    Is there already some kind of module that does this automatically ?

    And if not, is this a routine checking that it's better to do on the admin or in the "front" code ?

    Thanks
    Are you asking if there is something that will make a product available based on date?

    There is code in ZC that already does something similar (on front end) for things like specials and sales. It could be "extended" to work with other such dates.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Re: Data Available - Make stock available mod , does it exist ?

    Thanks.
    Yes, it's something like that.
    I mean, there are shops and shops....ones work with real stocks, others dont.
    In this shop, the stocks are controled by the Sage software, but they are not sincronize with the online shop.....that something that I would like to do in EP4 , mapping the fields....
    Well, anyway, to say, that this is cool for shops that don't have those "real" stocks.
    The day comes, a some stock is added to the product.
    Got to check that code to see if I van make this happen
    Thanks

  4. #4
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Re: Data Available - Make stock available mod , does it exist ?

    well, to anyone that might find this usefull
    I've override the file init_special_func and added this to the IF :

    if (!isset($_SESSION['updateExpirations']) || $_SESSION['updateExpirations'] !== true) {

    PHP Code:
    require(DIR_WS_FUNCTIONS 'upcoming_expire.php');
    zen_expire_upcoming(); 
    Then created a new function file upcoming_expire.php with

    PHP Code:
    function zen_update_upcoming_status($upcoming_id) {
        global 
    $db;
        
    $sql "update " TABLE_PRODUCTS "
                set products_quantity = '100'
                where products_id = '" 
    . (int)$upcoming_id "'";

        return 
    $db->Execute($sql);
       }

      function 
    zen_expire_upcoming() {
        global 
    $db;
        
    $today $_SESSION['today_is'];
       
        
    $upcoming_query "select p.products_id
                           from " 
    TABLE_PRODUCTS " p 
                           LEFT JOIN "
    .TABLE_PRODUCT_BOOKX_EXTRA." be on p.products_id = be.products_id
                           where p.products_status = '1' AND p.products_quantity = '0' 
                           and ((" 
    $today " <=  be.publishing_date and be.publishing_date != '0000-00-00 00:00:00')
                           or (" 
    $today" <= p.products_date_available and p.products_date_available != null))";

        
    $upcoming $db->Execute($upcoming_query);

        if (
    $upcoming->RecordCount() > 0) {
          while (!
    $upcoming->EOF) {
            
    zen_update_upcoming_status($upcoming->fields['products_id']);
            
    $upcoming->MoveNext();
          }
        }
      } 
    In this case I'm using a bookx module. For a normal product, I guess this is enough

    PHP Code:
    function zen_expire_upcoming() {
        global 
    $db;
        
    $today $_SESSION['today_is'];
       
        
    $upcoming_query "select p.products_id
                           from " 
    TABLE_PRODUCTS " p 
                           
                           where p.products_status = '1' AND p.products_quantity = '0' 
                           
                           and (" 
    $today" <= p.products_date_available and p.products_date_available != null))";

        
    $upcoming $db->Execute($upcoming_query);

        if (
    $upcoming->RecordCount() > 0) {
          while (!
    $upcoming->EOF) {
            
    zen_update_upcoming_status($upcoming->fields['products_id']);
            
    $upcoming->MoveNext();
          }
        }
      } 
    And I'm also hardcoding the 100 for a stock.
    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

 

 

Similar Threads

  1. v151 No Order Payment Data Available
    By lat9 in forum PayPal Express Checkout support
    Replies: 7
    Last Post: 18 Dec 2015, 02:05 PM
  2. optional checkout upcharges - Mod available?
    By robertwhitis in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 5 Mar 2011, 02:47 PM
  3. Make download available by time
    By chrismarie in forum General Questions
    Replies: 1
    Last Post: 13 Mar 2010, 08:00 PM
  4. Make Contact Us Page Available
    By aladerma in forum Basic Configuration
    Replies: 2
    Last Post: 21 Nov 2008, 03:27 PM
  5. Is this type of mod available?
    By Lilyfox in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 28 Oct 2007, 11:41 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