andyshears Posted April 6, 2023 Share Posted April 6, 2023 Hi all, I want to access joining my cubecart mailing list from another website ? What's the easiest way ? Regards Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 6, 2023 Share Posted April 6, 2023 In admin, Mailing List, Export Subscribers tab, an admin can download a text file (plain text or CSV) containing newsletter subscribers. This list can be integrated into another list for use by an external program. On the Import Subscribers tab, a textbox exists to submit a list of email addresses to be added to CubeCart's newsletter subscriber list, if wanting to use CubeCart's feature of emailing a newsletter. Quote Link to comment Share on other sites More sharing options...
andyshears Posted April 7, 2023 Author Share Posted April 7, 2023 Thanks for the reply, but it's not the answer I required. I want to have access to people joining my cubecart mailing list, but accessing the submit box from offsite. EG If I wanted to access the mailing list join, from my own website it would be something like www.mysite/skins/template/box.mailing.php But that dont work if accessing from a html page made on another site. So how do you put a html join up page on another site ? Regards Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 7, 2023 Share Posted April 7, 2023 (edited) Unfortunately, CubeCart employs a one-off (nonce) "Security Token" that is unique for each POST payload to the storefront (which is coupled to a cookie-based 'session'). The programming code that processes the command to add an email address to CubeCart's Newsletter Subscriber database is looking only for POSTed key/values in the payload - not anything in the querystring. Without a current security token, all GET and POST key/values are unset. What needs to happen is to fetch any page from CubeCart. That page will have a form element of type=hidden containing the security token. Then, the form on the external site will submit a form: Form: action="www.mystore.com/?_a=newsletter" method="post" Payload: [email protected] token=hashcode_from_prior_page_load Cubecart also employs an optional "double-opt-in" where an email is sent to the address submitted with a link to CubeCart to verify the subscription. And CubeCart also employs an optional reCaptcha that must be solved prior to proceeding with certain functions - 'subscribing' is one of them. Currently, there is no known after-market extension that would provide for CubeCart accepting subscription requests outside of itself. Edited April 7, 2023 by bsmither Quote Link to comment Share on other sites More sharing options...
andyshears Posted April 8, 2023 Author Share Posted April 8, 2023 Great answer thanks ! If the above is true, then it would be possible to send the user via url from one website to mywebsite, to a page that only had the signup submit, and then resize the page to display this, with something like...... ('http://www.mysite.com/signup2',"My Window Name", "width=200,height=100") If that would work, then any idea what the code would have to look like on the page within mysite to make that work ? Regards Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 8, 2023 Share Posted April 8, 2023 What we can try to do is a code snippet with a 'cron' trigger. So, at your other site, a simple form with method "get" (passes a querystring) will be processed by the snippet - which can be as lax as you need it to be. In admin, Manage Hooks, Code Snippets tab, click Add Snippet. Fill in the form that appears: Enabled: checked Unique ID: IngestSubscriberEmail@cc649+ Execution Order: 1 Description: Accepts and databases a subscriber's email address from outside CubeCart. Trigger: cron Version: 1.0.0 Author: https://forums.cubecart.com/topic/58293-access-mailing-list-from-offsite Code: <?php /** * Uses the 'cron' hook * Does not restrict based on 'double opt-in' settings. * Does not restrict based on 'reCaptcha' settings. */ if (isset($_GET['email'] && filter_var($_GET['email'], FILTER_VALIDATE_EMAIL)) { $email = strtolower($_GET['email']); $GLOBALS['db']->delete('CubeCart_newsletter_subscriber', array('email' => $email)); $record = array( 'status' => true, 'email' => $email, 'customer_id' => 0, 'ip_address' => get_ip_address(), 'date' => date('c'), 'imported' => true ); $GLOBALS['db']->insert('CubeCart_newsletter_subscriber', $record); } The form to submit the data items: Form attributes: action="www.mystore.com" method="get" Form payload: _g=cron _m=runSnippets [email protected] Test thoroughly! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.