My PHP code in a CScart page?

Is it possible to create a page and put some PHP in it? I’ve written a little script to take daily snaps of CS product status and store those off to a table. I need to display the daily diff comparisons on a page for me users. Arrg. Gimme my spinach. lol

Btw, I’m newly familiar with the My Changes addon. Have done an override but not sure how with pages or if it’s possible.

This is really running a cron job. This might be better done by creating a password protected PHP file. A cron command can call the PHP file, sending login data the file can use to access the database along with a daily hash; Basically the Y-M-D H:M the script is scheduled to run is hashed the first time it’s run. This should, in turn, match the hash next time it’s run.



The script should be able to log into the DB, coalate the data and add it to the new table or update an existing one.

You can’t put php or any smarty related code into the form fields as CS hasn’t added smarty parsing yet but you can edit the tpl’s directly and add php code like this:



{php}

your php code here

{/php}



However note that this can create severe security related issues and it is generally frowned upon adding php code within templates. Your much better off adding the code to whatever php file is currently dispatched - Sno

The problem is, of course, putting code inline doesn’t run it in a timely manner unless it hooks into product status updates.

Thanks all. Getting closer. I’m happy with the daily snapshot as this let’s me compare one day to the next and this is fine for the frequency that my users will want to update their sites off this info.



I agree that a hook or PHP page is the way to go and that’s the part I need help understanding. Let’s say I create a page called mypage. Where does this page file exist in the file structure, or is it dynamically generated? If dynamic, then how can I put my code’s output on it?

In case it’s not clear I just want my PHP code output in the main content area of a page so it looks like it’s wrapped by the other columns and doesn’t break up the flow too much.

You’d need to create an addon, obviously, with it’s own page. Is this an admin side or client side feature?