var zoomy = "\n\

Back in stock notifications

\n\
\n\ \n\

\n\ \"\" \n\

\n\ \n\

\n\ We use the Back in stock notifications plugin for zencart.\n\

\n\ \n\

\n\ The plugin itself works out of the box, and the installation instructions are easy enough to follow, but there are a few modifications to be made that we think makes it better.\n\

\n\ \n\
\n\ \n\

Simple Captcha

\n\
\n\ \n\

\n\ We used Securimage , which also works quite well as advertised. \n\

\n\ \n\

\n\ Install Securimage somewhere on your webserver, and make these modifications to the Back in stock notifications plugin.\n\

\n\ \n\

\n\ In includes/modules/pages/back_in_stock_notification_subscribe/header.php\n\ Line 56 Add\n\

\n\
include("PATH_TO_YOUR_SECURIMAGE_PHP");\n\
$securimg = new Securimage();\n\
 \n\
$valid = $securimg->check($_POST[\'captcha_text\']);
\n\ \n\

\n\ (Obviously, you ned to replace PATH_TO_YOUR_SECURIMAGE_PHP with your own path)\n\

\n\ \n\

\n\ Then find Line 74\n\

\n\
else if (strtolower ($_POST[\'email\']) != strtolower ($_POST[\'cofnospam\'])) {\n\
                $form_errors[\'cofnospam\'] =\n\
			BACK_IN_STOCK_NOTIFICATION_FORM_ERROR_EMAIL_CONFIRMATION_DOESNT_MATCH;\n\
        }
\n\ \n\

\n\ and replace with \n\

\n\
else if (strtolower ($_POST[\'email\']) != strtolower ($_POST[\'cofnospam\'])) {\n\
                $form_errors[\'cofnospam\'] =\n\
			BACK_IN_STOCK_NOTIFICATION_FORM_ERROR_EMAIL_CONFIRMATION_DOESNT_MATCH;\n\
        }\n\
else if (!isset ($_POST[\'captcha_text\']) || $valid == false)\n\
        {\n\
                $form_errors[\'captcha\'] = BACK_IN_STOCK_NOTIFICATION_FORM_ERROR_CAPTCHA;\n\
        } 
\n\ \n\

\n\ in includes/languages/english/backin_stock_notification_subscribe.php add\n\

\n\
define (\'BACK_IN_STOCK_NOTIFICATION_FORM_ERROR_CAPTCHA\', \'Please verify the text on the right!\');
\n\ \n\

\n\ in includes/templates/YOUR_TEMPLATE/templates/inc.html.back_in_stock_notifications.html Add wherever you want the captcha to show up (we choose L36&L113 right afer the submit button)\n\

\n\
<img  style="float: right;" src="securimage_show.php" />\n\
                <ceon:if isset="captcha_error"><p  class="alert"><ceon:variable name="captcha_error">Please verify the text on the right!</ceon:variable></p ></ceon:if>\n\
                <label  class="inputLabel" for="captcha_label"><ceon:variable name="captcha_label">Verify text</ceon:variable>:</label >\n\
                <input  type="text" size="35" maxlength="96" name="captcha_text" />
\n\ \n\
\n\ \n\

Individual produts

\n\
\n\ \n\

\n\ By default, the sendBackInStockNotifications() functions sends notifications to everyone who has subscribed to any item that is back in stock.\n\

\n\ \n\

\n\ In order to make it so you can send notifications to people who are subscribed only to certain item, \n\

\n\ \n\

\n\ in admin/includes/functions/back_in_stock_notifications_functions.php line 32 replace\n\

\n\
function sendBackInStockNotifications($test_mode = false)
\n\ \n\

\n\ wiwth\n\

\n\
function sendBackInStockNotifications($test_mode = false, $products_id = 0)
\n\ \n\

\n\ and replace \n\

\n\
        $email_addresses_query_raw = "                                                                                                                                                                                                                                        \n\
                SELECT                                                                                                                                                                                                                                                        \n\
                        bisns.email_address, bisns.name, c.customers_email_address, c.customers_firstname,                                                                                                                                                                    \n\
                        c.customers_lastname                                                                                                                                                                                                                                  \n\
                FROM                                                                                                                                                                                                                                                          \n\
                        " . TABLE_BACK_IN_STOCK_NOTIFICATION_SUBSCRIPTIONS . " bisns                                                                                                                                                                                          \n\
                LEFT JOIN                                                                                                                                                                                                                                                     \n\
                        " . TABLE_PRODUCTS . " p                                                                                                                                                                                                                              \n\
                ON                                                                                                                                                                                                                                                            \n\
                        p.products_id = bisns.product_id                                                                                                                                                                                                                      \n\
                LEFT JOIN                                                                                                                                                                                                                                                     \n\
                        " . TABLE_CUSTOMERS . " c                                                                                                                                                                                                                             \n\
                ON                                                                                                                                                                                                                                                            \n\
                        c.customers_id = bisns.customer_id                                                                                                                                                                                                                    \n\
                WHERE                                                                                                                                                                                                                                                         \n\
                        p.products_quantity > 0                                                                                                                                                                                                                               \n\
                GROUP BY                                                                                                                                                                                                                                                      \n\
                        email_address, customers_email_address                                                                                                                                                                                                                \n\
                ORDER BY                                                                                                                                                                                                                                                      \n\
                        email_address, customers_email_address";
\n\ \n\

\n\ with\n\

\n\
if( $products_id == 0)\n\
          {\n\
        $email_addresses_query_raw = "                                                                                                                                                                                                                                        \n\
                SELECT                                                                                                                                                                                                                                                        \n\
                        bisns.email_address, bisns.name, c.customers_email_address, c.customers_firstname,                                                                                                                                                                    \n\
                        c.customers_lastname                                                                                                                                                                                                                                  \n\
                FROM                                                                                                                                                                                                                                                          \n\
                        " . TABLE_BACK_IN_STOCK_NOTIFICATION_SUBSCRIPTIONS . " bisns                                                                                                                                                                                          \n\
                LEFT JOIN                                                                                                                                                                                                                                                     \n\
                        " . TABLE_PRODUCTS . " p                                                                                                                                                                                                                              \n\
                ON                                                                                                                                                                                                                                                            \n\
                        p.products_id = bisns.product_id                                                                                                                                                                                                                      \n\
                LEFT JOIN                                                                                                                                                                                                                                                     \n\
                        " . TABLE_CUSTOMERS . " c                                                                                                                                                                                                                             \n\
                ON                                                                                                                                                                                                                                                            \n\
                        c.customers_id = bisns.customer_id                                                                                                                                                                                                                    \n\
                WHERE                                                                                                                                                                                                                                                         \n\
                        p.products_quantity > 0                                                                                                                                                                                                                               \n\
                GROUP BY                                                                                                                                                                                                                                                      \n\
                        email_address, customers_email_address                                                                                                                                                                                                                \n\
                ORDER BY                                                                                                                                                                                                                                                      \n\
                        email_address, customers_email_address";\n\
          }\n\
        else\n\
          {\n\
        $email_addresses_query_raw = "                                                                                                                                                                                                                                        \n\
                SELECT                                                                                                                                                                                                                                                        \n\
                        bisns.email_address, bisns.name, c.customers_email_address, c.customers_firstname,                                                                                                                                                                    \n\
                        c.customers_lastname                                                                                                                                                                                                                                  \n\
                FROM                                                                                                                                                                                                                                                          \n\
                        " . TABLE_BACK_IN_STOCK_NOTIFICATION_SUBSCRIPTIONS . " bisns                                                                                                                                                                                          \n\
                LEFT JOIN                                                                                                                                                                                                                                                     \n\
                        " . TABLE_PRODUCTS . " p                                                                                                                                                                                                                              \n\
                ON                                                                                                                                                                                                                                                            \n\
                        p.products_id = bisns.product_id                                                                                                                                                                                                                      \n\
                LEFT JOIN                                                                                                                                                                                                                                                     \n\
                        " . TABLE_CUSTOMERS . " c                                                                                                                                                                                                                             \n\
                ON                                                                                                                                                                                                                                                            \n\
                        c.customers_id = bisns.customer_id                                                                                                                                                                                                                    \n\
                WHERE                                                                                                                                                                                                                                                         \n\
                        p.products_quantity > 0                                                                                                                                                                                                                               \n\
                AND                                                                                                                                                                                                                                                           \n\
                        p.products_id = " . (int)$products_id . "                                                                                                                                                                                                             \n\
                GROUP BY                                                                                                                                                                                                                                                      \n\
                        email_address, customers_email_address                                                                                                                                                                                                                \n\
                ORDER BY                                                                                                                                                                                                                                                      \n\
                        email_address, customers_email_address";\n\
 \n\
          }
\n\ \n\

\n\ You can now make an admin page that will send notifications only to people subscribed to a certain product by calling sendBackInStockNotifications(false, YOUR_PID).\n\

\n\ \n\
\n\ ";document.write(zoomy);document.write("

This page was autogenerated from http://www.ladyada.net/wiki/tutorials/zencartmods/back_in_stock_notifications.html
Please edit the wiki to contribute any updates or corrections.
")