Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Jun 2007
    Location
    Bronx, New York, United States
    Posts
    675
    Plugin Contributions
    8

    Default Retrieving the admin directory via storefront notifier

    So I'm PRETTY sure this is not recommended or is in someway disallowed.

    I would like to make an observer that will effectively notify a webhook whenever a new order is created. I know that I would need to use the NOTIFY_ORDER_DURING_CREATE_ADDED_ORDER_HEADER hook from the notifier system. I would like to create a hyperlink that will point to the new order in the admin backend. But that would require access to DIR_WS_ADMIN which I think is not possible.

    Rather than hardcoding the directory into the notifier class, any advice on how to proceed?

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,242
    Plugin Contributions
    124

    Default Re: Retrieving the admin directory via storefront notifier

    If the script you intend to run is on the admin side, a relative URL will work fine. Make the link be

    index.php?cmd=orders&page=1&oID=xxxxx&action=edit

    and you'll get to the order details page from admin.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  3. #3
    Join Date
    Jun 2007
    Location
    Bronx, New York, United States
    Posts
    675
    Plugin Contributions
    8

    Default Re: Retrieving the admin directory via storefront notifier

    Quote Originally Posted by swguy View Post
    If the script you intend to run is on the admin side, a relative URL will work fine. Make the link be

    index.php?cmd=orders&page=1&oID=xxxxx&action=edit

    and you'll get to the order details page from admin.
    This was planned client side unless there is a notifier that can be triggered when a new order is made?

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,242
    Plugin Contributions
    124

    Default Re: Retrieving the admin directory via storefront notifier

    Sorry, I mean the "ultimate" target script. But to know where to write this, you'd still have to know the admin URL, so I guess it still wouldn't work.

    You might just want to create a config with the name of the admin folder so you can easily access it from anywhere, and you could alert from the admin if you login and see the value has changed.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  5. #5
    Join Date
    Jun 2007
    Location
    Bronx, New York, United States
    Posts
    675
    Plugin Contributions
    8

    Default Re: Retrieving the admin directory via storefront notifier

    Okay I guess I should ask, can an observer in the admin directory see events that would trigger from /classes/order.php?

  6. #6
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,242
    Plugin Contributions
    124

    Default Re: Retrieving the admin directory via storefront notifier

    For an observer to fire, you'd have to have software running. Storefront observers don't fire in arbitrary tasks; they fire in the process where the notifier was issued.

    You could have a cron job run from admin and take action based on new orders if you wanted.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  7. #7
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,242
    Plugin Contributions
    124

    Default Re: Retrieving the admin directory via storefront notifier

    You haven't disclosed what it is you're trying to do, but my guess is you'd be better off just creating a new admin widget to display orders that have not yet gone through whatever processing you want to do, and displaying them (like the New Order widget).

    https://docs.zen-cart.com/dev/code/widget/

    Then when you login you'd see the orders that need to be processed.

    If you want the processing to be done in real time when the order is placed, you should do it on the storefront side.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  8. #8
    Join Date
    Jun 2007
    Location
    Bronx, New York, United States
    Posts
    675
    Plugin Contributions
    8

    Default Re: Retrieving the admin directory via storefront notifier

    Quote Originally Posted by swguy View Post
    You haven't disclosed what it is you're trying to do, but my guess is you'd be better off just creating a new admin widget to display orders that have not yet gone through whatever processing you want to do, and displaying them (like the New Order widget).

    https://docs.zen-cart.com/dev/code/widget/

    Then when you login you'd see the orders that need to be processed.

    If you want the processing to be done in real time when the order is placed, you should do it on the storefront side.
    There is an API for PushBullet that will notify all machines that are subscribed to a "channel" whenever a message (or push) is sent. The API allows for a message to be customized and dispatched to all machines that are subscribed to that notification.

    What I wanted to have happen is that as a new order is sent in, a push (message) is sent which contains the Order #, Order Total, Payment Method (name of, not intricate details), Shipping Method and a separate link to the backend where the order can be viewed for processing.

    The idea ultimately being that as an order is processed in the front end, the observer will pull the order information (via usual SQL), build a message, and then push that message to the API which will send the nudge to all connected machines.

    The only problem is that in order to send the link, I have to specify the full HTML URI of the order which includes the URI of the backend.

    I can probably come back at it in the manner you suggested and run a cron that will check for new orders on a regular recurring basis. But I would likely have to add a column to the orders then have the crontab check for all orders not marked 1 in that column, send that push, then update that column to 1.

    But to do so live, in the manner I was trying to, still requires me to somehow get the name of the admin folder which is the biggest stump that I'm at. Overall I can still probably do this without the link being attached and drop it if's something or not normally done without reinventing the wheel. Like I can hardcode it for my shop, but was trying to make a generic solution so that all users can use it.

  9. #9
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,242
    Plugin Contributions
    124

    Default Re: Retrieving the admin directory via storefront notifier

    Put it in the DB - it becomes a general solution.

    https://docs.zen-cart.com/dev/plugins/adding_config/
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  10. #10
    Join Date
    Jun 2007
    Location
    Bronx, New York, United States
    Posts
    675
    Plugin Contributions
    8

    Default Re: Retrieving the admin directory via storefront notifier

    Quote Originally Posted by swguy View Post
    Put it in the DB - it becomes a general solution.

    https://docs.zen-cart.com/dev/plugins/adding_config/
    Is it safe for me to pull the name of the admin folder from a DB configuration setting? I mean I'm HAPPY to do that as it'll save me a headache and a half.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. in the admin 'Storefront" points to wrong URL
    By lrfowler24 in forum Installing on a Windows Server
    Replies: 2
    Last Post: 9 Aug 2021, 08:15 PM
  2. Replies: 8
    Last Post: 18 Jul 2019, 02:04 PM
  3. Having storefront be foreign language & the admin remain english?
    By chronometre in forum Customization from the Admin
    Replies: 3
    Last Post: 3 Dec 2010, 11:12 PM
  4. Upload, via FTP, the whole program into a directory on my server
    By alphamedit in forum Installing on a Windows Server
    Replies: 2
    Last Post: 22 Oct 2010, 11:27 AM
  5. have managed to botch the page title in both admin and storefront
    By schwimwastaken in forum General Questions
    Replies: 1
    Last Post: 4 Jul 2007, 04:08 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