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
Re: Inventory update script
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?
Re: Inventory update script
Quote:
Originally Posted by
kobra
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.
Quote:
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.
Re: Inventory update script
Quote:
Originally Posted by
clint6998
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.
Re: Inventory update script
Quote:
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!!
Re: Inventory update script
Quote:
Originally Posted by
clint6998
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...
Re: Inventory update script
Quote:
Originally Posted by
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...
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!