Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2012
    Posts
    106
    Plugin Contributions
    0

    Default Inventory update script

    I am currently updating my site from an older version to the new 1.5.4 and with a new theme. on my old site, I have a script on the tpl_header file that tells when the inventory was last updated

    Here is the script:

    PHP Code:
          $updated = mysql_query("SELECT `time` FROM `inv_rsr` where `id`='1'") or die(mysql_error());
              while ($inv_updated = mysql_fetch_array($updated)) { ?>
                Inventory Last Updated: <?php echo $inv_updated['time']; } ?> CST
    but when I but it in the tpl_header file in the new theme on the update version of ZC I get the following output:

    Access denied for user 'root'@'localhost' (using password: NO)

    Can someone help me work this out?

    Thanks,

    Clint

  2. #2
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,015
    Plugin Contributions
    61

    Default Re: Inventory update script

    Your going to need to create a proper structure for that...

    I would start here includes/modules/pages/index/index main_template_vars.php

    ~Melanie
    PRO-Webs, Inc. :: Recent Zen Cart Projects :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are NOT answered. You are welcome to contact us via our website for professional engagements.

  3. #3
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Inventory update script

    Code:
    FROM `inv_rsr`
    Is a table that you must have created as it is not stock ZenCart
    Is it in the same database as the rest of ZenCart's tables?
    Zen-Venom Get Bitten

  4. #4
    Join Date
    Aug 2012
    Posts
    106
    Plugin Contributions
    0

    Default Re: Inventory update script

    Quote Originally Posted by kobra View Post
    Code:
    FROM `inv_rsr`
    Is a table that you must have created as it is not stock ZenCart
    Is it in the same database as the rest of ZenCart's tables?
    Yes, I created the table and it is in the same DB as ZC.

    Your going to need to create a proper structure for that...

    I would start here includes/modules/pages/index/index main_template_vars.php

    ~Melanie
    I am lost when it comes to ZC's file structure. In the previous version I didn't need it. All it is, is a simple query.

    Can you help me? All I want it to do is show in the header the last time the inventory was updated.

  5. #5
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Inventory update script

    Quote Originally Posted by clint6998 View Post
    I am currently updating my site from an older version to the new 1.5.4 and with a new theme. on my old site, I have a script on the tpl_header file that tells when the inventory was last updated

    Here is the script:

    PHP Code:
          $updated = mysql_query("SELECT `time` FROM `inv_rsr` where `id`='1'") or die(mysql_error());
              while ($inv_updated = mysql_fetch_array($updated)) { ?>
                Inventory Last Updated: <?php echo $inv_updated['time']; } ?> CST
    but when I but it in the tpl_header file in the new theme on the update version of ZC I get the following output:

    Access denied for user 'root'@'localhost' (using password: NO)

    Can someone help me work this out?

    Thanks,

    Clint
    Code:
          $updated = $db->Execute("SELECT `time` FROM `inv_rsr` where `id`='1'");
      while (!$updated->EOF) {
     ?>
    Inventory Last Updated: <?php echo $updated->fields['time']; ?> CST <?php
    $updated->MoveNext(); 
    }
    Though if the expectation is that only one result would come back then could modify the above to not loop.

    Problem is, which no one has commented on, with ZC 1.5.3 and beyond, database functions require mysqli_ type functions. That said, when using zc, should use zc. Related functions so that version differences are minimal and "easy" to address. If you said you were using ZC 1.5.5 I would have suggested the loop to work differently.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Aug 2012
    Posts
    106
    Plugin Contributions
    0

    Default Re: Inventory update script

    Though if the expectation is that only one result would come back then could modify the above to not loop.

    Problem is, which no one has commented on, with ZC 1.5.3 and beyond, database functions require mysqli_ type functions. That said, when using zc, should use zc. Related functions so that version differences are minimal and "easy" to address. If you said you were using ZC 1.5.5 I would have suggested the loop to work differently.
    Thanks for the help mc12345678!!

  7. #7
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Inventory update script

    Quote Originally Posted by clint6998 View Post
    Thanks for the help mc12345678!!
    So if I may ask, what did you walk away with? I ask, because there are some that say: don't write the code, let them figure it out; and those that say I'm not a mechanic not going to change my own timing belt why would I be expected to write my own code... Seemed like frustratioin was brewing and I considered two options, poke the bear a little, or provide what might seem a functional solution.

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

  8. #8
    Join Date
    Aug 2012
    Posts
    106
    Plugin Contributions
    0

    Default Re: Inventory update script

    Quote Originally Posted by mc12345678 View Post
    So if I may ask, what did you walk away with? I ask, because there are some that say: don't write the code, let them figure it out; and those that say I'm not a mechanic not going to change my own timing belt why would I be expected to write my own code... Seemed like frustratioin was brewing and I considered two options, poke the bear a little, or provide what might seem a functional solution.

    Just curious...
    You may absolutely ask! I have no problem admitting my failings. You're right, I am not a mechanic but I did rebuild my first engine at 15. How? I took a shop class. I busted my tail 4 years ago learning zencart coding to get my site exactly the way I wanted it. I already knew HTML, css, and a little php so designing the skin wasnt an issue. I was also able to figure out where things went fairly easily. I also did well by the kind people here who taught me.

    When I downloaded the new ZC and threw in a template nothing looked familiar. Hell it still really doesn't. The languages have passed me by. Why? Because I ran out of time to learn and keep up. So now I am trying to hold my head above water just to get the new site up and running efficiently.

    So, what did I learn by you writing the code for me? I learned a difference in they way my script varies from the way yours does. I have also learned that I am in over my head and need to take a step back and start learning again to get myself back up to speed. and that I might hire you to do some other stuff for me...lol ;) You were one of the ones who helped me so much years ago!
    Last edited by clint6998; 31 Mar 2016 at 10:21 PM.

 

 

Similar Threads

  1. Excel to update inventory?
    By kenny724 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 11 Feb 2010, 07:14 PM
  2. Fast inventory update
    By pokemon3d in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 29 Jul 2009, 09:32 AM
  3. Bulk inventory quantity update
    By rfrenzob in forum General Questions
    Replies: 0
    Last Post: 18 Oct 2008, 02:10 PM
  4. Update Inventory with Customer Exchange
    By kenwvs in forum General Questions
    Replies: 5
    Last Post: 15 Jan 2008, 02:34 AM
  5. Update Inventory with Suppliers XML inventory feed?
    By mafiasam in forum All Other Contributions/Addons
    Replies: 4
    Last Post: 21 Jun 2007, 11:44 AM

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