Jump to content

Demitry

Members
  • Content count

    352
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by Demitry

  1. @BrockleyJohn For that var_dump of $vendor_shipping right before the line you mentioned I get the following: array(2) { [1]=> array(6) { ["weight"]=> float(7) ["cost"]=> float(35.99) ["qty"]=> int(1) ["ship_cost"]=> float(0) ["products_id"]=> array(1) { [0]=> int(8) } ["products_qty"]=> array(1) { [8]=> string(1) "1" } } [2]=> array(6) { ["weight"]=> float(7) ["cost"]=> float(39.99) ["qty"]=> int(1) ["ship_cost"]=> float(0) ["products_id"]=> array(1) { [0]=> int(17) } ["products_qty"]=> array(1) { [17]=> string(1) "1" } } } And I forgot to include Flat Rate as one of the shipping options I have for the current testing scenario. Here is a screenshot of the shipping options as I have them. USPS in the first vendor's product is not the cheapest method, but I selected it to display related testing data. The other modules really do nothing in relation to this sessions issue. I could just as well remove them all and just have USPS for both vendor products.
  2. @BrockleyJohn That line was added for MVS v1.3 (latest though not for BS Edge) by @drillsar here is the link to it. And @kymation Jim says that it's necessary just below that first post. Here is the same line in my MVS install for an older version of osC (MS2.2) and one that does not have this sessions issue. However, that site is running on PHP5.3 $shipping = array('id' => $shipping, I've tested this line by switching to the one without the session variable, but it made no difference. I have the following modules enabled (USPS, FedEx Web Services, Table, UPS ), however, none of the other ones cause a problem with the session. I had remove them all and added them one by one while testing the checkout with each add. The one that caused the issue is the USPS module. If I disable it or remove it, I can get to the checkout_payment.php page. With it enabled I get the login.php page. I appreciate your help John.
  3. @BrockleyJohn thanks, I checked that language file and other than a url link for one of the definitions and <br /> instead of a <br> there are no special characters that would trigger this session kill. There is a USPS module in the MVS addon, so it is supposed to work with it. However, I used the one form this contribution, which is a more detailed and better module. This addon also has a version specifically for the MVS module and that is the one I am working with. I'll keep testing for the session break to see what code in this USPS module with require adjustment.
  4. @BrockleyJohn John, it's actually a bit higher in the code because I am using the MVS addon. So, what I did was to comment out the redirect to the payment page and pulled the session content right before the redirect to the payment page in checkout_shipping.php By the point that this redirect is reached on that page, the session has already been destroyed. That's why as soon as the checkout_payment.php page loads, the first redirect is to the login page. // process the selected shipping method if ( isset($_POST['action']) && ($_POST['action'] == 'process') && isset($_POST['formid']) && ($_POST['formid'] == $sessiontoken) ) { if (!tep_session_is_registered('comments')) tep_session_register('comments'); if (tep_not_null($_POST['comments'])) { $comments = tep_db_prepare_input($_POST['comments']); } if (!tep_session_is_registered('shipping')) tep_session_register('shipping'); // MVS start if (SELECT_VENDOR_SHIPPING == 'true') { $total_shipping_cost = 0; $shipping_title = MULTIPLE_SHIP_METHODS_TITLE; $vendor_shipping = $cart->vendor_shipping; $shipping = array(); foreach ($vendor_shipping as $vendor_id => $vendor_data) { $products_shipped = $_POST['products_' . $vendor_id]; $products_array = explode ("_", $products_shipped); $shipping_data = $_POST['shipping_' . $vendor_id]; $shipping_array = explode ("_", $shipping_data); $module = $shipping_array[0]; $method = $shipping_array[1]; $ship_tax = $shipping_array[2]; if ( is_object($$module) || ($module == 'free') ) { if ($module == 'free') { $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE; $quote[0]['methods'][0]['cost'] = '0'; } else { $total_weight = $vendor_shipping[$vendor_id]['weight']; $shipping_weight = $total_weight; $cost = $vendor_shipping[$vendor_id]['cost']; $total_count = $vendor_shipping[$vendor_id]['qty']; $quote = $shipping_modules->quote($method, $module, $vendor_id); } if (isset($quote['error'])) { tep_session_unregister('shipping'); } else { if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) { $output[$vendor_id] = array('id' => $module . '_' . $method, 'title' => $quote[0]['methods'][0]['title'], 'ship_tax' => $ship_tax, 'products' => $products_array, 'cost' => $quote[0]['methods'][0]['cost'] ); $total_ship_tax += $ship_tax; $total_shipping_cost += $quote[0]['methods'][0]['cost']; }//if isset }//if isset }//if is_object }//foreach if ($free_shipping == true) { $shipping_title = $quote[0]['module']; } elseif (count($output) < 2) { $shipping_title = $quote[0]['methods'][0]['title']; } //MVS $shipping = array('id' => $_SESSION['shipping'], 'title' => $shipping_title, 'cost' => $total_shipping_cost, 'shipping_tax_total' => $total_ship_tax, 'vendor' => $output ); print '<pre>'; var_dump($_SESSION); die; //tep_redirect(tep_href_link('checkout_payment.php', '', 'SSL')); } else { // MVS if (SELECT_VENDOR_SHIPPING == 'true') // MVS end if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) { if ( (isset($_POST['shipping'])) && (strpos($_POST['shipping'], '_')) ) { $shipping = $_POST['shipping']; list($module, $method) = explode('_', $shipping); if ( is_object($$module) || ($shipping == 'free_free') ) { if ($shipping == 'free_free') { $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE; $quote[0]['methods'][0]['cost'] = '0'; } else { $quote = $shipping_modules->quote($method, $module); } if (isset($quote['error'])) { tep_session_unregister('shipping'); } else { if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) { $shipping = array('id' => $shipping, 'title' => (($free_shipping == true) ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'), 'cost' => $quote[0]['methods'][0]['cost']); tep_redirect(tep_href_link('checkout_payment.php', '', 'SSL')); } } } else { tep_session_unregister('shipping'); } } } else { if ( defined('SHIPPING_ALLOW_UNDEFINED_ZONES') && (SHIPPING_ALLOW_UNDEFINED_ZONES == 'False') ) { tep_session_unregister('shipping'); } else { $shipping = false; tep_redirect(tep_href_link('checkout_payment.php', '', 'SSL')); } } // if ( (tep_count_shipping_modules() > 0) } // MVS if (SELECT_VENDOR_SHIPPING == 'true') } // if ( isset($_POST['action']) && However, what I think I should be doing is testing the session output in the actual USPS module file. Am I right on that? Regarding the language file and replacing it. I assume you mean the /admin/language.php file, but replace it with what? My BS Edge version is from last August. I'm not sure if there is a more updated version out or if that file was updated since the release I have installed. Is that what you meant?
  5. @kymation Jim, that did work and I am able to view the session output,.. but I am not sure what I'm looking for in this output, or how it will pin point where the code issue is in the usps.php module file.
  6. @kymation Jim, It's not the constructor issue. That was the only thing I changed in that file. The constructor error would have come up as an on-page PHP error, and not the logged session destroyed error written to the error log file. @BrockleyJohn John, I was thinking something similar,.. perhaps along the lines of conflicts with unicode utf8, however, I am not sure of how to test the session, especially when dealing with a back-end process. Try echoing out what it's putting in the session and exiting before the redirect to checkout_payment. I apologize in advance as this is likely a simple and common way of testing, but I've never done it and am not sure how to do that. Could you tell me the steps to do this? I've never looked at the contents of a session and am not sure how I can. What I've done was to determine where the session is being killed and that was at the following line in checkout_shipping.php Both the $sessiontoken and tep_session_is_registered('customer_id') came up empty after this line. if ( isset($_POST['action']) && ($_POST['action'] == 'process') && isset($_POST['formid']) && ($_POST['formid'] == $sessiontoken) ) { So, after that I started checking the installed modules one-by-one and that's how I discovered that the USPS module was causing the session issue. However, I'm now a bit stuck because I am not sure how to further test to identify the issue in this module.
  7. @kymation Jim, I've narrowed down that MVS sessions issue to the USPS module from this addon. I used the MVS version from this addon. When installed and I try to proceed to the checkout_payment.php page, the session ends and I get redirected to the login page. The checkout_shipping.php page looks fine, it is just when I try to continue to the payment page is when the session ends. The exact error is: [05-Mar-2018 23:49:27 America/New_York] PHP Warning: session_start(): Failed to decode session object. Session has been destroyed in /home/xxxxxx/public_html/dev2/includes/functions/sessions.php on line 110 When I disable or uninstall that USPS module, the problem goes away. Could you try and test it on your end to see if this is in fact a bug? I have this set up on BS Edge with PHP7.1.7 Thanks.
  8. Demitry

    Multi_Vendor_Shipping new thread

    @ralgiere@phi148@kymation Ray, Bill, Jim, I have done a lot of work to this module to get it fixed, improved, and adapted to BS Edge as well as PHP7.1, however, almost three weeks back my laptop hard-drive died. I just got my new laptop a few days ago and have been working on getting everything back to what I had. This means that the BS Edge release of this addon will take a bit more time. Luckily I had most of my stuff backed up, ...but not everything. Though the most updated files for this addon are on my test server and I will be able to repackage them along with screenshots and much more. The problem I ran into that I could not resolve, before my laptop hard-drive crashed, was that upon proceeding to the checkout_payment.php page, the system would end the session and log me out of my account landing me on the login.php page. I had not resolved this problem and will need to before completing the new release. Any help would be greatly appreciated. And Bill, Thank you for your help on this module, as well as for saying that this MVS addon should be a standard part of every osCommerce release. I wish more people would make an issue of this, perhaps eventually it will not fall on deaf ears. Thumbs up to you for that! Demitry
  9. Demitry

    Multi_Vendor_Shipping new thread

    @kymation you and me both,.. I just caught a cold today. rushed to the store for OJ, zink, and coldeeze. ..been eating them by the hand-full. lol I've attached a copy of that checkout_shipping.php page. I was also having a bit of trouble with the structure between lines 201 and 218. MVS v1.3 and BS Edge are structured differently and I think I got it right. Please let me know if I did not. However, I don't think this part of the code is what's causing the session issue. checkout_shipping.php
  10. Demitry

    Multi_Vendor_Shipping new thread

    @kymation yep, I think it's a sessions issue. I just looked at my error_log and this is what I'm getting: [08-Feb-2018 03:08:40 America/New_York] PHP Warning: session_start(): Failed to decode session object. Session has been destroyed in /home/..../public_html/dev2/includes/functions/sessions.php on line 110 I set Recreate Session to false and the problem still exists. Could this be a Unicode (utf8) issue? I'm not even sure how to check for that? I looked at the sessions directives in my php.ini file but cannot tell if any of them would cause this issue. Do you know if there is one that could cause this problem?,.. I mean I can get to that checkout_payment.php page when MVS is disabled.
  11. Demitry

    Multi_Vendor_Shipping new thread

    @kymation hey Jim, I've installed MVS v1.3 and updated it for my BS Edge site on PHP7.1.29 and I keep having an issue with getting logged out and redirected to the login page a few seconds after clicking the Continue button on the checkout_shipping.php page. So basically, it never loads the checkout_payment.php page. It just logs me out and sends me to the login.php page. When I log back in the items in the cart are still there and nothing has changed. It could be a sessions issue, but I'm not sure. I also have PWA and Get 1 Free addons installed. I've searched and tried various tests but nothing is working. When switching off MVS, the checkout_payment.php page loads. Do you know what could be the issue? and could you point me in the right direction? thanks.
  12. hi, I just downloaded the latest version of this USPS addon and in the /includes/classes/http.php file every single function starts with a capital first letter - as in "Function" vs. "function" Does this make any difference? I googled it but cannot find anything on this matter. The reason I ask is because DreamWeaver does not recognize anything other than a lower case version as a function per its color coding.
  13. Demitry

    Multi_Vendor_Shipping new thread

    @phi148 hi Bill, I found this MVS addon updated for osC 2.3.4 ..however, I have not installed it yet and am not sure what's involved in upgrading it to BS Edge. https://apps.oscommerce.com/w3a2E&mvs-v1-0
  14. hi, I wanted to share a solution I found to an issue that affected this contribution. I have an osC site running an older version (MS2.2) and I'm on a shared hosting account. My hosting company recently (Dec 5th) did an upgrade to their mariaDB and stopped supporting MySQL. This upgrade caused a number of accounts like mine to display a TEP STOP database error (Error 1366). The error was: 1366 - Incorrect integer value: '' for column 'customer_id' at row 1 in user_tracking table. I realize this is not related to this contribution, but please keep reading. To fix this error there were a number of solutions of which the most common was to change the sql_mode directive to an empty string in either the my.ini or the my.cnf file. However, with a shared hosting plan, I have no access to these files and my hosting company would not make the change for me because it would mean they would need to restart MySQL and this would affect all other accounts on that server. So, after finding the culprit of this error in /includes/functions/user_tracking.php and resolving it, I got another TEP STOP error and this one does have to do with this contribution. The error was 1364: 1364 - Field 'cart_contents' doesn't have a default value in the supertracker table. To fix this I applied the following SQL query in phpMyAdmin and it resolved the error. There were no others after that, ..at least not yet. ALTER TABLE `supertracker` CHANGE `cart_contents` `cart_contents` MEDIUMTEXT DEFAULT NULL My intent is to post this solution to help anyone else that may encounter this issue. I spent a lot of time trying to resolve this problem and hope to save that time for others. Demitry
  15. Demitry

    Mailchimp newsletter Everywhere add on

    Thank you Loic, One minor correction: Correction on 2) d) 2) /includes /modules/header_tags/ht_mailchimp.php d) FIND this code (for the header module): $(\'#messagehd\').html(resultmessage); // display the message $(\'#fnamehd\').val(""); // reset input field $(\'#lnamehd\').val(""); // reset input field $(\'#emailhd\').val(""); // reset input field REPLACE it with this: $(\'#messagehd\').html(resultmessage); // display the message $(\'#fnamehd\').val(""); // reset input field $(\'#lnamehd\').val(""); // reset input field $(\'#urlhd\').val(""); // reset input field $(\'#emailhd\').val(""); // reset input field e) FIND this code (for the footer module): $(\'#messageft\').html(resultmessage); // display the message $(\'#fnameft\').val(""); // reset input field $(\'#lnameft\').val(""); // reset input field $(\'#emailft\').val(""); // reset input field REPLACE it with this: $(\'#messageft\').html(resultmessage); // display the message $(\'#fnameft\').val(""); // reset input field $(\'#lnameft\').val(""); // reset input field $(\'#urlft\').val(""); // reset input field $(\'#emailft\').val(""); // reset input field The error there is the ending “hd” for header, and “ft” for footer in the field id’s. Basically, this is to correct my error above.. so that the header fields clear after submission. Like I said, I did not install or test the header Mailchimp module. Demitry
  16. Demitry

    Mailchimp newsletter Everywhere add on

    Spam Bot Trap Ok, so there are a number of different solutions to use for blocking spam bots from submitting garbage emails to your opt-in form, but the one I decided on was the bait-trap type. That entails creating a couple of fields that spam bots cannot resist,.. then hiding these fields from the human user using CSS. I then set up a conditional statement to filter the human user submissions from those of bots. The human submissions are added to the Mailchimp list and the bot submissions end up in the abyss of the digital world of 0’s and 1’s. All that, and a fake success message to reinforce the bot that their spam submission was actually added to the site’s email list. Don’t think that today’s bots need a confirmation message? ..never underestimate technology. Today’s spiders & bots are much more sophisticated and can determine when their submission was rejected. And that, may initiate a more sophisticated attempt at submitting spam data. I chose to use two types of fields (though one would likely be enough) and some tasty keywords that spam bots cannot help but salivate over. This spam bot trap install includes my instructions from a prior post on this forum thread that differentiates the customer success message via the store owner selecting to automatically add that submitted email to the list OR requiring a 2nd tier approval opt-in emailed to the end user. If you choose “pending” for that 2nd tier approval opt-in emailed to the end user, then you likely don’t need this spam bot trap. However, the more hoops you have a customer jump through, the less opt-ins you’ll have. The install instructions here are for the BS Edge footer module, however, the code changes are made to support the BS Edge header module as well. To add this to the header module you will need to make additional changes to the header module template (similar to those of the footer module template). I only tested this on the footer module and chose that one because I prefer to have this email opt-in in the footer on my site. The following 5 files will require changes. Be sure to BACK-UP your site files before making ANY changes to your site. 1) /includes/languages/english/modules/header_tags/ht_mailchimp.php FIND this line: define('MODULES_HEADER_TAGS_MAILCHIMP_SUCCESS_MESSAGE', 'Success! Please click the confirmation link that will be emailed to you shortly.'); REPLACE it with this: define('MODULES_HEADER_TAGS_MAILCHIMP_SUCCESS_MESSAGE_PENDING', 'Success! Please click the confirmation link that will be emailed to you shortly.'); define('MODULES_HEADER_TAGS_MAILCHIMP_SUCCESS_MESSAGE_SUBSCRIBED', 'Success! Your information was submitted.'); define('MODULES_HEADER_TAGS_MAILCHIMP_SUCCESS_MESSAGE', 'Success! Your contact information was submitted.'); Note: To make testing easier, I made the success message slightly different for MODULES_HEADER_TAGS_MAILCHIMP_SUCCESS_MESSAGE than that of the .. _SUBSCRIBED message. 2) /includes /modules/header_tags/ht_mailchimp.php a) FIND this code: function execute() { global $oscTemplate; ADD just after it: $email_optin_success = (MODULES_HEADER_TAGS_MAILCHIMP_STATUS_CHOICE == 'pending' ? MODULES_HEADER_TAGS_MAILCHIMP_SUCCESS_MESSAGE_PENDING : MODULES_HEADER_TAGS_MAILCHIMP_SUCCESS_MESSAGE_SUBSCRIBED); // fake success message for bot opt-ins if (isset($_POST['url']) && $_POST['url'] == '' && !isset($_POST['terms_of_use'])) { $alert_type = 'danger'; $alert_msg = MODULES_HEADER_TAGS_MAILCHIMP_ERROR_MESSAGE; } else { $alert_type = 'success'; $alert_msg = MODULES_HEADER_TAGS_MAILCHIMP_SUCCESS_MESSAGE; } b) FIND BOTH instances of this: MODULES_HEADER_TAGS_MAILCHIMP_SUCCESS_MESSAGE REPLACE them with this: $email_optin_success c) FIND BOTH instances of this: resultmessage = \'<div class="alert alert-danger alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>' . MODULES_HEADER_TAGS_MAILCHIMP_ERROR_MESSAGE . '</div>\'; // display the message REPLACE them with this: resultmessage = \'<div class="alert alert-' . $alert_type . ' alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>' . $alert_msg . '</div>\'; // display the message d) FIND BOTH instances of this: $(\'#messagehd\').html(resultmessage); // display the message $(\'#fnamehd\').val(""); // reset input field $(\'#lnamehd\').val(""); // reset input field $(\'#emailhd\').val(""); // reset input field REPLACE them with this: $(\'#messageft\').html(resultmessage); // display the message $(\'#fnameft\').val(""); // reset input field $(\'#lnameft\').val(""); // reset input field $(\'#urlft\').val(""); // reset input field $(\'#emailft\').val(""); // reset input field 3) /includes /modules/content/footer/templates/footer_mailchimp.php FIND this code: <?php echo $form; if (!empty(MODULES_HEADER_TAGS_MAILCHIMP_LIST_CUSTOMERS) && (MODULE_FOOTER_MAILCHIMP_DISPLAY_NAME == 'True')) { echo tep_draw_input_field('firstname', NULL, 'id="fnamehd" placeholder="' . MODULE_FOOTER_MAILCHIMP_OPTIONAL . ENTRY_FIRST_NAME . '"') . ' '; echo tep_draw_input_field('lastname', NULL, 'id="lnamehd" placeholder="' . MODULE_FOOTER_MAILCHIMP_OPTIONAL . ENTRY_LAST_NAME . '"') . ' '; echo tep_draw_input_field('email', NULL, 'required aria-required="true" id="emailft" placeholder="' . ENTRY_EMAIL_ADDRESS . '"', 'email') . ' '; echo tep_draw_button(MODULE_FOOTER_MAILCHIMP_SUBMIT, 'fa fa-pencil-square-o', null, null, array('params' => 'id="SendButtonft"'), 'btn-success btn-sm'); } elseif (!empty(MODULES_HEADER_TAGS_MAILCHIMP_LIST_ANONYMOUS)) { echo tep_draw_input_field('email', NULL, 'required aria-required="true" id="emailft" placeholder="' . ENTRY_EMAIL_ADDRESS . '"', 'email') . ' '; echo tep_draw_button(MODULE_FOOTER_MAILCHIMP_SUBMIT, 'fa fa-pencil-square-o', null, null, array('params' => 'id="SendButtonft"'), 'btn-success btn-sm') . tep_draw_hidden_field('anonymous', 'anonymous'); } if (MODULE_FOOTER_MAILCHIMP_DISPLAY_PRIVACY == 'True') { echo tep_draw_button(MODULE_FOOTER_MAILCHIMP_PRIVACY, 'fa fa-user', tep_href_link('privacy.php'), null, null, 'btn-info btn-xs pull-right'); } echo $endform; echo '<br><div class="message" id="messageft"></div>'; ?> REPLACE it with this: <?php echo $form; if ((MODULES_HEADER_TAGS_MAILCHIMP_LIST_CUSTOMERS != '') && (MODULE_FOOTER_MAILCHIMP_DISPLAY_NAME == 'True')) { echo '<span class="website-url">Website URL:<br /><input type="text" name="url" id="urlft" placeholder="Website URL" /></span>'; echo tep_draw_input_field('firstname', NULL, 'id="fnameft" placeholder="' . MODULE_FOOTER_MAILCHIMP_OPTIONAL . ENTRY_FIRST_NAME . '"') . ' '; echo tep_draw_input_field('lastname', NULL, 'id="lnameft" placeholder="' . MODULE_FOOTER_MAILCHIMP_OPTIONAL . ENTRY_LAST_NAME . '"') . ' '; echo tep_draw_input_field('email', NULL, 'required aria-required="true" id="emailft" placeholder="' . ENTRY_EMAIL_ADDRESS . '"', 'email') . ' '; echo '<div class="accept-email-optin-terms">I accept the <a href="' . tep_href_link('terms_conditions.php') . '">Terms &amp; Conditions</a>: <input type="checkbox" name="terms_of_use" id="termsft" /></div>'; echo tep_draw_button(MODULE_FOOTER_MAILCHIMP_SUBMIT, 'fa fa-pencil-square-o', null, null, array('params' => 'id="SendButtonft"'), 'btn-success btn-sm'); } elseif ((MODULES_HEADER_TAGS_MAILCHIMP_LIST_ANONYMOUS != '')) { echo '<span class="website-url">Website URL:<br /><input type="text" name="url" id="urlft" placeholder="Website URL" /></span>'; echo tep_draw_input_field('email', NULL, 'required aria-required="true" id="emailft" placeholder="' . ENTRY_EMAIL_ADDRESS . '"', 'email') . ' '; echo '<div class="accept-optin-terms">I accept the <a href="' . tep_href_link('terms_conditions.php') . '">Terms &amp; Conditions</a>: <input type="checkbox" name="terms_of_use" id="termsft" /></div>'; echo tep_draw_button(MODULE_FOOTER_MAILCHIMP_SUBMIT, 'fa fa-pencil-square-o', null, null, array('params' => 'id="SendButtonft"'), 'btn-success btn-sm') . tep_draw_hidden_field('anonymous', 'anonymous'); } if (MODULE_FOOTER_MAILCHIMP_DISPLAY_PRIVACY == 'True') { echo tep_draw_button(MODULE_FOOTER_MAILCHIMP_PRIVACY, 'fa fa-user', tep_href_link('privacy.php'), null, null, 'btn-info btn-xs pull-right'); } echo $endform; echo '<br><div class="message" id="messageft"></div>'; ?> Note: if your Term & Conditions (or Terms of Use) file is named differently than terms_conditions.php, change the name of that file to that of your own (2 instances in the code above). 4) /ext/api/mailchimp_v3/subscribe.php FIND this code: if ( isset($_POST['anonymous'])) { $list_id = MODULES_HEADER_TAGS_MAILCHIMP_LIST_ANONYMOUS; $merge_vars = [ 'FNAME' => '', 'LNAME' => '' ]; } else { $list_id = MODULES_HEADER_TAGS_MAILCHIMP_LIST_CUSTOMERS; $merge_vars = [ 'FNAME' => $_POST['firstname'], 'LNAME' => $_POST['lastname'] ]; } $array = [ 'email_address' => $_POST['email'], 'merge_fields' => $merge_vars, 'status' => MODULES_HEADER_TAGS_MAILCHIMP_STATUS_CHOICE ]; if (MODULES_HEADER_TAGS_MAILCHIMP_STATUS_CHOICE == 'pending') { $status = 'pending'; } else { $status = 'subscribed'; } $MailChimp = new \MailChimp($key); // add the email to your list $result = $MailChimp->post('/lists/' . $list_id . '/members', $array); REPLACE it with this: if (isset($_POST['anonymous'])) { $list_id = MODULES_HEADER_TAGS_MAILCHIMP_LIST_ANONYMOUS; $merge_vars = array('FNAME' => '', 'LNAME' => ''); } else { $list_id = MODULES_HEADER_TAGS_MAILCHIMP_LIST_CUSTOMERS; $merge_vars = array('FNAME' => $_POST['firstname'], 'LNAME' => $_POST['lastname']); } $array = array('email_address' => $_POST['email'], 'merge_fields' => $merge_vars, 'status' => MODULES_HEADER_TAGS_MAILCHIMP_STATUS_CHOICE); if (MODULES_HEADER_TAGS_MAILCHIMP_STATUS_CHOICE == 'pending') { $status = 'pending'; } else { $status = 'subscribed'; } $MailChimp = new \MailChimp($key); // add the email to your list if (isset($_POST['url']) && $_POST['url'] == '' && !isset($_POST['terms_of_use'])) { // submit contact info when it is not a bot $result = $MailChimp->post('/lists/' . $list_id . '/members', $array); } else { // when it's a bot, leave out the path and list id $result = $MailChimp->post('', $array); } 5) /user.css ADD to the end of this file: .website-url, .accept-email-optin-terms { position:absolute; left:-20000px; } .accept-email-optin-terms { z-index:-100; } Note: You could add this code contained within the <style></style> tags at the top of the template file (file via #3 above), however, I believe it’s better to keep that CSS code outside of that template file. To test this feature, you will need to comment-out the CSS code in /user.css file OR, you could hold off adding that code in #5 (which will hide these two fields) until you complete testing the added spam bot-trap feature. The footer template form code also has a couple of error fixes same as the subscribed.php file. And I corrected the fields ID’s so that they clear upon submission. I tried using the tep_draw_input_field() for the Website URL field, but for some reason, it was not working for me. I have an idea as to why, but just did not want to waste more time fiddling with it. If anyone can find a way to improve this, please do so and share it. Demitry
  17. Demitry

    Mailchimp newsletter Everywhere add on

    Hey,.. just to follow up... From my prior post, ..those were arrays and though the module works with the current /exe/api/mailchimp_v3/subscribe.php file, this is the way this file should look. <?php /** * Gyakutsuki * subscribe.php * @copyright Copyright 2016 * @copyright Portions Copyright osCommerce * @license GNU Public License V2.0 * @version $Id: */ chdir('../../../'); require('includes/application_top.php'); include('ext/api/mailchimp_v3/MailChimp.php'); $key = MODULES_HEADER_TAGS_MAILCHIMP_API; if (isset($_POST['anonymous'])) { $list_id = MODULES_HEADER_TAGS_MAILCHIMP_LIST_ANONYMOUS; $merge_vars = array('FNAME' => '', 'LNAME' => ''); } else { $list_id = MODULES_HEADER_TAGS_MAILCHIMP_LIST_CUSTOMERS; $merge_vars = array('FNAME' => $_POST['firstname'], 'LNAME' => $_POST['lastname']); } $array = array('email_address' => $_POST['email'], 'merge_fields' => $merge_vars, 'status' => MODULES_HEADER_TAGS_MAILCHIMP_STATUS_CHOICE); if (MODULES_HEADER_TAGS_MAILCHIMP_STATUS_CHOICE == 'pending') { $status = 'pending'; } else { $status = 'subscribed'; } $MailChimp = new \MailChimp($key); // add the email to your list $result = $MailChimp->post('/lists/' . $list_id . '/members', $array); //send $result = json_encode($result); // If being called via ajax, run the function, else fail - console if ( MODULES_HEADER_TAGS_MAILCHIMP_DEBUG == 'True') { if ($_POST['ajax']) { var_dump($result); // send the response back } else { var_dump('Method not allowed - please ensure JavaScript is enabled in this browser'); } } else { echo $result; } I added spam bot-trap with my version and it works great!! Love this module! Demitry
  18. Demitry

    Mailchimp newsletter Everywhere add on

    I found another minor error. The footer template id names are ending with "hd" for header instead of "ft" for footer. All except the email field. What this does is, ...it does not clear the text fields after the contact info was submitted.
  19. Demitry

    Mailchimp newsletter Everywhere add on

    @Gyakutsuki Loic, The add-on works with PHP 7.1.7 ...that's what I am running the BS Edge on. The fix for the message issue is: 1) /includes/languages/english/modules/header_tags/ht_mailchimp.php ADD the following two definitions: define('MODULES_HEADER_TAGS_MAILCHIMP_SUCCESS_MESSAGE_PENDING', 'Success! Please click the confirmation link that will be emailed to you shortly.'); define('MODULES_HEADER_TAGS_MAILCHIMP_SUCCESS_MESSAGE_SUBSCRIBED', 'Success! Your information was submitted.'); 2a) /includes/modules/header_tags/ht_mailchimp.php FIND the following code (on line 57): function execute() { global $oscTemplate; ADD just below it: $email_optin_success = (MODULES_HEADER_TAGS_MAILCHIMP_STATUS_CHOICE == 'pending' ? MODULES_HEADER_TAGS_MAILCHIMP_SUCCESS_MESSAGE_PENDING : MODULES_HEADER_TAGS_MAILCHIMP_SUCCESS_MESSAGE_SUBSCRIBED); 2b) in the same file FIND both instances of: MODULES_HEADER_TAGS_MAILCHIMP_SUCCESS_MESSAGE and REPLACE them with: $email_optin_success
  20. Demitry

    Mailchimp newsletter Everywhere add on

    @Gyakutsuki ok, I will, thanks. In testing the features of this addon, I found a minor issue that's an easy fix. When the option for "subscribed" is selected in Admin > Modules > Header Tags > Newsletter Mailchimp V3, and an email is submitted, the success message is the same as for "pending" which says that the customer is to "..click the confirmation link that will be emailed to you shortly." However with that "subscribed" option there is nothing emailed to the customer to verify their opt-in. I've only installed and am testing on the footer module.
  21. Demitry

    Mailchimp newsletter Everywhere add on

    @raiwa@Gyakutsuki Rainer: thank you for following-up to clarify that,.. though I’m not sure why there needs to be two input-fields for the same list number, but that’s really not an issue. Loic: thank you for the API update and the development SW recommendations. I’m not a developer by trade and got quite comfortable with Dreamweaver over the years. I just downloaded the VS Code for Windows and will install and check it out. I was a bit surprised that it’s free. I always appreciate a good recommendation from an expert in the field. Demitry
  22. Demitry

    Mailchimp newsletter Everywhere add on

    btw, there's a newer version (v2.4) of the MailChimp API integration available. The one that is included in the osC addon is v2.2 https://github.com/drewm/mailchimp-api
  23. Demitry

    Mailchimp newsletter Everywhere add on

    hi Rainer, @raiwa Thank you for the reply and the explanation. That makes sense, but how does the system determine what list to add the opt-in email to? Is there a script that identifies a registered customer vs. an unregistered customer and adds them to the right list? Also, I found some errors via Dreamweaver. I'm not sure if these affect the performance of the addon, as I have not tested it yet. For the BS version: in /ext/api/mailchimp_v3/MailChimp.php line 88 (see attached screenshot) in /ext/api/mailchimp_v3/subscribe.php lines 21-24, 29-32, 35-39 (see attached screenshot) In that subscribe.php file, I assume all three of these are supposed to be arrays with different style brackets?
  24. Demitry

    Mailchimp newsletter Everywhere add on

    hi, I installed the latest version of this addon on BS Edge and have not tested it just yet. Before I do, I have a question regarding the Anonymous List number and Customer List number by Mailchimp,.. from the installation document. I found the Unique ID number for the list I created, but other than that and the API number there seems to be no other list number. I googled for it and search the mailchimp site for it but cannot find it. I used that unique ID number for both fields (Anonymous List number and Customer List number) in the osC admin panel, however, I am not sure if that is the right way to do this. Any help would be greatly appreciated. Thanks.
×