Commits

pickupman committed f86cf39

Update installation routine with custom messageStack loader

  • Participants
  • Parent commits 13b3528

Comments (0)

Files changed (5)

File README

-===========
-Description
-===========
-This module modifies the behavior on how gifts certificates are sent. Zencart allows a customer to purchase a gift certificate and allow the customer to send an amount to someone else. When sending the amount to another person Zencart sends the gift amount immediately to the guest customer. This module allows that email to be sent to the guest customer at a later date. Say you purchase a gift certifcate, but someone's birthday isn't until next week. You can set the date and time that the email will be sent out to them. It can now arrive on their birthday.
-
-There is only one original file overwritten:
-/includes/modules/pages/gv_send/header_php.php
-
-============
-Requirements
-============
-You need to be able to schedule cron jobs on your server. Typically, for most users, this will be done through your control panel for you hosting account like cPanel.
-
-============
-Installation
-============
-1. Download and unzip the file.
-2. Rename folder in includes/templates/CUSTOM to match the name of your template folder
-3. Upload files
-4. Login to your admin page, and click on the "Admin Home" link in the header menu.
-5. Install Button will be shown at top. Click install button to install queries.
-6. You will now need to setup a cron job to schedule the email script. Login into your control panel and navigate to link for adding a cron job. The command you will need to enter is:  0/30 * * * * /path-to-zencat-folder/cron_gv_delay_send.php  This will run the script every 30 minutes.
-7. You are done.
-
-=======
-Removal
-=======
-You can remove this by navigation to your Admin page. Click on the "Admin Home" link in the header menu.
-In your address bar add "?remove_gv_delay_send=yes" without quotes. This should look like http://www.yoursite.com/admin-folder/index.php?remove_gv_delay_send
-
-Delete the file /admin-folder/includes/function/extra_function/gv_delay_send_functions.php
-
-You will need to restore the original version of the file: /includes/modules/pages/gv_send/header_php.php or remove the block of code documented as //GV Delay Send comments
+-----------
+Description
+-----------
+This module modifies the behavior on how gifts certificates are sent. Zencart allows a customer to purchase a gift certificate and allow the customer to send an amount to someone else. When sending the amount to another person Zencart sends the gift amount immediately to the guest customer. This module allows that email to be sent to the guest customer at a later date. Say you purchase a gift certifcate, but someone's birthday isn't until next week. You can set the date and time that the email will be sent out to them. It can now arrive on their birthday.
+
+There is only one original file overwritten:
+
+	/includes/modules/pages/gv_send/header_php.php
+
+------------
+Requirements
+------------
+
+You need to be able to schedule cron jobs on your server. Typically, for most users, this will be done through your control panel for you hosting account like cPanel.
+
+------------
+Installation
+------------
+
+1. Download and unzip the file.
+2. Rename folder in includes/templates/CUSTOM to match the name of your template folder
+3. Upload files
+4. Login to your admin page, and click on the "Admin Home" link in the header menu.
+5. Install Button will be shown at top. Click install button to install queries.
+6. You will now need to setup a cron job to schedule the email script. Login into your control panel and navigate to link for adding a cron job. The command you will need to enter is:  0/30 * * * * /path-to-zencat-folder/cron_gv_delay_send.php  This will run the script every 30 minutes.
+7. You are done.
+
+-------
+Removal
+-------
+You can remove this by navigation to your Admin page. Click on the "Admin Home" link in the header menu.
+In your address bar add "?remove_gv_delay_send=yes" without quotes. This should look like http://www.yoursite.com/admin-folder/index.php?remove_gv_delay_send=yes
+
+Delete the file:
+
+	/admin-folder/includes/function/extra_function/gv_delay_send_functions.php
+
+You will need to restore the original version of the file: /includes/modules/pages/gv_send/header_php.php or remove the block of code documented as //GV Delay Send comments

File RENAME-to-ADMIN-folder/includes/auto_loaders/config.reloadedstack.php

+<?php
+/**
+* Auto loader config for custom message stack
+* @author Joe McFrederick
+*/
+$autoLoadConfig[115][] = array('autoType'=>'init_script',
+                                'loadFile'=> 'init_reloadedstack.php');

File RENAME-to-ADMIN-folder/includes/functions/extra_functions/gv_delay_send_functions.php

  * @package ZenCart
  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  */
- 
+if( !class_exists('messageStack') )
+{
+	include('../../classes/message_stack.php');
+}
+if( !is_object($reloadedStack) )
+{
+	$reloadedStack = new messageStack();
+}
+
     //Auto install check
      $gvdelaysendCheck = $db->Execute("SHOW COLUMNS FROM " . TABLE_COUPON_EMAIL_TRACK);
           
      
      if($install == TRUE AND basename($_SERVER['PHP_SELF']) == 'index.php')
      {
-        echo '<div class="messageStackWarning">GV Delay Send <b>not installed</b>';
-        echo zen_draw_form('install', 'index.php', 'install_gv_delay_send=yes', 'post', '', true);
-        echo '<input type="submit" value="Install Now" />';
-        echo '</div>';
+        $reloadedStack->add('GV Delay Send <b>not installed</b><a href="index.php?install_gv_delay_send=yes">[Click to Install]</a>');
      }
      
      function remove_gv_delay_send()
      {
-        global $db;
+        global $db, $reloadedStack;
         
         $db->Execute("ALTER TABLE " . TABLE_COUPON_EMAIL_TRACK . " DROP COLUMN send_future");
         $db->Execute("ALTER TABLE " . TABLE_COUPON_EMAIL_TRACK . " DROP COLUMN message");
         $db->Execute("ALTER TABLE " . TABLE_COUPON_EMAIL_TRACK . " DROP COLUMN to_name");
         
+		$reloadedStack->add_session('GV Delay Send successfully removed', 'success');
+		
         zen_redirect(zen_href_link('index'));
      }
      
      function install_gv_delay_send()
      {
-        global $db, $install_sql;
+        global $db, $install_sql, $reloadedStack;
         
         //By default the table is not setup to store email addesses over 32 characters. Make column bigger
         $install_sql[] = "ALTER TABLE " . TABLE_COUPON_EMAIL_TRACK . " MODIFY emailed_to VARCHAR(150);";
         
         foreach ($install_sql as $sql) {
             $db->Execute($sql);
-        }        
+        }
+		$reloadedStack->add_session('GV Delay Send successfully installed', 'success');
         zen_redirect(zen_href_link('index'));
      }
      

File RENAME-to-ADMIN-folder/includes/init_includes/init_reloadedstack.php

+<?php